Versions in this module Expand all Collapse all v1 v1.2.0 Jun 24, 2026 Changes in this version + const END + var DefaultPricing = map[string]ModelPricing + type AgentOptions struct + Budget *CostBudget + CheckpointStore CheckpointStore + Clearance *Clearance + ConversationID string + DeferredTools []Tool + HumanGate HumanGate + Instructions string + Knowledge Knowledge + KnowledgeCandidateK int + KnowledgeTopK int + MaxContextTokens int + MaxIterations int + MaxRetries int + MaxTokens int + Memory Memory + MemoryTopK int + Model string + ParallelToolCalls bool + Pricing map[string]ModelPricing + RequiresApproval func(name string, args map[string]any) bool + Reranker Reranker + RetryBackoff time.Duration + Temperature float64 + Tools []Tool + type AgentRunResponse struct + BudgetExceeded bool + CostUSD float64 + Iterations int + Text string + ToolCalls int + Usage Usage + type Cast struct + func NewCast() *Cast + func (c *Cast) Count() int + func (c *Cast) Get(name string) (OperatorRole, bool) + func (c *Cast) IsEmpty() bool + func (c *Cast) List() []OperatorRole + func (c *Cast) ListVisible() []OperatorRole + func (c *Cast) Register(role OperatorRole) *Cast + func (c *Cast) Sidekicks() []OperatorRole + type ChatChunk struct + ContentDelta string + ToolCallDeltas []ToolCallDelta + Usage *Usage + type ChatClient interface + Chat func(ctx context.Context, req ChatRequest) (ChatResponse, error) + type ChatMessage struct + Content string + Role string + ToolCallID string + ToolCalls []ToolCall + type ChatRequest struct + MaxTokens int + Messages []ChatMessage + Model string + Temperature float64 + Tools []ToolSpec + type ChatResponse struct + Content string + ToolCalls []ToolCall + Usage Usage + func TextResponse(content string) ChatResponse + func ToolCallResponse(id, name, arguments string) ChatResponse + func WithUsage(resp ChatResponse, promptTokens, completionTokens int) ChatResponse + type Checkpoint struct + ConversationID string + Messages []ChatMessage + type CheckpointStore interface + Load func(conversationID string) (Checkpoint, bool) + Save func(cp Checkpoint) + type Clearance struct + func AllowAllClearance() Clearance + func AllowClearance(tools ...string) Clearance + func DenyAllClearance() Clearance + func DenyClearance(tools ...string) Clearance + func NewClearance(allow, deny []string, denyEverything bool) Clearance + func (c Clearance) IsAllowed(tool string) bool + type CostBudget struct + MaxTokens int + MaxUSD float64 + type CostTracker struct + CostUSD float64 + Usage Usage + func (t *CostTracker) Exceeds(b *CostBudget) bool + func (t *CostTracker) Record(model string, u Usage, pricing map[string]ModelPricing) + type Embedder interface + Embed func(text string) []float64 + type FuncTool struct + Desc string + Fn func(ctx context.Context, args map[string]any) (string, error) + Params map[string]any + ToolName string + func (t FuncTool) Description() string + func (t FuncTool) Execute(ctx context.Context, args map[string]any) (string, error) + func (t FuncTool) Name() string + func (t FuncTool) Parameters() map[string]any + type GatewayClient struct + APIKey string + BaseURL string + HTTPClient *http.Client + func NewGatewayClient(baseURL, apiKey string) *GatewayClient + func (g *GatewayClient) Chat(ctx context.Context, req ChatRequest) (ChatResponse, error) + func (g *GatewayClient) ChatStream(ctx context.Context, req ChatRequest) (<-chan ChatChunk, error) + type HashEmbedder struct + Dim int + func NewHashEmbedder(dim int) HashEmbedder + func (e HashEmbedder) Embed(text string) []float64 + type HumanApprovalRequest struct + Arguments map[string]any + Prompt string + ToolName string + type HumanApprovalResponse struct + Decision HumanDecision + Reason string + func Approve() HumanApprovalResponse + func Deny(reason string) HumanApprovalResponse + func (r HumanApprovalResponse) IsApproved() bool + type HumanDecision int + const HumanApproved + const HumanDenied + type HumanGate func(ctx context.Context, request HumanApprovalRequest) (HumanApprovalResponse, error) + type InMemoryCheckpointStore struct + func NewInMemoryCheckpointStore() *InMemoryCheckpointStore + func (s *InMemoryCheckpointStore) Load(conversationID string) (Checkpoint, bool) + func (s *InMemoryCheckpointStore) Save(cp Checkpoint) + type InMemoryKnowledge struct + func (k *InMemoryKnowledge) Ingest(content, source string) + func (k *InMemoryKnowledge) Query(query string, topK int) []KnowledgeHit + type InMemoryMemory struct + func (m *InMemoryMemory) Recall(query string, topK int) []MemoryEntry + func (m *InMemoryMemory) Remember(text string) + type Knowledge interface + Query func(query string, topK int) []KnowledgeHit + type KnowledgeHit struct + Content string + Score float64 + Source string + type LexicalReranker struct + func (LexicalReranker) Rerank(query string, hits []KnowledgeHit) []KnowledgeHit + type LlmProvider = ChatClient + type Memory interface + Recall func(query string, topK int) []MemoryEntry + Remember func(text string) + type MemoryEntry struct + Text string + type MockLlmProvider struct + func NewMockLlmProvider() *MockLlmProvider + func (m *MockLlmProvider) CallCount() int + func (m *MockLlmProvider) Calls() []ChatRequest + func (m *MockLlmProvider) Chat(_ context.Context, req ChatRequest) (ChatResponse, error) + func (m *MockLlmProvider) ChatStream(_ context.Context, req ChatRequest) (<-chan ChatChunk, error) + func (m *MockLlmProvider) LastCall() (ChatRequest, bool) + func (m *MockLlmProvider) PushError(message string) *MockLlmProvider + func (m *MockLlmProvider) PushResponse(resp ChatResponse) *MockLlmProvider + func (m *MockLlmProvider) PushText(content string) *MockLlmProvider + func (m *MockLlmProvider) PushToolCall(id, name, arguments string) *MockLlmProvider + type ModelPricing struct + InputPerMTok float64 + OutputPerMTok float64 + func (p ModelPricing) Cost(u Usage) float64 + type NodeFn func(ctx context.Context, state S) (S, error) + type NoopReranker struct + func (NoopReranker) Rerank(_ string, hits []KnowledgeHit) []KnowledgeHit + type OperatorRole struct + Hidden bool + Instructions string + Kind RoleKind + MaxIterations int + Name string + Permissions Clearance + func NewOperatorRole(name string, kind RoleKind, instructions string) OperatorRole + type Reranker interface + Rerank func(query string, hits []KnowledgeHit) []KnowledgeHit + type RoleKind int + const RoleLead + const RoleShadow + const RoleSidekick + type Router func(state S) string + type SmoothAgent struct + func NewSmoothAgent(client ChatClient, options AgentOptions) *SmoothAgent + func (a *SmoothAgent) Run(ctx context.Context, message string, history []ChatMessage) (AgentRunResponse, error) + func (a *SmoothAgent) RunStream(ctx context.Context, message string, thread *SmoothAgentThread) (*Stream, error) + func (a *SmoothAgent) RunThread(ctx context.Context, message string, thread *SmoothAgentThread) (AgentRunResponse, error) + type SmoothAgentThread struct + ID string + func NewThread() *SmoothAgentThread + func NewThreadWithID(id string) *SmoothAgentThread + func (t *SmoothAgentThread) Add(m ChatMessage) + func (t *SmoothAgentThread) Extend(msgs []ChatMessage) + func (t *SmoothAgentThread) Len() int + func (t *SmoothAgentThread) Messages() []ChatMessage + type Stream struct + func (s *Stream) Err() error + func (s *Stream) Events() <-chan StreamEvent + type StreamEvent struct + Arguments string + Kind StreamEventKind + Name string + Response AgentRunResponse + Result string + Text string + type StreamEventKind int + const StreamDone + const StreamText + const StreamToolCall + const StreamToolResult + type StreamingChatClient interface + ChatStream func(ctx context.Context, req ChatRequest) (<-chan ChatChunk, error) + type Tool interface + Description func() string + Execute func(ctx context.Context, args map[string]any) (string, error) + Name func() string + Parameters func() map[string]any + func DelegateTool(name, description string, child *SmoothAgent) Tool + type ToolCall struct + Arguments string + ID string + Name string + type ToolCallDelta struct + ArgsFragment string + ID string + Index int + Name string + type ToolSearch struct + func NewToolSearch(deferred []Tool) *ToolSearch + func (s *ToolSearch) Description() string + func (s *ToolSearch) Execute(_ context.Context, args map[string]any) (string, error) + func (s *ToolSearch) HasDeferred() bool + func (s *ToolSearch) IsPromoted(name string) bool + func (s *ToolSearch) Name() string + func (s *ToolSearch) Parameters() map[string]any + func (s *ToolSearch) Promote(name string) bool + func (s *ToolSearch) PromotedTools() []Tool + func (s *ToolSearch) ToolByName(name string) (Tool, bool) + type ToolSpec struct + Description string + Name string + Parameters map[string]any + type Usage struct + CompletionTokens int + PromptTokens int + func (u Usage) TotalTokens() int + type VectorKnowledge struct + func NewVectorKnowledge(embedder Embedder) *VectorKnowledge + func (v *VectorKnowledge) Ingest(content, source string) + func (v *VectorKnowledge) Query(query string, topK int) []KnowledgeHit + type Workflow struct + func NewWorkflow[S any](maxSteps int) *Workflow[S] + func (w *Workflow[S]) AddConditionalEdge(from string, router Router[S]) *Workflow[S] + func (w *Workflow[S]) AddEdge(from, to string) *Workflow[S] + func (w *Workflow[S]) AddNode(name string, fn NodeFn[S]) *Workflow[S] + func (w *Workflow[S]) Run(ctx context.Context, initialState S) (S, error) + func (w *Workflow[S]) SetEnd(from string) *Workflow[S] + func (w *Workflow[S]) SetEntry(name string) *Workflow[S]