Versions in this module Expand all Collapse all v0 v0.8.0 Jul 28, 2026 Changes in this version + const DefaultSystemMsg + const DefaultToolsMsg + func BuildSystemMessage(ctx context.Context, toolreg *tools.Registry, sysPrompt, toolsPrompt string) (llm.Message, []llm.ToolDefinition) + func ConvertMCPToolsToLLMTools(tools []mcps.ToolDescriptor) []llm.ToolDefinition + func StreamChat(ctx context.Context, loop *AgentLoop, messages []llm.Message, ...) (string, error) + func ThisMoment() string + type AgentLoop struct + func NewAgentLoop(cfg AgentLoopConfig, opts ...AgentLoopOption) *AgentLoop + func (al *AgentLoop) Run(ctx context.Context, messages []llm.Message, tools []llm.ToolDefinition) iter.Seq2[*llm.Event, error] + func (al *AgentLoop) RunNonStreaming(ctx context.Context, messages []llm.Message, tools []llm.ToolDefinition) (string, error) + type AgentLoopConfig struct + LLM llm.Client + MaxLoop int + ToolExec *ToolExecutor + type AgentLoopOption func(*AgentLoopConfig) + func WithMaxLoop(n int) AgentLoopOption + type ChatExecutor func(ctx context.Context, messages []llm.Message, tools []llm.ToolDefinition) (string, []llm.ToolCall, *llm.Usage, error) + type StreamCallbacks struct + OnDelta func(delta string) + OnThink func(think string) + type ToolExecutor struct + AfterToolCall func(ctx context.Context, name string, result map[string]any) map[string]any + BeforeToolCall func(ctx context.Context, name string, params map[string]any) (block bool, reason string) + func NewToolExecutor(toolreg *tools.Registry) *ToolExecutor + func (e *ToolExecutor) ExecuteToolCallLoop(ctx context.Context, messages []llm.Message, tools []llm.ToolDefinition, ...) (string, []llm.ToolCall, *llm.Usage, error) + func (e *ToolExecutor) ExecuteToolCalls(ctx context.Context, messages []llm.Message, toolCalls []llm.ToolCall, ...) ([]*llm.Event, []llm.Message, bool)