Versions in this module Expand all Collapse all v0 v0.1.4 Oct 17, 2026 v0.1.3 Oct 9, 2026 v0.1.2 Oct 9, 2026 v0.1.1 Oct 9, 2026 v0.1.0 Oct 8, 2026 Changes in this version + const Null + const Undefined + func MessagePointers(messages []ai.Message) []*ai.Message + func MessageValues(messages []*ai.Message) []ai.Message + func SetDefaultStreamFn(stream StreamFn) + func StreamProxy(ctx context.Context, model json.RawMessage, transcript ai.TranscriptContext, ...) *ai.AssistantMessageEventStream + type AdmitRequestFn func(context.Context, Request, map[string]any) (*RequestAdmission, error) + type AfterToolCall struct + IsError bool + Result *ToolResult + type AfterToolResult = ToolResult + type Agent struct + func NewAgent(options AgentOptions) (*Agent, error) + func (a *Agent) Abort() + func (a *Agent) ClearAllQueues() + func (a *Agent) ClearFollowUpQueue() + func (a *Agent) ClearSteeringQueue() + func (a *Agent) Configure(options AgentConfig) error + func (a *Agent) Continue(ctx context.Context) error + func (a *Agent) FollowUp(message *ai.Message) + func (a *Agent) FollowUpMode() string + func (a *Agent) HasQueuedMessages() bool + func (a *Agent) PeekQueuedMessages() []*ai.Message + func (a *Agent) Prompt(ctx context.Context, input any, images ...*ai.ContentBlock) error + func (a *Agent) Reset() error + func (a *Agent) SetFollowUpMode(mode string) + func (a *Agent) SetMessageList(messages *MessageList) + func (a *Agent) SetMessages(messages []*ai.Message) + func (a *Agent) SetModel(model json.RawMessage) + func (a *Agent) SetSteeringMode(mode string) + func (a *Agent) SetThinkingLevel(level string) + func (a *Agent) SetToolList(tools *ToolList) + func (a *Agent) SetTools(tools []*Tool) + func (a *Agent) Signal() context.Context + func (a *Agent) State() State + func (a *Agent) Steer(message *ai.Message) + func (a *Agent) SteeringMode() string + func (a *Agent) Subscribe(listener *Listener) func() + func (a *Agent) WaitForIdle(ctx context.Context) error + type AgentConfig struct + FollowUpMode string + MaxRetryDelayMS *int + PrepareNextTurn func(context.Context) (*TurnUpdate, error) + PrepareNextTurnWithContext func(context.Context, *Turn) (*TurnUpdate, error) + SessionID *string + SteeringMode string + StreamFn StreamFn + ThinkingBudgets json.RawMessage + Transport string + type AgentEventStream struct + func AgentLoop(ctx context.Context, prompts *MessageList, initial Context, config Config, ...) *AgentEventStream + func AgentLoopContinue(ctx context.Context, initial Context, config Config, provider StreamFn) (*AgentEventStream, error) + func (s *AgentEventStream) Wait(ctx context.Context) error + type AgentOptions struct + InitialState InitialState + type Array = jsonjs.Array + func NewArray(values ...any) *Array + type BeforeToolCall struct + Args any + AssistantMessage *ai.Message + Context *Context + ToolCall *ai.ContentBlock + type BeforeToolResult struct + Block bool + Reason string + Terminate bool + type Config struct + AdmitRequest AdmitRequestFn + ConvertToLLM func(*MessageList) (*MessageList, error) + FinishTurn func(context.Context, *Turn) (string, error) + GetAPIKey func(string) (string, error) + GetFollowUpMessages func() (*MessageList, error) + GetSteeringMessages func() (*MessageList, error) + Model json.RawMessage + Now func() int64 + Options map[string]any + PrepareNextTurn func(*Turn) (*TurnUpdate, error) + PrepareRequest func(context.Context, Request) (*TurnUpdate, error) + Reasoning string + ToolExecution string + TransformContext func(context.Context, *MessageList) (*MessageList, error) + type Context struct + Messages *MessageList + Tools *ToolList + type Event struct + Args json.RawMessage + AssistantMessageEvent *ai.AssistantMessageEvent + IsError bool + Message *ai.Message + Messages *MessageList + PartialResult *ToolResult + Result *ToolResult + ToolCallID string + ToolName string + ToolResults *MessageList + Type string + func (e Event) Await(work func() error) error + func (e Event) MarshalJSON() ([]byte, error) + func (e Event) Synchronize(read func()) + type EventSink func(Event) error + type InitialState struct + Messages []*ai.Message + Model json.RawMessage + SystemPrompt string + ThinkingLevel string + Tools []*Tool + type JSONMethod = jsonjs.JSONMethod + type List struct + func NewList[T any](values ...T) *List[T] + func (l *List[T]) Append(values ...T) int + func (l *List[T]) Clone() *List[T] + func (l *List[T]) Delete(index int) + func (l *List[T]) DeleteProperty(name string) + func (l *List[T]) Get(index int) T + func (l *List[T]) GetProperty(name string) (T, bool) + func (l *List[T]) Has(index int) bool + func (l *List[T]) Keys() []int + func (l *List[T]) Len() int + func (l *List[T]) MarshalJSON() ([]byte, error) + func (l *List[T]) PropertyKeys() []string + func (l *List[T]) Set(index int, value T) + func (l *List[T]) SetLength(length int) + func (l *List[T]) SetProperty(name string, value T) + func (l *List[T]) UnmarshalJSON(raw []byte) error + func (l *List[T]) Values() []T + type Listener struct + Handle func(context.Context, Event) error + type MessageList = List[*ai.Message] + func Continue(ctx context.Context, initial Context, config Config, emit EventSink, ...) (*MessageList, error) + func Run(ctx context.Context, prompts *MessageList, initial Context, config Config, ...) (*MessageList, error) + type Object = jsonjs.Object + func NewObject(properties ...Property) *Object + type Property = jsonjs.Property + type ProxyStreamOptions struct + AuthToken string + Client *http.Client + Now func() int64 + Options map[string]any + ProxyURL string + type Request struct + Context *Context + Model json.RawMessage + ThinkingLevel string + type RequestAdmission struct + Request Request + Stream *ai.AssistantMessageEventStream + type State struct + ErrorMessage *string + IsStreaming bool + Messages *MessageList + Model json.RawMessage + PendingToolCalls *ToolCallSet + StreamingMessage *ai.Message + ThinkingLevel string + Tools *ToolList + func (s State) MarshalJSON() ([]byte, error) + func (s State) SystemPrompt() string + type StreamFn = ai.StreamFn + func GetDefaultStreamFn() (StreamFn, error) + type Tool struct + Execute func(context.Context, string, any, func(*ToolResult)) (*ToolResult, error) + ExecutionMode string + Label string + OutputSchema json.RawMessage + PrepareArguments func(json.RawMessage) (json.RawMessage, error) + Replay string + func (t Tool) MarshalJSON() ([]byte, error) + type ToolCallSet struct + func (s *ToolCallSet) Has(id string) bool + func (s *ToolCallSet) Len() int + func (s *ToolCallSet) MarshalJSON() ([]byte, error) + func (s *ToolCallSet) Values() []string + type ToolHooks struct + After func(context.Context, AfterToolCall) (*AfterToolResult, error) + Before func(context.Context, *BeforeToolCall) (*BeforeToolResult, error) + type ToolList = List[*Tool] + type ToolOutcome struct + IsError bool + Result *ToolResult + ToolCall *ai.ContentBlock + func RunToolCall(ctx context.Context, call *ai.ContentBlock, tools *ToolList, ...) (ToolOutcome, error) + type ToolResult struct + Content *ai.BlockList + Details any + IsError *bool + StructuredContent any + Terminate *bool + Usage *ai.Usage + func (r *ToolResult) UnmarshalJSON(raw []byte) error + func (r ToolResult) MarshalJSON() ([]byte, error) + type Turn struct + Context *Context + Message *ai.Message + NewMessages *MessageList + ToolResults *MessageList + type TurnUpdate struct + Context *Context + Messages *MessageList + Model json.RawMessage + ThinkingLevel *string