agenttest
Test harness for agent workflows. Provides deterministic mocking of LLM decisions, tool executions, and registry/memory state for unit and integration testing.
Used by test files across the codebase.
Usage
import "cruvero/internal/agenttest"
suite := agenttest.NewSuite(t)
suite.SetDecider(func(input agent.LLMDecisionInput) (agent.Decision, llm.Usage, error) {
// ...
})
suite.RegisterTool("http_get", func(input json.RawMessage) (json.RawMessage, error) {
// ...
})
Key Types / Interfaces
| Type | Source | Description |
|---|---|---|
Suite | suite.go | Test harness with mocking for LLM, tools, registry, memory |
LLMDecider | suite.go | func(agent.LLMDecisionInput) (agent.Decision, llm.Usage, error) |
ToolFunc | suite.go | func(json.RawMessage) (json.RawMessage, error) |
Utilities
DeterministicJSON— stable JSON serialization for snapshot testingMockTool— configurable mock tool executor- Golden log helpers for deterministic test output comparison