Versions in this module Expand all Collapse all v0 v0.2.2 Apr 8, 2026 v0.2.1 Apr 7, 2026 v0.2.0 Apr 7, 2026 Changes in this version + type NoDeps = core.NoDeps v0.1.0 Mar 27, 2026 Changes in this version + const ContentAudioURL + const ContentCachePoint + const ContentDocumentURL + const ContentImageData + const ContentImageURL + const ContentText + const ContentThinking + const ContentToolResult + const ContentToolUse + const ContentUploadedFile + const ContentVideoURL + const DefaultPromptedTemplate + const DeferredApproved + const DeferredPending + const DeferredRejected + const DeferredTimedOut + const FinishReasonContentFilter + const FinishReasonLength + const FinishReasonStop + const FinishReasonToolCalls + const OutputModeNative + const OutputModePrompted + const OutputModeText + const OutputModeTool + const RoleAssistant + const RoleSystem + const RoleTool + const RoleUser + const StreamEventDone + const StreamEventError + const StreamEventTextDelta + const StreamEventThinkingDelta + const StreamEventToolCallDelta + const StreamEventToolCallStart + const StreamEventToolResult + const ToolChoiceAuto + const ToolChoiceNone + const ToolChoiceRequired + const ToolTypeFunction + func AutoToolWithDeps[TInput any, TOutput any, DepsT any](handler func(ctx RunContext[DepsT], input TInput) (TOutput, error), ...) (Tool, ToolHandler, error) + func AutoTool[TInput any, TOutput any](handler func(input TInput) (TOutput, error), opts ...AutoToolOption) (Tool, ToolHandler, error) + func DeferredToolWithApproval[TInput any, TOutput any](name, description string, ...) (Tool, ToolHandler, error) + func DeferredTool[TInput any, TOutput any](name, description string, ...) (Tool, ToolHandler, error) + func FormatToolResult(result interface{}) string + func IntPtr(v int) *int + func IsModelRetry(err error) bool + func IsUsageLimitExceeded(err error) bool + func IsValidationError(err error) bool + func MustAutoToolWithDeps[TInput any, TOutput any, DepsT any](handler func(ctx RunContext[DepsT], input TInput) (TOutput, error), ...) (Tool, ToolHandler) + func MustAutoTool[TInput any, TOutput any](handler func(input TInput) (TOutput, error), opts ...AutoToolOption) (Tool, ToolHandler) + func MustDeferredToolWithApproval[TInput any, TOutput any](name, description string, ...) (Tool, ToolHandler) + func MustDeferredTool[TInput any, TOutput any](name, description string, ...) (Tool, ToolHandler) + func MustToolPlain[TInput any, TOutput any](name, description string, handler func(input TInput) (TOutput, error), ...) (Tool, ToolHandler) + func MustToolWithDeps[TInput any, TOutput any, DepsT any](name, description string, ...) (Tool, ToolHandler) + func RegisterToolset(registry ToolRegistry, set Toolset) error + func ToolPlain[TInput any, TOutput any](name, description string, handler func(input TInput) (TOutput, error), ...) (Tool, ToolHandler, error) + func ToolWithDeps[TInput any, TOutput any, DepsT any](name, description string, ...) (Tool, ToolHandler, error) + func ValidateStruct(v any) error + type Agent struct + func AddToolWithDeps[DepsT any, TInput any, TOutput any](agent *Agent[DepsT], ...) *Agent[DepsT] + func AddTool[DepsT any, TInput any, TOutput any](agent *Agent[DepsT], handler func(input TInput) (TOutput, error), ...) *Agent[DepsT] + func NewAgentDynamic[DepsT any](promptFn func(ctx RunContext[DepsT]) (string, error), model Model, ...) *Agent[DepsT] + func NewAgent[DepsT any](systemPrompt string, model Model, opts ...AgentOption[DepsT]) *Agent[DepsT] + func (a *Agent[DepsT]) AddAutoTool(tool Tool, handler ToolHandler) *Agent[DepsT] + func (a *Agent[DepsT]) AddHandoff(h *Handoff[DepsT]) *Agent[DepsT] + func (a *Agent[DepsT]) AddTool(tool Tool, handler ToolHandler) *Agent[DepsT] + func (a *Agent[DepsT]) AddToolset(set Toolset) *Agent[DepsT] + func (a *Agent[DepsT]) Run(ctx context.Context, prompt string, deps *DepsT, opts ...RunOption) (*RunResult, error) + func (a *Agent[DepsT]) RunStream(ctx context.Context, prompt string, deps *DepsT, opts ...RunOption) (*StreamResult, error) + func (a *Agent[DepsT]) SetOutputToolNames(names map[string]bool) *Agent[DepsT] + func (a *Agent[DepsT]) SetRegistry(registry ToolRegistry) *Agent[DepsT] + type AgentOption func(*agentConfig[DepsT]) + func WithEndStrategy[DepsT any](strategy EndStrategy) AgentOption[DepsT] + func WithHandoffs[DepsT any](handoffs ...*Handoff[DepsT]) AgentOption[DepsT] + func WithHistoryProcessor[DepsT any](p HistoryProcessor) AgentOption[DepsT] + func WithMaxIterations[DepsT any](maxIter int) AgentOption[DepsT] + func WithMaxTokens[DepsT any](maxTokens int) AgentOption[DepsT] + func WithMaxValidationRetries[DepsT any](n int) AgentOption[DepsT] + func WithOutputValidatorFunc[DepsT any](fn func(ctx RunContext[DepsT], output string) error) AgentOption[DepsT] + func WithOutputValidator[DepsT any](v OutputValidator[DepsT]) AgentOption[DepsT] + func WithRetries[DepsT any](config RetryConfig) AgentOption[DepsT] + func WithSystemPrompts[DepsT any](prompts ...SystemPrompt[DepsT]) AgentOption[DepsT] + func WithTemperature[DepsT any](temp float64) AgentOption[DepsT] + func WithThinking[DepsT any](config ThinkingConfig) AgentOption[DepsT] + func WithToolChoice[DepsT any](choice ToolChoice) AgentOption[DepsT] + func WithToolPrepare[DepsT any](fn ToolPrepareFunc[DepsT]) AgentOption[DepsT] + func WithTopP[DepsT any](topP float64) AgentOption[DepsT] + func WithUsageLimits[DepsT any](limits UsageLimits) AgentOption[DepsT] + type ApprovalFunc = agentictool.ApprovalFunc + type AudioURL = core.AudioURL + type AutoToolOption = agentictool.AutoToolOption + func AutoToolDescription(desc string) AutoToolOption + func AutoToolName(name string) AutoToolOption + type CachePoint = core.CachePoint + type ChatRequest = core.ChatRequest + type ChatResponse = core.ChatResponse + type Choice = core.Choice + type ContentType = core.ContentType + type DeferredStatus = agentictool.DeferredStatus + type DeferredToolOption = agentictool.DeferredToolOption + func WithApproval(fn ApprovalFunc) DeferredToolOption + func WithDeferredTimeout(d time.Duration) DeferredToolOption + type DeferredToolResult = agentictool.DeferredToolResult + type DepsToolHandler = agentictool.DepsToolHandler[TInput, TOutput, DepsT] + type DocumentURL = core.DocumentURL + type EndStrategy int + const EndStrategyEarly + const EndStrategyExhaustive + type FinishReason = core.FinishReason + type FuncToolset = agentictool.FuncToolset + func NewToolset() *FuncToolset + type Function = core.Function + type Handoff struct + func NewHandoff[DepsT any](name, description string, agent *Agent[DepsT], opts ...HandoffOption) *Handoff[DepsT] + type HandoffInputFilter int + const HandoffFullHistory + const HandoffLastMessage + const HandoffSummary + type HandoffOption func(*handoffConfig) + func WithHandoffFilter(filter HandoffInputFilter) HandoffOption + func WithHandoffMaxTokens(n int) HandoffOption + func WithHandoffSystemPrompt(prompt string) HandoffOption + type HistoryProcessor interface + Process func(ctx context.Context, messages []Message) ([]Message, error) + func ChainProcessors(processors ...HistoryProcessor) HistoryProcessor + func SlidingWindowHistory(maxTokens int, tokenCounter func(Message) int) HistoryProcessor + func SummarizeHistory(model Model, maxMessages int) HistoryProcessor + func TruncateHistory(maxMessages int) HistoryProcessor + type HistoryProcessorFunc func(ctx context.Context, messages []Message) ([]Message, error) + func (f HistoryProcessorFunc) Process(ctx context.Context, messages []Message) ([]Message, error) + type ImageData = core.ImageData + type ImageURL = core.ImageURL + type JSONSchemaFormat = core.JSONSchemaFormat + type MaxIterationsError struct + MaxIterations int + func (e *MaxIterationsError) Error() string + type Message = core.Message + func NewImageDataMessage(text string, data []byte, mediaType string) Message + func NewImageFileMessage(text string, filePath string) (Message, error) + func NewImageURLMessage(text string, imageURL string, detail ...string) Message + func NewMultiPartMessage(parts ...Part) Message + func NewTextMessage(role MessageRole, text string) Message + func NewToolResultMessage(toolUseID string, content string, isError bool) Message + func NewToolUseMessage(toolUses ...ToolUse) Message + type MessageHistory struct + Messages []Message + func LoadHistory(data []byte) (*MessageHistory, error) + func NewHistory(messages ...Message) *MessageHistory + func (h *MessageHistory) SaveJSON() ([]byte, error) + func (h *MessageHistory) ToRunOption() RunOption + type MessageRole = core.MessageRole + type Model = core.Model + type ModelRetry struct + Message string + func Retry(msg string) *ModelRetry + func Retryf(format string, args ...interface{}) *ModelRetry + func (e *ModelRetry) Error() string + type NativeOutputSpec struct + func NewNativeOutput[T any](name, description string) *NativeOutputSpec[T] + func (s *NativeOutputSpec[T]) Mode() OutputMode + func (s *NativeOutputSpec[T]) Parse(msg Message) (any, error) + func (s *NativeOutputSpec[T]) ResponseFormat() *ResponseFormat + func (s *NativeOutputSpec[T]) Tools() []Tool + func (s *NativeOutputSpec[T]) WithStrict(strict bool) *NativeOutputSpec[T] + type OutputMode = core.OutputMode + type OutputModeSpec interface + Mode func() OutputMode + type OutputSpec interface + Parse func(msg Message) (any, error) + Tools func() []Tool + type OutputValidator interface + Validate func(ctx RunContext[DepsT], output string) error + type OutputValidatorFunc func(ctx RunContext[DepsT], output string) error + func (f OutputValidatorFunc[DepsT]) Validate(ctx RunContext[DepsT], output string) error + type Part = core.Part + func AudioURLPart(url string, format ...string) Part + func CachePointPart(ttl ...string) Part + func DocumentURLPart(url string, mediaType ...string) Part + func ImageDataPart(data []byte, mediaType string) Part + func ImageURLPart(url string, detail ...string) Part + func TextPart(text string) Part + func UploadedFilePart(fileID string, providerName string) Part + func VideoURLPart(url string) Part + type PlainToolHandler = agentictool.PlainToolHandler[TInput, TOutput] + type PromptedOutputSpec struct + func NewPromptedOutput[T any]() *PromptedOutputSpec[T] + func (s *PromptedOutputSpec[T]) Mode() OutputMode + func (s *PromptedOutputSpec[T]) Parse(msg Message) (any, error) + func (s *PromptedOutputSpec[T]) ResponseFormat() *ResponseFormat + func (s *PromptedOutputSpec[T]) SystemPromptSuffix() string + func (s *PromptedOutputSpec[T]) Tools() []Tool + func (s *PromptedOutputSpec[T]) WithTemplate(template string) *PromptedOutputSpec[T] + type RequestUsage = core.RequestUsage + type ResponseFormat = core.ResponseFormat + type ResponseFormatSpec interface + ResponseFormat func() *ResponseFormat + type RetryConfig struct + MaxRetries int + type RunContext = core.RunContext[DepsT] + type RunOption func(*runOptions) + func WithMessages(messages ...Message) RunOption + func WithRunEndStrategy(strategy EndStrategy) RunOption + func WithRunHistoryProcessor(p HistoryProcessor) RunOption + func WithRunMaxIterations(maxIter int) RunOption + func WithRunMaxTokens(maxTokens int) RunOption + func WithRunTemperature(temp float64) RunOption + func WithRunToolChoice(choice ToolChoice) RunOption + func WithRunUsageLimits(limits UsageLimits) RunOption + type RunResult struct + FinishReason FinishReason + Messages []Message + Output string + Retries int + ToolCalls []ToolUse + ToolResults []ToolExecutionResult + Usage Usage + func (r *RunResult) AllMessages() []Message + func (r *RunResult) History() *MessageHistory + func (r *RunResult) NewMessages() []Message + type StreamEvent = core.StreamEvent + type StreamEventType = core.StreamEventType + type StreamModel = core.StreamModel + type StreamResult = core.StreamResult + func NewStreamResult(ch <-chan StreamEvent) *StreamResult + type SystemPrompt struct + func DynamicPrompt[DepsT any](fn func(ctx RunContext[DepsT]) (string, error)) SystemPrompt[DepsT] + func StaticPrompt[DepsT any](text string) SystemPrompt[DepsT] + func (sp SystemPrompt[DepsT]) Resolve(ctx RunContext[DepsT]) (string, error) + type SystemPromptAppender interface + SystemPromptSuffix func() string + type TextOutputSpec struct + func (s *TextOutputSpec) Parse(msg Message) (any, error) + func (s *TextOutputSpec) Tools() []Tool + type TextProcessorOutputSpec struct + func NewTextProcessorOutput[T any](processor func(string) (T, error)) *TextProcessorOutputSpec[T] + func (s *TextProcessorOutputSpec[T]) Mode() OutputMode + func (s *TextProcessorOutputSpec[T]) Parse(msg Message) (any, error) + func (s *TextProcessorOutputSpec[T]) Tools() []Tool + type ThinkingBlock = core.ThinkingBlock + type ThinkingConfig = core.ThinkingConfig + type Tool = core.Tool + func MustNewToolFromStruct(name, description string, input interface{}) Tool + func NewToolFromStruct(name, description string, input interface{}) (Tool, error) + type ToolChoice = core.ToolChoice + type ToolConfig = core.ToolConfig + type ToolExecutionResult = core.ToolExecutionResult + type ToolHandler = core.ToolHandler + type ToolOption = agentictool.ToolOption + func WithToolMaxRetries(n int) ToolOption + type ToolOutputSpec struct + func NewToolOutput[T any](description string) *ToolOutputSpec[T] + func (s *ToolOutputSpec[T]) Parse(msg Message) (any, error) + func (s *ToolOutputSpec[T]) Tools() []Tool + type ToolPrepareFunc func(ctx RunContext[DepsT], tools []Tool) ([]Tool, error) + type ToolRegistry = agentictool.ToolRegistry + func NewRegistry() ToolRegistry + type ToolResult = core.ToolResult + type ToolType = core.ToolType + type ToolUse = core.ToolUse + type Toolset = agentictool.Toolset + func CombineToolsets(sets ...Toolset) Toolset + func FilterToolset(set Toolset, predicate func(toolName string) bool) Toolset + func PrefixToolset(set Toolset, prefix string) Toolset + type TypedAgent struct + func AddToolToTyped[DepsT any, OutputT any, TInput any, TOutput any](agent *TypedAgent[DepsT, OutputT], handler func(input TInput) (TOutput, error), ...) *TypedAgent[DepsT, OutputT] + func NewTypedAgentDynamic[DepsT any, OutputT any](promptFn func(ctx RunContext[DepsT]) (string, error), model Model, ...) *TypedAgent[DepsT, OutputT] + func NewTypedAgentWithMode[DepsT any, OutputT any](systemPrompt string, model Model, outputSpec OutputSpec, ...) *TypedAgent[DepsT, OutputT] + func NewTypedAgent[DepsT any, OutputT any](systemPrompt string, model Model, outputDescription string, ...) *TypedAgent[DepsT, OutputT] + func (ta *TypedAgent[DepsT, OutputT]) AddAutoTool(tool Tool, handler ToolHandler) *TypedAgent[DepsT, OutputT] + func (ta *TypedAgent[DepsT, OutputT]) AddTool(tool Tool, handler ToolHandler) *TypedAgent[DepsT, OutputT] + func (ta *TypedAgent[DepsT, OutputT]) AddToolset(set Toolset) *TypedAgent[DepsT, OutputT] + func (ta *TypedAgent[DepsT, OutputT]) Run(ctx context.Context, prompt string, deps *DepsT, opts ...RunOption) (*TypedRunResult[OutputT], error) + func (ta *TypedAgent[DepsT, OutputT]) SetRegistry(registry ToolRegistry) *TypedAgent[DepsT, OutputT] + type TypedOutputValidator interface + ValidateTyped func(ctx RunContext[DepsT], output OutputT) error + type TypedOutputValidatorFunc func(ctx RunContext[DepsT], output OutputT) error + func (f TypedOutputValidatorFunc[DepsT, OutputT]) ValidateTyped(ctx RunContext[DepsT], output OutputT) error + type TypedRunResult struct + FinishReason FinishReason + Messages []Message + Output OutputT + Retries int + ToolCalls []ToolUse + ToolResults []ToolExecutionResult + Usage Usage + func RunOutput[DepsT any, OutputT any](ctx context.Context, agent *Agent[DepsT], prompt string, deps *DepsT, ...) (*TypedRunResult[OutputT], error) + type UploadedFile = core.UploadedFile + type Usage = core.Usage + type UsageLimitExceededError struct + Current int + LimitName string + Max int + func (e *UsageLimitExceededError) Error() string + type UsageLimits struct + MaxRequestTokens *int + MaxRequests *int + MaxResponseTokens *int + MaxToolCalls *int + MaxTotalTokens *int + func DefaultUsageLimits() UsageLimits + type ValidationError struct + Message string + func NewValidationError(msg string) *ValidationError + func NewValidationErrorf(format string, args ...interface{}) *ValidationError + func (e *ValidationError) Error() string + type VideoURL = core.VideoURL