ReasoningBank Documentation

repository·main·Indexed 19 days ago

https://github.com/google-research/reasoning-bank

ReasoningBank is a memory mechanism for autonomous agents that enables learning from successful and failed trajectories using memory-aware test-time scaling. The repository includes implementations for WebArena and SWE-Bench experiments, integrating with various LLM families including GPT, Gemini, and Claude via Vertex AI, as well as a vendored version of mini-swe-agent for environment and agent orchestration.

Tokens
10.3K
Snippets
39
Records
52
Agent score
66%

What's inside ReasoningBank

  1. Available execution environments in mini-swe-agent

    main

    The mini-swe-agent package provides several environment implementations for executing code within different isolation levels. Depending on your security and infrastructure requirements, you can choose from the following:

    • local.py: Executes code directly on the host machine using subprocess.run. This is the least isolated method.
    • docker.py: Executes code within a Docker or Podman container.
    • singularity.py: Executes code within a Singularity or Apptainer container.
  2. Run mini-swe-agent locally without a sandbox

    main

    To test the agent in a local environment without container isolation, use the following scripts:

    • hello_world.py: An extremely simple example demonstrating how to use the default.py agent.
    • mini.py: Provides an interactive experience using either the interactive.py or interactive_textual.py agent/simple UI.
    # Example usage (conceptual)
    python hello_world.py
    python mini.py
  3. Set up SWE-Bench via mini-swe-agent

    main

    SWE-Bench implementation is built upon mini-swe-agent. To set it up:

    1. Navigate to the ./third_party directory.
    2. Install it from source using editable mode:
    pip install -e .

    This will install dependencies specified in pyproject.toml.

    cd third_party
    pip install -e .
  4. Configure LLM environment variables

    main

    ReasoningBank supports multiple model families via environment variables.

    GPT Models

    To use gpt-3.5-turbo, gpt-4, or gpt-4o, set your OpenAI API key:

    export OPENAI_API_KEY="your-openai-api-key"

    Gemini & Claude (via Vertex AI)

    To use Gemini models (gemini-2.5-flash, gemini-2.5-pro) or Claude (claude-3-7-sonnet@20250219) on Vertex AI, follow these steps:

    1. Authenticate via Google Cloud CLI: gcloud auth application-default login.
    2. Set the required project and location variables:
    export GOOGLE_CLOUD_PROJECT="your-project-id"
    export GOOGLE_CLOUD_LOCATION="your-region"
    export GOOGLE_GENAI_USE_VERTEXAI="True"
    # Example for Vertex AI configuration
    gcloud auth application-default login
    export GOOGLE_CLOUD_PROJECT="your-project-id"
    export GOOGLE_CLOUD_LOCATION="your-region"
    export GOOGLE_GENAI_USE_VERTEXAI="True"
  5. Use the vendored WebArena harness

    main

    The repository includes a patched webarena/ harness in third_party/webarena/ that includes fixes for shopping annotations, wishlist evaluation, and click stability. To ensure the system uses this patched version instead of a pip-installed browsergym.webarena, add the third_party directory to your PYTHONPATH.

    export PYTHONPATH="$(pwd)/third_party:$PYTHONPATH"
  6. Preprocess WebArena data

    main

    To prepare WebArena tasks, download the raw test files from this source and place them in the WebArena/config_files directory. Alternatively, use the patched version located at third_party/webarena/test.raw.json.

    Then, run the following script to generate the necessary config files:

    python WebArena/config_files/generate_config_files.py
    # Assuming you are in the root directory
    python WebArena/config_files/generate_config_files.py