Quick start guide for running and understanding agent tests
# Install dependencies
cd evals/framework
npm install
npm run build
# Run all tests (uses free model by default)
npm run eval:sdk
# Run specific agent
npm run eval:sdk -- --agent=openagent
npm run eval:sdk -- --agent=opencoder
# Run specific test category
npm run eval:sdk -- --agent=openagent --pattern="context-loading/*.yaml"
# Debug mode (verbose output, keeps sessions)
npm run eval:sdk -- --debug
# Run tests in batches of 3 with 10s delays
./scripts/utils/run-tests-batch.sh openagent 3 10
======================================================================
TEST RESULTS
======================================================================
1. ✅ ctx-simple-coding-standards - Context Loading: Coding Standards
Duration: 22821ms
Events: 18
Approvals: 0
Context Loading: ⊘ Conversational session (not required)
Violations: 0 (0 errors, 0 warnings)
2. ✅ ctx-multi-standards-to-docs - Multi-Turn Standards to Documentation
Duration: 116455ms
Events: 164
Approvals: 0
Context Loading:
✓ Loaded: .opencode/context/core/standards/code.md
✓ Timing: Context loaded 44317ms before execution
Violations: 0 (0 errors, 0 warnings)
======================================================================
SUMMARY: 2/2 tests passed (0 failed)
======================================================================
| Field | Meaning |
|---|---|
| Duration | Total test execution time (includes agent thinking + tool execution) |
| Events | Number of events captured from server (messages, tool calls, etc.) |
| Approvals | Tool permission requests handled (not text-based approvals) |
| Context Loading | Whether context files were loaded before execution |
| Violations | Rule violations detected by evaluators |
┌─────────────────────────────────────────────────────────────────┐
│ TEST RUNNER │
├─────────────────────────────────────────────────────────────────┤
│ 1. Clean test_tmp/ directory │
│ 2. Start opencode server (from git root) │
│ 3. For each test: │
│ a. Create session │
│ b. Send prompt(s) with agent selection │
│ c. Capture events via event stream │
│ d. Run evaluators on session data │
│ e. Check behavior expectations │
│ f. Delete session (unless --debug) │
│ 4. Clean test_tmp/ directory │
│ 5. Save results to JSON │
│ 6. Print results │
└─────────────────────────────────────────────────────────────────┘
Example Test:
agent: opencoder
prompt: "List files in current directory"
behavior:
mustUseAnyOf: [[bash], [list]]
Example Test:
agent: openagent
prompts:
- text: "List files in current directory"
- text: "approve"
delayMs: 2000
behavior:
mustUseTools: [bash]
# File: evals/agents/openagent/tests/context-loading/my-test.yaml
id: my-test-001
name: "My Test Name"
description: |
What this test validates
category: developer
agent: openagent
model: anthropic/claude-sonnet-4-5
prompt: "Your test prompt here"
behavior:
mustUseTools: [read]
requiresContext: true
minToolCalls: 1
expectedViolations:
- rule: context-loading
shouldViolate: false
severity: error
approvalStrategy:
type: auto-approve
timeout: 60000
tags:
- context-loading
- simple-test
id: my-complex-test-001
name: "Multi-Turn Test"
description: |
Tests multi-turn conversation with context loading
category: developer
agent: openagent
model: anthropic/claude-sonnet-4-5
prompts:
- text: "What are our coding standards?"
expectContext: true
contextFile: "standards.md"
- text: "approve"
delayMs: 2000
- text: "Create documentation about these standards"
expectContext: true
contextFile: "docs.md"
- text: "approve"
delayMs: 2000
behavior:
mustUseTools: [read, write]
requiresApproval: true
requiresContext: true
minToolCalls: 3
expectedViolations:
- rule: approval-gate
shouldViolate: false
severity: error
- rule: context-loading
shouldViolate: false
severity: error
approvalStrategy:
type: auto-approve
timeout: 300000 # 5 minutes
tags:
- context-loading
- multi-turn
- complex-test
cd evals/results
./serve.sh
This will:
The dashboard caches data in your browser, so it works even after the server shuts down.
# Latest results
cat evals/results/latest.json
# Historical results
ls evals/results/history/2025-11/
Tests that create files use evals/test_tmp/:
prompt: |
Create a file at evals/test_tmp/test.txt with content "Hello"
The test runner automatically cleans this directory:
.gitignore and README.mdnpm run eval:sdk -- --agent=openagent --pattern="my-test.yaml" --debug
Debug mode shows:
# Sessions are stored here
ls ~/.local/share/opencode/storage/session/
# View session details (in debug mode)
cat ~/.local/share/opencode/storage/session/<session-id>.json
Look for the BEHAVIOR VALIDATION section in output:
============================================================
BEHAVIOR VALIDATION
============================================================
Timeline Events: 28
Tool Calls: 3
Tools Used: read, write
Tool Call Details:
1. read: {"filePath":".opencode/context/core/standards/code.md"}
2. read: {"filePath":".opencode/context/core/standards/docs.md"}
3. write: {"filePath":"evals/test_tmp/output.md"}
[behavior] Files Read (2):
1. .opencode/context/core/standards/code.md
2. .opencode/context/core/standards/docs.md
[behavior] Context Files Read: 2/2
Behavior Validation Summary:
Checks Passed: 4/4
Violations: 0
============================================================
Cause: SDK might not return the agent field
Impact: Warning only, not an error
Action: Ignore - test still validates correctly
Cause: Event stream connection failed
Action: Check server is running, restart test
Cause: Agent used a different tool
Action: Use mustUseAnyOf for flexibility:
behavior:
mustUseAnyOf: [[bash], [list]] # Either tool is acceptable
Cause: Test prompt doesn't specify evals/test_tmp/
Action: Update test prompt to use correct path
Cause: Test took longer than timeout value
Action: Increase timeout in test YAML:
timeout: 300000 # 5 minutes
| Category | Purpose | Example Tests |
|---|---|---|
| context-loading | Verify context files loaded before execution | ctx-simple-coding-standards |
| developer | Developer workflow tests | create-component, install-dependencies |
| business | Business analysis tests | data-analysis |
| edge-case | Edge cases and error handling | just-do-it, missing-approval |
# Uses opencode/grok-code-fast (free)
npm run eval:sdk
# Claude 3.5 Sonnet
npm run eval:sdk -- --model=anthropic/claude-3-5-sonnet-20241022
# GPT-4 Turbo
npm run eval:sdk -- --model=openai/gpt-4-turbo
# In test YAML file
model: anthropic/claude-3-5-sonnet-20241022
Read the docs:
Explore tests:
evals/agents/openagent/tests/context-loading/ - Context loading testsevals/agents/opencoder/tests/developer/ - Opencoder testsRun tests:
npm run eval:sdk -- --agent=openagent --pattern="context-loading/*.yaml"
View results:
cd ../results && ./serve.sh
Happy Testing! 🚀