Harden agent identity and communication flows
安全
Agent Tests
试用Define, run, and track tests for agent behavior. Test cases, assertions, regression tracking, and performance benchmarking. Zero external dependencies.
它能做什么
Define, run, and track tests for agent behavior. Test cases, assertions, regression tracking, and performance benchmarking. Zero external dependencies.
技能文档
Agent Tests 🧪
Stop guessing if your agent still works. Start testing it.
The Problem
Agent behavior changes with every model update, config change, and skill addition. Without tests, you have no way to know if something broke until a user catches it.
Agent Tests gives you a lightweight testing framework for agent behavior.
Quick Start
Add a test case
node skills/agent-tests/agent-tests.js --test --add greet "Say hello" "Hello" "contains:Hello"
List all tests
node skills/agent-tests/agent-tests.js --test --list
Run a specific test
node skills/agent-tests/agent-tests.js --test --run greet
Run all tests
node skills/agent-tests/agent-tests.js --test --run
Run performance benchmark
node skills/agent-tests/agent-tests.js --benchmark greet 10
Runs the test 10 times, reports average/min/max duration and pass rate.
Check regression report
node skills/agent-tests/agent-tests.js --regression
Shows pass rates, recent failures, and performance trends for all tests.
Remove a test
node skills/agent-tests/agent-tests.js --test --remove greet
Status overview
node skills/agent-tests/agent-tests.js --status
Assertion Types
| Assertion | Example | What it checks |
|---|---|---|
| Default | "expected text" | Expected text is in output |
contains: | contains:Hello | Output contains "Hello" |
not_contains: | not_contains:error | Output does NOT contain "error" |
regex: | regex:\d{3} | Output matches regex pattern |
length: | length:42 | Output is exactly 42 chars |
Features
Test Management
- Add/remove tests with name, prompt, and expected output
- Track run count and pass rate per test
- Persistent storage in
memory/agent-tests/tests.json
Assertion Engine
- Simple assertion syntax (no test framework needed)
- Supports contains, not_contains, regex, and length checks
- Extensible for custom assertions
Regression Tracking
- Groups results by test name
- Shows pass rate, total runs, and average duration
- Lists recent failures with specific assertion failures
- Flags tests below 80% pass rate with ⚠️
Performance Benchmarking
- Runs tests multiple iterations
- Reports average, min, max duration
- Tracks pass rate across iterations
- Saves benchmark history (last 50 runs per test)
Result History
- Stores last 1000 results per test
- Timestamps for every run
- Actual vs expected output captured
Configuration
Data files stored in: memory/agent-tests/
tests.json— Test definitionsresults.json— Test results history (last 1000)benchmarks.json— Benchmark history (last 50 per test)
Override data directory:
--dir /path/to/data
Agent Protocol
When testing agent behavior:
- Add tests —
--test --addfor critical behaviors - Run before changes —
--test --runbefore model/config updates - Benchmark periodically —
--benchmarkto track performance drift - Check regressions —
--regressionduring heartbeats - Remove stale tests —
--test --removefor outdated test cases
Limitations
- Test execution simulates output (actual agent output integration needed)
- Assertion engine is simple (regex, contains, length)
- No parallel test execution
- Results limited to 1000 entries
Comparison
| Approach | Test Framework | Regression | Benchmark |
|---|---|---|---|
| Manual checking | ❌ | ❌ | ❌ |
| Full test framework | ✅ | ⚠️ | ❌ |
| Agent Tests | ✅ | ✅ | ✅ |
Agent Tests gives you behavior testing + regression tracking + benchmarking with zero dependencies.
Design Principles
- Zero setup — Works immediately, no config needed
- No dependencies — Pure Node.js, no npm packages
- Simple assertions — Easy to write, hard to misinterpret
- Persistent — Tests and results survive restarts
- Transparent — Every run is logged and reportable
相关技能
Add communication tools to agent frameworks
Design eval test cases, run regression tests, and generate quality reports for AI Agents
Build typed agent identity and email integrations
Validates and merges multi-agent git work through a deterministic gate — a real command must exit 0 before anything merges. Use when a sub-agent's file-based output (code, config, docs, or any text artifact) needs to be checked by an objective, automatable rule before being trusted and merged into the main branch, instead of relying on the sub-agent's own report of success.
Agent self-awareness of cognitive states — context fatigue, attention drift, memory debt, confidence erosion, and skill staleness. Detect, report, and mitigate degrading conditions before they cause failures.