honcho/tests/bench
doria dce96889bc
feat: honcho 3.0, sdks 2.0, excise stainless, update v3 docs, changelogs (#331)
* chore: 3.0 honcho and 2.0 sdks changelog

fix: use PeerContextResponse in peer.ts

* chore: move docs to /v3/, build SDKs

* chore: code review

* feat: [WIP] migrate away from stainless in typescript sdk

* chore: move api from /v2/ to /v3/

* feat: no-stainless typescript with real tests

* feat: migrate python sdk off of stainless

* feat: clean typescript sdk

* chore: add tests for ts http client

* fix: rewrite entire python sdk in new format, update typescript sdk to use `configuration` not `config` for consistency with API

* fix: clean up SDKs, synchronize

* chore: update sdk examples

* chore: update OpenAPI documentation and SDK examples to reflect changes

* fix: better test

* fix: install deps in test runner, improve robustness of streaming in sdk, coderabbit nits

* fix: standardize around camelCase in TS SDK

* refactor: update configuration handling in SDKs to use typed models for workspace, session, and peer configurations

* docs: clarify queue status usage and remove polling methods from SDKs

add claude skills for migrations

* chore: fix links in docs

* feat: add deriver flush mode to bypass batch token threshold

- Introduced `is_deriver_flush_enabled` function to check if flush mode is active.
- Updated `QueueManager` to conditionally apply batch token thresholds based on flush mode.
- Enhanced `UnifiedTestExecutor` to enable flush mode via Redis.
- Added `flush` parameter to test cases to facilitate testing of flush mode behavior.
- Updated various test cases to utilize the new flush functionality.

* feat: implement schedule_dream functionality in SDKs, use in unified test runner

- Added `schedule_dream` method to both Python and TypeScript SDKs for scheduling dream tasks.
- Updated HTTP routes to include endpoint for scheduling dreams.
- Enhanced test runner to utilize the new `schedule_dream` method for scheduling actions.
- Updated TypeScript client to support the new scheduling functionality with appropriate parameters.

* feat: update single deriver task to support multiple observers

- Changed the `observer` parameter to `observers` as a list in multiple functions across the deriver module.
- Updated the processing logic to handle multiple observers for representation tasks.
- Adjusted related payload and queue management functions to accommodate the new observers structure.
- Modified tests to reflect changes in the representation task handling and ensure proper functionality.

* refactor: update enqueue tests to support deduplication of queue items with multiple observers

- Modified tests in `test_enqueue.py` to reflect changes in the queue item structure, where each message now results in a single queue item containing a list of observers.
- Updated assertions to validate that the `observers` field correctly includes all relevant peers, ensuring proper functionality of the deduplication logic.
- Removed redundant payload matching logic to streamline test cases and improve clarity.

* fix: add backwards compatibility for representation work unit keys and payload observers

* feat: update dialectic configuration and introduce cost calculator

- Adjusted LLM and dialectic settings in `.env.template`, `config.toml.example`, and `src/config.py` to reduce maximum tool output characters and session history tokens for cost efficiency.
- Implemented a new `dialectic_cost_calculator.py` script to estimate costs based on reasoning levels and model pricing.
- Enhanced `DialecticAgent` to utilize minimal tools and adjusted output token settings based on reasoning level to optimize performance and reduce costs.

* feat: add reasoning level to chat input in unified test runner

- Enhanced the `UnifiedTestExecutor` to include a `reasoning_level` parameter in the chat method call.
- Updated the `QueryAction` model to support the new `reasoning_level` attribute, allowing for more nuanced chat interactions.

* feat: run deriver once for multiple observers (#335)

* feat: update single deriver task to support multiple observers

- Changed the `observer` parameter to `observers` as a list in multiple functions across the deriver module.
- Updated the processing logic to handle multiple observers for representation tasks.
- Adjusted related payload and queue management functions to accommodate the new observers structure.
- Modified tests to reflect changes in the representation task handling and ensure proper functionality.

* refactor: update enqueue tests to support deduplication of queue items with multiple observers

- Modified tests in `test_enqueue.py` to reflect changes in the queue item structure, where each message now results in a single queue item containing a list of observers.
- Updated assertions to validate that the `observers` field correctly includes all relevant peers, ensuring proper functionality of the deduplication logic.
- Removed redundant payload matching logic to streamline test cases and improve clarity.

* fix: add backwards compatibility for representation work unit keys and payload observers

* feat: refactor benchmark runners to share common functionality

- Introduced a new `runner_common.py` module containing shared utilities for benchmark test runners, including common argument parsing, client creation, and queue management.
- Updated `BEAMRunner`, `LoCoMoRunner`, and `LongMemEvalRunner` to inherit from `RunnerMixin`, leveraging shared functionality for metrics collection and logging.
- Added `reasoning_level` and `redis_url` parameters to runner constructors for enhanced configuration.
- Streamlined argument parsing by utilizing `add_common_arguments` for shared command-line options across all runners.

* fix: update last_user_message handling to use message content instead of ID

* fix: standardize config vs configuration

---------

Co-authored-by: Vineeth Voruganti <13438633+VVoruganti@users.noreply.github.com>
2026-01-22 15:16:28 -05:00
..
peer_card_tests Peer Cards (#180) 2025-08-12 17:39:08 -04:00
tests Peer Cards (#180) 2025-08-12 17:39:08 -04:00
.gitignore Merge branch 'main' into vince/dev-1259 2025-12-10 10:57:40 -05:00
README.md feat: beam benchmark initial commit 2025-11-17 10:36:26 -05:00
beam.py feat: honcho 3.0, sdks 2.0, excise stainless, update v3 docs, changelogs (#331) 2026-01-22 15:16:28 -05:00
beam_baseline.py feat: agentic dreamer and agentic dialectic (#309) 2026-01-12 15:12:17 -05:00
beam_common.py feat: agentic dreamer and agentic dialectic (#309) 2026-01-12 15:12:17 -05:00
explicit.py feat: agentic dreamer and agentic dialectic (#309) 2026-01-12 15:12:17 -05:00
harness.py feat: agentic dreamer and agentic dialectic (#309) 2026-01-12 15:12:17 -05:00
incorrect_beam_qs.txt feat: agentic dreamer and agentic dialectic (#309) 2026-01-12 15:12:17 -05:00
locomo.py feat: honcho 3.0, sdks 2.0, excise stainless, update v3 docs, changelogs (#331) 2026-01-22 15:16:28 -05:00
locomo_baseline.py feat: agentic dreamer and agentic dialectic (#309) 2026-01-12 15:12:17 -05:00
locomo_common.py feat: agentic dreamer and agentic dialectic (#309) 2026-01-12 15:12:17 -05:00
longmem.py feat: honcho 3.0, sdks 2.0, excise stainless, update v3 docs, changelogs (#331) 2026-01-22 15:16:28 -05:00
longmem_baseline.py feat: agentic dreamer and agentic dialectic (#309) 2026-01-12 15:12:17 -05:00
longmem_common.py feat: agentic dreamer and agentic dialectic (#309) 2026-01-12 15:12:17 -05:00
obex.py feat: agentic dreamer and agentic dialectic (#309) 2026-01-12 15:12:17 -05:00
run_tests.py feat: honcho 3.0, sdks 2.0, excise stainless, update v3 docs, changelogs (#331) 2026-01-22 15:16:28 -05:00
runner_common.py feat: honcho 3.0, sdks 2.0, excise stainless, update v3 docs, changelogs (#331) 2026-01-22 15:16:28 -05:00

README.md

Honcho Benchmark Suite

This directory contains benchmarking tools for evaluating Honcho's long-term memory capabilities.

Available Benchmarks

  • LongMemEval: Tests memory retention across multi-session conversations
  • BEAM: Beyond a Million Tokens - comprehensive long-term memory evaluation across 10 memory abilities

Development Harness

The development harness script makes it easy to run Honcho locally with a Docker database.

Overview

The harness.py script orchestrates the complete Honcho development environment:

  1. Database Setup: Starts a PostgreSQL database in Docker with a configurable port
  2. Database Provisioning: Runs Alembic migrations to set up the database schema
  3. Configuration: Uses environment variables to configure Honcho's database connection
  4. Service Startup: Starts both the FastAPI server and deriver process
  5. Configuration Verification: Prints the actual configuration that Honcho is using
  6. Monitoring: Provides real-time logs from all services
  7. Cleanup: Gracefully shuts down all services when stopped

Prerequisites

  • Python 3.11+
  • Docker and Docker Compose
  • Honcho project dependencies installed (uv sync)

Usage

Basic Usage

Run the harness with default settings (database on port 5433):

python tests/bench/harness.py

Custom Database Port

Run with a custom database port:

python tests/bench/harness.py --port 5434

Custom Project Root

If running from a different directory:

python tests/bench/harness.py --project-root /path/to/honcho

Command Line Options

  • --port: Port for the PostgreSQL database (default: 5433)
  • --project-root: Path to the Honcho project root (default: current directory)

What Gets Started

When you run the harness, it will start:

  1. PostgreSQL Database: Running in Docker on the specified port
  2. FastAPI Server: Available at http://localhost:8000
  3. API Documentation: Available at http://localhost:8000/docs
  4. Deriver Process: Background worker for processing messages

Configuration

The harness uses environment variables to configure Honcho's database connection:

  • DB_CONNECTION_URI: Set to postgresql+psycopg://testuser:testpwd@localhost:{port}/honcho

The script will print the actual configuration that Honcho is using after the FastAPI server starts. This gives you complete visibility into how Honcho's configuration system resolved the settings from environment variables, config files, and defaults.

Stopping the Services

Press Ctrl+C to gracefully stop all services. The harness will:

  1. Stop the FastAPI server and deriver processes
  2. Stop the Docker database container
  3. Clean up temporary files (Docker Compose configuration)

Troubleshooting

Database Connection Issues

If the database fails to start or connect:

  1. Check if port 5433 (or your custom port) is already in use
  2. Ensure Docker is running
  3. Try a different port: --port 5434

Configuration Issues

The script will print the actual configuration being used. If you see unexpected values:

  1. Check if you have a config.toml file that might be overriding environment variables
  2. Verify that the environment variables are being set correctly
  3. Check the Honcho configuration documentation for precedence rules

Integration with CI/CD

This harness can be used in CI/CD pipelines for integration testing. The script will:

  • Use temporary directories for isolation
  • Clean up all resources on exit
  • Provide clear error messages for debugging
  • Exit with appropriate status codes
  • Use environment variables for configuration (no file conflicts)

Test Runner

The run_tests.py script executes JSON-formatted tests against a running Honcho instance. The harness must be running.

Running Tests

  1. Start Honcho using the harness:

    python tests/bench/harness.py
    
  2. In another terminal, run the tests:

    # Run all tests
    python tests/bench/run_tests.py
    
    # Run a specific test
    # Test judge uses claude 3.5 sonnet
    python tests/bench/run_tests.py --test 1.json
    

Test Workflow

For each test, the runner:

  1. Creates a workspace for the test
  2. Adds all messages from the JSON to sessions
  3. Waits for deriver queue to be empty
  4. Executes queries as .chat() calls
  5. Judges responses using expected_response field

Test JSON Format

Tests are defined in JSON files with this structure:

{
    "sessions": {
        "session1": {
            "messages": [
                {
                    "peer": "alice",
                    "content": "Hello, how are you?"
                },
                {
                    "peer": "bob",
                    "content": "I'm good, thank you!"
                }
            ]
        }
    },
    "queries": [
        {
            "query": "How is Bob doing?",
            "expected_response": "Good",
            "session": "session1",  // optional
            "peer": "alice"         // optional
        }
    ]
}

Command Line Options

  • --tests-dir: Directory containing JSON test files (default: tests/bench/tests)
  • --test: Run a specific test file
  • --honcho-url: URL of running Honcho instance (default: http://localhost:8000)
  • --anthropic-api-key: Anthropic API key for response judging, uses LLM_ANTHROPIC_API_KEY if not given
  • --timeout: Timeout for deriver queue to empty (default: 60 seconds)