Skip to main content
Use ordinary Go tests for tool behavior and application policy. Use pkg/agents/eval to measure the agent’s answers and tool choices across a fixed set of scenarios.

Test an agent without a provider

The lower-level agents.LLM interface can supply deterministic responses. WithLLM returns a copy of the agent using that implementation:
For a single model decision without executing its tools, use lower-level AgentOptions.SingleTurn. A scripted model can return tool-call messages to test approval, state updates, and follow-up requests. These tests do not establish the quality of a real model’s decisions.

Evaluate representative cases

With agent configured and ctx supplied, import pkg/agents/eval:
Configure a lookup_order tool and known test data for this case. Each case gets a fresh thread in the eval namespace by default. Its turns share that thread. Text scoring uses the final turn’s answer; tool trajectories cover every turn. LLMJudge{Provider: judgeModel} makes extra model calls. Pin the judge and rubric when comparing runs. Implement Scorer.Name and Scorer.Score for application-specific criteria.

Use results in CI

A runner error means the suite could not run. A case error is stored in Result.Err; inspect Report.Failed() or Failures() even when Run returns no error. Cases pass on their mean score against Runner.Threshold, optionally overridden by Case.Threshold. The zero threshold is suitable only for collecting a baseline. Concurrency defaults to sequential execution. When increasing it, supply an Agent factory returning a distinct agent per case and use tools safe for concurrent execution. eval.Fixed is convenient for sequential suites. Keep fixture services and credentials separate from production side effects.