Versions in this module Expand all Collapse all v0 v0.2.0 Nov 29, 2026 Changes in this version + var ErrInvalidHistory = errors.New("agent: invalid or incomplete conversation history") + var ErrInvalidResponse = errors.New("agent: invalid model response") + var ErrInvalidVerification = errors.New("agent: invalid verification evidence") + var ErrStepLimit = errors.New("agent: model step limit reached") + var ErrToolLimit = errors.New("agent: tool call limit reached") + var ErrVerificationFailed = errors.New("agent: final verification did not pass") + var ErrVerificationUnavailable = errors.New("agent: final verification unavailable") + func ValidateHistory(messages []Message, nativeFormat string) error + type Agent struct + func New(cfg Config) (*Agent, error) + func (a *Agent) Run(ctx context.Context, req Request) (Result, error) + type CheckResult struct + DurationMillis int64 + ExitCode *int + Name string + Status CheckStatus + type CheckStatus string + const CheckCanceled + const CheckError + const CheckFailed + const CheckNotRun + const CheckPassed + const CheckTimedOut + type Config struct + FinalVerifier Verifier + MaxSteps int + MaxToolCalls int + Model Model + Tools []Tool + type Event struct + Kind EventKind + Text string + ToolCallID string + ToolError bool + ToolName string + type EventKind string + const EventText + const EventToolFinished + const EventToolStarted + type Message struct + Native *NativeHistory + Role Role + Text string + ToolCallID string + ToolCalls []ToolCall + ToolError bool + type Model interface + Complete func(ctx context.Context, req ModelRequest, emit func(string) error) (ModelResponse, error) + type ModelRequest struct + Messages []Message + Tools []ToolSpec + type ModelResponse struct + Native *NativeHistory + Text string + ToolCalls []ToolCall + Usage *Usage + type NativeHistory struct + Data json.RawMessage + Format string + type NativeHistoryModel interface + NativeHistoryFormat func() string + type Request struct + History []Message + OnEvent func(Event) error + Prompt string + type Result struct + Messages []Message + Steps int + Text string + ToolCalls int + Usage []StepUsage + Verification *VerificationReport + type Role string + const RoleAssistant + const RoleSystem + const RoleTool + const RoleUser + type StepUsage struct + Step int + Usage Usage + type Tool struct + func NewTool[In, Out any](spec ToolSpec, handler func(context.Context, In) (Out, error)) (Tool, error) + type ToolCall struct + Arguments string + ID string + Name string + type ToolFailure struct + Message string + func (e *ToolFailure) Error() string + type ToolSpec struct + Description string + InputSchema json.RawMessage + Name string + type Usage struct + InputTokens int64 + OutputTokens int64 + TotalTokens int64 + type VerificationReport struct + Checks []CheckResult + func (r VerificationReport) Passed() bool + type Verifier interface + Verify func(context.Context) (VerificationReport, error)