Test suite for validating OpenAgent behavior against defined standards and critical rules.
OpenAgent must follow these critical rules:
Simple questions that require no execution:
Expected Behavior:
Simple file operations:
Expected Behavior:
Multi-file features and complex tasks:
Expected Behavior:
Error handling and special scenarios:
Expected Behavior:
Test cases are defined in YAML files in test-cases/:
approval-gates.yaml - Approval gate enforcement testscontext-loading.yaml - Context loading compliance testsdelegation.yaml - Delegation appropriateness teststool-usage.yaml - Tool selection testsedge-cases.yaml - Error handling and special scenarios# Run all OpenAgent tests
cd evals/framework
npm run eval -- --agent openagent --all
# Run specific test category
npm run eval -- --agent openagent --test approval-gates
# Run single test case
npm run eval -- --agent openagent --test approval-gates --case file-creation-with-approval
# Analyze specific session
npm run eval -- --agent openagent --session ses_xxxxx
Results are stored in evals/results/YYYY-MM-DD/openagent/:
results/2025-11-21/openagent/
├── summary.json # Overall summary
├── approval-gates.json # Approval gate results
├── context-loading.json # Context loading results
├── delegation.json # Delegation results
└── report.md # Human-readable report
Configuration is in config.yaml:
agent: openagent
agent_path: ../../../.opencode/agent/openagent.md
test_cases_path: ./test-cases
sessions_path: ./sessions
evaluators:
- approval-gate
- context-loading
- delegation
- tool-usage
pass_threshold: 75
scoring:
approval_gate: 40
context_loading: 40
delegation: 10
tool_usage: 10
The sessions/ directory contains recorded test sessions for regression testing:
sessions/
├── simple-question/
│ ├── session.json
│ └── expected.yaml
├── file-creation/
│ ├── session.json
│ └── expected.yaml
└── complex-feature/
├── session.json
└── expected.yaml
Create test case in appropriate YAML file:
- id: my-new-test
name: "My New Test"
description: "Test description"
category: task
input: "User prompt"
expected_behavior:
approval_requested: true
tool_used: write
evaluators:
- approval-gate
- tool-usage
pass_threshold: 75
(Optional) Record a session for regression testing:
# Run OpenCode with the test prompt
opencode --agent openagent
> "User prompt"
# Copy session to sessions/
cp ~/.local/share/opencode/project/.../session/info/ses_xxxxx.json \
sessions/my-new-test/session.json
Run the test:
npm run eval -- --agent openagent --test my-new-test
Tests run automatically on:
See: .github/workflows/eval-openagent.yml
Track these metrics over time: