Versions in this module Expand all Collapse all v0 v0.1.0 Aug 9, 2026 Changes in this version + const CancelledToolResultContent + const ContentTypeInputFile + const ContentTypeInputImage + const ContentTypeInputText + const ContentTypeOutputText + const ContentTypeRefusal + const PermissionAllowAlways + const PermissionAllowOnce + const PermissionRejectAlways + const PermissionRejectOnce + const RoleAssistant + const RoleDeveloper + const RoleReasoning + const RoleSystem + const RoleTool + const RoleUser + const StatusCompleted + const StatusInProgress + const StatusIncomplete + const StreamEventComplete + const StreamEventError + const StreamEventFunctionCall + const StreamEventInterrupt + const StreamEventMessage + const StreamEventReasoning + const StreamEventToolResult + var DefaultPermissionOptions = interrupt.DefaultPermissionOptions + var ErrApiKeyNotSet = errors.New("api key not set") + var ErrEmptyWorkerTask = errors.New("worker task is empty") + var ErrInterruptNotFound = interrupt.ErrInterruptNotFound + var ErrInvalidPayload = interrupt.ErrInvalidPayload + var ErrMaxTokens = errors.New("max tokens reached") + var ErrMaxTurnRequests = errors.New("max turn model requests exceeded") + var ErrModelAfterTools = errors.New("model request failed after tools completed") + var ErrModelNotSet = errors.New("model not set") + var ErrModelRefused = errors.New("model refused") + var ErrToolNotFound = errors.New("tool not found") + var ErrToolPermissionDenied = errors.New("tool permission denied") + var ErrToolTimeout = errors.New("tool timed out") + var ErrUnknownModel = errors.New("unknown model") + var ErrWorkerIncomplete = errors.New("worker finished without completing") + var ErrWorkerNoModel = errors.New("worker has no model") + var ErrWorkerNoOutput = errors.New("worker produced no output") + var ErrWorkerNotFound = errors.New("worker not found") + var ErrWorkerParkMissing = errors.New("parked worker state is missing") + var ToolExecuteAccess = mapset.NewSet[ToolPermission](ExecutePermission) + var ToolFullAccess = mapset.NewSet[ToolPermission](ReadPermission, WritePermission, ExecutePermission) + var ToolReadAccess = mapset.NewSet[ToolPermission](ReadPermission) + var ToolReadExecuteAccess = mapset.NewSet[ToolPermission](ReadPermission, ExecutePermission) + var ToolReadWriteAccess = mapset.NewSet[ToolPermission](ReadPermission, WritePermission) + var ToolWriteAccess = mapset.NewSet[ToolPermission](WritePermission) + func RegisterInterrupt(factory func() Interrupt) + func ResolveToolTitle(displayName, toolName, argsJSON string) string + func ToolsAsJson(tools []*Tool) string + func TypeToJSONSchema(v any) (map[string]any, error) + func UnsupportedMIMEs(s InferenceStrategy, mimes []string) []string + func WrapStopReason(kind, cause error) error + type AbsorbResult struct + SummaryChunks []LLMResponseChunk + type AgentHarness struct + func NewAgent(ctx context.Context, opts AgentOptions) *AgentHarness + func NewAgentFromSession(ctx context.Context, sessionId string, opts AgentOptions) (*AgentHarness, error) + func (a *AgentHarness) AskUserQuestion(toolCallID string) string + func (a *AgentHarness) ClearSearchNamespace() + func (a *AgentHarness) Close() + func (a *AgentHarness) FinalizeCancelledWork(ctx context.Context) + func (a *AgentHarness) HasOpenToolWork() bool + func (a *AgentHarness) Messages() []*Message + func (a *AgentHarness) ReturnFromInterrupt(ctx context.Context, finishedInterrupts map[string][]byte) (<-chan StreamEvent, error) + func (a *AgentHarness) Run(ctx context.Context, prompt string) (<-chan StreamEvent, error) + func (a *AgentHarness) RunMessage(ctx context.Context, user *Message) (<-chan StreamEvent, error) + func (a *AgentHarness) SearchNamespace() (uuid.UUID, bool) + func (a *AgentHarness) SessionID() string + func (a *AgentHarness) SetSearchNamespace(id uuid.UUID) + type AgentOptions struct + Brain *brain.Engine + BrainWriteKinds brain.WriteKinds + Config Config + ContextManager ContextManager + ContextPolicy ContextPolicy + ExaAPIKey string + MCPConfigs []mcp.MCPConfig + Model InferenceStrategy + ModelTasks ModelTasks + SearchNamespace *uuid.UUID + SessionID string + SkillsLoader skills.SkillLoader + Store stores.BaseStore + SubAgents []*SubAgent + ToolInterceptors []ToolInterceptor + ToolResultHooks map[string]ToolResultHook + Tools []*Tool + WatchDog AgentWatchDog + type AgentWatchDog interface + RecordError func(error) error + RecordOutput func(*Message) error + RecordThinking func(*Message) error + RecordTokens func(int, int) error + RecordToolCalls func(*Message) error + RecordToolResult func(*Message) error + type Annotation = streaming.Annotation + type BuiltinResult struct + Effect ToolResultEffect + Output string + SuppressWindowMessage bool + type Config struct + MaxTurnRequests int + MaxWindowSize int + SkillDirectories []string + SystemPrompt string + type ContentPart = streaming.ContentPart + type ContextManager interface + Add func(msg *Message) + InstallPlanDocument func(planRaw string) error + Messages func() []*Message + Replace func(window []*Message) + Restore func(window []*Message) + Snapshot func() []*Message + type ContextPolicy struct + CompressFraction float64 + PressureRatio float64 + StreamFitSummary bool + func DefaultContextPolicy() ContextPolicy + type DefaultModelTasks struct + func NewDefaultModelTasks(model InferenceStrategy, ctx ContextManager, policy ContextPolicy, maxSize int) *DefaultModelTasks + func (t *DefaultModelTasks) Absorb(ctx context.Context, msg *Message, tools []*Tool, systemPrompt string) (AbsorbResult, error) + func (t *DefaultModelTasks) Handoff(ctx context.Context, plan []Todo, planDoc string, tools []*Tool, ...) error + func (t *DefaultModelTasks) Turn(ctx context.Context, tools []*Tool, systemPrompt string) (<-chan LLMResponseChunk, error) + type FileData = streaming.FileData + type HarnessRuntime = session.Runtime + type ImageURL = streaming.ImageURL + type InferenceStrategy interface + CompressContextWindow func() error + CountTokens func(context.Context, []*Message, []*Tool) (int, error) + Invoke func(context.Context, []*Message, []*Tool) (chan LLMResponseChunk, error) + MaxContextWindow func() (int, error) + SetSystemPrompt func(string) + SupportsMIME func(mimeType string) bool + WithApiKey func(string) InferenceStrategy + WithModel func(string) InferenceStrategy + WithReasoningLevel func(string) InferenceStrategy + WithStructuredOutput func(any) InferenceStrategy + WithURL func(string) InferenceStrategy + type Interrupt = interrupt.Interrupt + type ItemStatus = streaming.ItemStatus + type LLMResponseChunk = streaming.LLMResponseChunk + type Message = streaming.Message + type MessageRole = streaming.MessageRole + type ModelContextManager struct + func NewModelContextManager() *ModelContextManager + func (m *ModelContextManager) Add(msg *Message) + func (m *ModelContextManager) InstallPlanDocument(planRaw string) error + func (m *ModelContextManager) Messages() []*Message + func (m *ModelContextManager) Replace(window []*Message) + func (m *ModelContextManager) Restore(window []*Message) + func (m *ModelContextManager) Snapshot() []*Message + type ModelTasks interface + Absorb func(ctx context.Context, msg *Message, tools []*Tool, systemPrompt string) (AbsorbResult, error) + Handoff func(ctx context.Context, plan []Todo, planDoc string, tools []*Tool, ...) error + Turn func(ctx context.Context, tools []*Tool, systemPrompt string) (<-chan LLMResponseChunk, error) + type PayloadValidator = interrupt.PayloadValidator + type PermissionOption = interrupt.PermissionOption + type ProviderStatus interface + ProviderErrorCode func() string + ProviderHTTPStatus func() int + type StreamEvent = streaming.StreamEvent + type StreamEventType = streaming.StreamEventType + type SubAgent struct + Description string + Instructions string + Model InferenceStrategy + SubAgents []*SubAgent + Tools []*Tool + WorkerName string + type Todo = streaming.Todo + type Tool struct + Access mapset.Set[ToolPermission] + Category streaming.ToolCategory + Description string + DisplayName string + Name string + Namespace string + PermissionRequired bool + Timeout time.Duration + func NewTool(cfg ToolConfig) *Tool + func (t *Tool) AsJson() map[string]any + type ToolCall = streaming.ToolCall + type ToolCallFunc func(ctx context.Context, inv ToolInvocation) (string, error) + type ToolConfig struct + Access mapset.Set[ToolPermission] + Category streaming.ToolCategory + Description string + DisplayName string + Handler any + Name string + Namespace string + PermissionRequired bool + Timeout time.Duration + type ToolHandlerFunc func(ctx context.Context, args map[string]any, runtime HarnessRuntime) (string, error) + type ToolInterceptor func(ctx context.Context, inv ToolInvocation, next ToolCallFunc) (string, error) + type ToolInvocation struct + ArgsJSON string + Runtime HarnessRuntime + Tool *Tool + type ToolNamespace struct + Description string + Name string + type ToolPermission int + const ExecutePermission + const ReadPermission + const WritePermission + type ToolPermissionInterrupt = interrupt.ToolPermissionInterrupt + type ToolResultDisposition struct + Effect ToolResultEffect + SuppressWindowMessage bool + type ToolResultEffect int + const EffectHandoff + const EffectInstallPlanDocument + const EffectNone + type ToolResultHook func(ctx context.Context, obs ToolResultObservation) ToolResultDisposition + type ToolResultObservation struct + ArgsJSON string + Name string + Output string + Runtime HarnessRuntime + type URLAnnotation = streaming.URLAnnotation + type UserChoice = interrupt.UserChoice + type UserSelectionInterrupt = interrupt.UserSelectionInterrupt