Skip to main content

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

TypeSourceDescription
Suitesuite.goTest harness with mocking for LLM, tools, registry, memory
LLMDecidersuite.gofunc(agent.LLMDecisionInput) (agent.Decision, llm.Usage, error)
ToolFuncsuite.gofunc(json.RawMessage) (json.RawMessage, error)

Utilities

  • DeterministicJSON — stable JSON serialization for snapshot testing
  • MockTool — configurable mock tool executor
  • Golden log helpers for deterministic test output comparison