Versions in this module Expand all Collapse all v0 v0.9.0 Feb 13, 2026 v0.8.1 Feb 13, 2026 v0.8.0 Feb 13, 2026 Changes in this version + const MaxConcurrentToolExecutions + const MaxDelegationPaths + const MaxFunctionCallsPerResponse + const MaxRecentResults + const MinSamplesForConfidence + const Version + var ErrCircuitOpen = errors.New("circuit breaker is open") + var ToolChainPatterns = map[string]string + var ToolUsageGuides = map[string]ToolUsageGuide + func CalculateBackoff(config RetryConfig, attempt int) time.Duration + func CanTransitionTo(from, to PlanLifecycleState) bool + func CleanupOldCheckpoints(dir string, maxKeep int) error + func CollectText(ctx context.Context, sr *StreamResponse) (string, error) + func DeserializeHistory(serialized []SerializedContent) ([]*genai.Content, error) + func GetBool(args map[string]any, key string) (bool, bool) + func GetBoolDefault(args map[string]any, key string, defaultVal bool) bool + func GetEmptyResultMessage(toolName string) string + func GetInt(args map[string]any, key string) (int, bool) + func GetIntDefault(args map[string]any, key string, defaultVal int) int + func GetString(args map[string]any, key string) (string, bool) + func GetStringDefault(args map[string]any, key, defaultVal string) string + func GetToolResponseHint(toolName string) string + func IsRateLimitError(err error) bool + func IsRetryableError(err error) bool + func IsTerminal(state PlanLifecycleState) bool + func ListCheckpoints(dir string) ([]string, error) + func ParseToolCallsFromText(text string) []*genai.FunctionCall + func RestoreFromAgentCheckpoint(cp *AgentCheckpoint) ([]*genai.Content, error) + func SanitizeFilename(name string) string + func SaveCheckpoint(cp *Checkpoint, path string) error + func SaveState(state *AgentState, path string) error + func ShouldRetry(config RetryConfig, attempt int, err error) bool + func ToolCallFallbackPrompt(toolDeclarations []*genai.FunctionDeclaration) string + type APIError struct + Message string + Provider string + Retryable bool + StatusCode int + func NewAPIError(statusCode int, message, provider string) *APIError + func (e *APIError) Error() string + type ActionType string + const ActionDecompose + const ActionDelegate + const ActionToolCall + const ActionVerify + type Agent struct + func NewAgent(name string, client Client, registry *Registry, opts ...AgentOption) *Agent + func (a *Agent) GetProgress() AgentProgress + func (a *Agent) GetScratchpad() string + func (a *Agent) Run(ctx context.Context, message string) (*AgentResult, error) + func (a *Agent) SetScratchpad(content string) + type AgentCheckpoint struct + AgentState *SerializedAgentState + ID string + PlanState *PlanTree + SharedMemory map[string]*SharedEntry + Timestamp time.Time + TriggerReason string + TurnNumber int + func LoadAgentCheckpoint(path string) (*AgentCheckpoint, error) + func SaveAgentCheckpoint(agentName string, history []*genai.Content, turnCount int, maxTurns int, ...) (*AgentCheckpoint, error) + type AgentConfig struct + MaxTurns int + Memory *SharedMemory + OnText func(text string) + OnToolCall func(name string, args map[string]any) + SystemPrompt string + Timeout time.Duration + type AgentOption func(*Agent) + func WithAgentTimeout(d time.Duration) AgentOption + func WithDelegation(ds *DelegationStrategy, runner *Runner) AgentOption + func WithMaxTurns(n int) AgentOption + func WithMemory(mem *SharedMemory) AgentOption + func WithOnText(fn func(string)) AgentOption + func WithOnToolCall(fn func(string, map[string]any)) AgentOption + func WithPinnedContext(ctx string) AgentOption + func WithPlanApprovalCallback(fn func(string)) AgentOption + func WithPlanner(p *Planner) AgentOption + func WithProgressCallback(fn func(AgentProgress)) AgentOption + func WithReflector(r *Reflector) AgentOption + func WithScratchpad(initial string) AgentOption + func WithSystemPrompt(prompt string) AgentOption + func WithToolTimeout(d time.Duration) AgentOption + type AgentProgress struct + AgentID string + AgentType AgentType + CurrentAction string + CurrentStep int + Elapsed time.Duration + EstimatedRemaining time.Duration + StartTime time.Time + Status AgentStatus + ToolsUsed []string + TotalSteps int + type AgentResult struct + Duration time.Duration + Error error + Text string + Turns int + type AgentState struct + History []SerializedContent + Metadata map[string]any + Model string + Name string + StartTime time.Time + TurnCount int + func LoadState(path string) (*AgentState, error) + type AgentStatus string + const AgentStatusCancelled + const AgentStatusCompleted + const AgentStatusFailed + const AgentStatusPending + const AgentStatusRunning + type AgentTask struct + Background bool + Description string + MaxTurns int + Prompt string + Type AgentType + type AgentType string + const AgentTypeBash + const AgentTypeExplore + const AgentTypeGeneral + const AgentTypePlan + func ParseAgentType(s string) AgentType + func (at AgentType) AllowedTools() []string + func (at AgentType) String() string + type ChangeEvent struct + Type string + Version int64 + type Checkpoint struct + CheckpointID string + Reason string + State *AgentState + Timestamp time.Time + func LoadCheckpoint(path string) (*Checkpoint, error) + type CheckpointConfig struct + Directory string + Enabled bool + Interval int + MaxCheckpoints int + func DefaultCheckpointConfig() CheckpointConfig + type CircuitBreaker struct + func NewCircuitBreaker(threshold int, resetTimeout time.Duration) *CircuitBreaker + func (cb *CircuitBreaker) Execute(ctx context.Context, fn func() error) error + func (cb *CircuitBreaker) Failures() int + func (cb *CircuitBreaker) Reset() + func (cb *CircuitBreaker) State() CircuitState + type CircuitState int + const CircuitClosed + const CircuitHalfOpen + const CircuitOpen + func (s CircuitState) String() string + type Client interface + Clone func() Client + Close func() error + GetModel func() string + SendFunctionResponse func(ctx context.Context, history []*genai.Content, ...) (*StreamResponse, error) + SendMessage func(ctx context.Context, message string) (*StreamResponse, error) + SendMessageWithHistory func(ctx context.Context, history []*genai.Content, message string) (*StreamResponse, error) + SetSystemInstruction func(instruction string) + SetTools func(tools []*genai.Tool) + func NewFallbackClient(clients ...Client) (Client, error) + type ClientPool struct + func NewClientPool(maxSize int) *ClientPool + func (p *ClientPool) Cleanup(maxIdle time.Duration) int + func (p *ClientPool) Close() error + func (p *ClientPool) Get(provider, model string) Client + func (p *ClientPool) Put(provider, model string, client Client) + func (p *ClientPool) Size() int + type ContextSnapshot struct + CreatedAt time.Time + CriticalResults []CriticalResult + Decisions []string + Discoveries []string + ErrorPatterns map[string]string + KeyFiles map[string]string + Requirements []string + Source string + func NewContextSnapshot() *ContextSnapshot + func (cs *ContextSnapshot) AddCriticalResult(toolName, summary, details string) + func (cs *ContextSnapshot) AddDecision(decision string) + func (cs *ContextSnapshot) AddDiscovery(discovery string) + func (cs *ContextSnapshot) AddErrorPattern(pattern, solution string) + func (cs *ContextSnapshot) AddKeyFile(path, summary string) + func (cs *ContextSnapshot) AddRequirement(requirement string) + type CoordinatedTask struct + AgentType AgentType + Dependencies []string + ID string + Priority TaskPriority + Prompt string + Result *AgentResult + Status TaskStatus + type Coordinator struct + func NewCoordinator(runner *Runner, maxParallel int) *Coordinator + func (c *Coordinator) AddTask(id, prompt string, agentType AgentType, priority TaskPriority, deps []string) + func (c *Coordinator) CancelTask(id string) error + func (c *Coordinator) GetStatus() CoordinatorStatus + func (c *Coordinator) GetTask(id string) (*CoordinatedTask, bool) + func (c *Coordinator) RunAll(ctx context.Context) (map[string]*AgentResult, error) + func (c *Coordinator) RunParallel(ctx context.Context, tasks []AgentTask) ([]*AgentResult, error) + func (c *Coordinator) RunSequential(ctx context.Context, tasks []AgentTask) ([]*AgentResult, error) + func (c *Coordinator) SetOnTaskComplete(fn func(taskID string, task *CoordinatedTask)) + func (c *Coordinator) SetOnTaskStart(fn func(taskID string, task *CoordinatedTask)) + type CoordinatorStatus struct + Blocked int + Completed int + Failed int + Pending int + Ready int + Running int + Total int + type CriticalResult struct + Details string + Summary string + ToolName string + type DefaultStatusCallback struct + func (d *DefaultStatusCallback) OnError(err error, recoverable bool) + func (d *DefaultStatusCallback) OnRateLimit(waitTime time.Duration) + func (d *DefaultStatusCallback) OnRetry(attempt, maxAttempts int, delay time.Duration, reason string) + func (d *DefaultStatusCallback) OnStreamIdle(elapsed time.Duration) + func (d *DefaultStatusCallback) OnStreamResume() + type DelegationContext struct + AgentType AgentType + CurrentTurn int + DelegationDepth int + LastToolError string + LastToolName string + StuckCount int + type DelegationDecision struct + Query string + Reason string + ShouldDelegate bool + TargetType AgentType + type DelegationMetrics struct + PathMetrics map[string]*PathStats + RuleWeights map[string]float64 + UpdatedAt time.Time + func NewDelegationMetrics(configDir string) *DelegationMetrics + func (dm *DelegationMetrics) Clear() error + func (dm *DelegationMetrics) GetBestTarget(fromAgent, contextType string, candidates []string) string + func (dm *DelegationMetrics) GetRecentTrend(fromAgent, toAgent, contextType string) float64 + func (dm *DelegationMetrics) GetRuleWeight(fromAgent, toAgent, contextType string) float64 + func (dm *DelegationMetrics) GetStats() map[string]any + func (dm *DelegationMetrics) GetSuccessRate(fromAgent, toAgent, contextType string) float64 + func (dm *DelegationMetrics) RecordExecution(fromAgent, toAgent, contextType string, success bool, duration time.Duration, ...) + func (dm *DelegationMetrics) ShouldUseDelegation(fromAgent, toAgent, contextType string) bool + type DelegationResult struct + Duration time.Duration + ErrorType string + Success bool + Timestamp time.Time + type DelegationRule struct + BuildQuery func(ctx DelegationContext) string + Condition func(ctx DelegationContext) bool + FromType AgentType + Name string + Reason string + TargetType AgentType + type DelegationStrategy struct + func NewDelegationStrategy() *DelegationStrategy + func (ds *DelegationStrategy) AddRule(rule DelegationRule) + func (ds *DelegationStrategy) Evaluate(ctx DelegationContext) DelegationDecision + func (ds *DelegationStrategy) Execute(ctx context.Context, runner *Runner, decision DelegationDecision) (*AgentResult, error) + func (ds *DelegationStrategy) RecordOutcome(fromType, toType AgentType, ruleName string, success bool, ...) + func (ds *DelegationStrategy) SetMetrics(metrics *DelegationMetrics) + type ErrorPattern struct + Alternative string + Category string + Pattern *regexp.Regexp + ShouldRetry bool + ShouldRetryWithFix bool + SuggestedFix string + Suggestion string + type ExecutionStrategy string + const StrategyDirect + const StrategyExecutor + const StrategySingleTool + const StrategySubAgent + type ExecutionSummary struct + Action string + DisplayName string + ExpectedTime time.Duration + RequiresApproval bool + RiskLevel SafetyLevel + Target string + ToolName string + UserVisible bool + type Executor struct + func NewExecutor(registry *Registry, opts ...ExecutorOption) *Executor + func (e *Executor) Execute(ctx context.Context, calls []*genai.FunctionCall) ([]*genai.FunctionResponse, error) + type ExecutorOption func(*Executor) + func WithOnToolEnd(fn func(name string, result *ToolResult)) ExecutorOption + func WithOnToolStart(fn func(name string, args map[string]any)) ExecutorOption + func WithTimeout(d time.Duration) ExecutorOption + type FallbackClient struct + func (f *FallbackClient) Clone() Client + func (f *FallbackClient) Close() error + func (f *FallbackClient) GetModel() string + func (f *FallbackClient) SendFunctionResponse(ctx context.Context, history []*genai.Content, ...) (*StreamResponse, error) + func (f *FallbackClient) SendMessage(ctx context.Context, message string) (*StreamResponse, error) + func (f *FallbackClient) SendMessageWithHistory(ctx context.Context, history []*genai.Content, message string) (*StreamResponse, error) + func (f *FallbackClient) SetSystemInstruction(instruction string) + func (f *FallbackClient) SetTools(tools []*genai.Tool) + type FilePredictor interface + PredictFiles func(currentFile string, limit int) []PredictedFile + type LRUCache struct + func NewLRUCache[K comparable, V any](capacity int, ttl time.Duration) *LRUCache[K, V] + func (c *LRUCache[K, V]) Cleanup() int + func (c *LRUCache[K, V]) Clear() + func (c *LRUCache[K, V]) Close() + func (c *LRUCache[K, V]) Delete(key K) + func (c *LRUCache[K, V]) Get(key K) (V, bool) + func (c *LRUCache[K, V]) Keys() []K + func (c *LRUCache[K, V]) Len() int + func (c *LRUCache[K, V]) Set(key K, value V) + type Middleware func(next ToolExecuteFunc) ToolExecuteFunc + func ChainMiddleware(middlewares ...Middleware) Middleware + func LoggingMiddleware(logger func(string)) Middleware + func RetryMiddleware(config RetryConfig) Middleware + func TimingMiddleware(onDuration func(name string, d time.Duration)) Middleware + func ValidationMiddleware(validators map[string]func(args map[string]any) error) Middleware + type MultimodalPart struct + Data []byte + MimeType string + type NodeScore struct + Composite float64 + CostEstimate float64 + GoalProgress float64 + SuccessProb float64 + type PathStats struct + ContextType string + FailureCount int + FromAgent string + LastUsed time.Time + RecentResults []DelegationResult + SuccessCount int + ToAgent string + TotalTime time.Duration + type PathValidator struct + func NewPathValidator(allowedDirs []string) *PathValidator + func NewPathValidatorWithSymlinks(allowedDirs []string) *PathValidator + func (v *PathValidator) IsWithinAllowed(absPath string) bool + func (v *PathValidator) Validate(path string) (string, error) + type PlanChecker interface + IsActive func() bool + type PlanGoal struct + Description string + MaxDepth int + SuccessCriteria []string + type PlanLifecycle struct + CreatedAt time.Time + PlanID string + ReplanCount int + ReplanReason string + State PlanLifecycleState + Tree *PlanTree + UpdatedAt time.Time + Version int + func NewPlanLifecycle(planID string, tree *PlanTree) *PlanLifecycle + func (lc *PlanLifecycle) GetState() PlanLifecycleState + func (lc *PlanLifecycle) IsActive() bool + func (lc *PlanLifecycle) RequestReplan(reason string) error + func (lc *PlanLifecycle) Summary() string + func (lc *PlanLifecycle) TransitionTo(state PlanLifecycleState) error + type PlanLifecycleState string + const PlanStateApproved + const PlanStateCompleted + const PlanStateDraft + const PlanStateExecuting + const PlanStateFailed + const PlanStatePaused + type PlanNode struct + Action *PlannedAction + Children []*PlanNode + ID string + ParentID string + Result *PlanResult + Score float64 + Status PlanNodeStatus + TotalReward float64 + Visits int + type PlanNodeStatus string + const PlanNodeCompleted + const PlanNodeFailed + const PlanNodePending + const PlanNodeRunning + const PlanNodeSkipped + type PlanResult struct + Error string + Output string + Success bool + type PlanTree struct + BestPath []*PlanNode + Root *PlanNode + TotalNodes int + type PlannedAction struct + AgentType AgentType + NodeID string + Prerequisites []string + Prompt string + ToolArgs map[string]any + ToolName string + Type ActionType + type Planner struct + func NewPlanner(client Client, optimizer *StrategyOptimizer) *Planner + func (p *Planner) BuildPlan(ctx context.Context, goal PlanGoal) (*PlanTree, error) + func (p *Planner) ExpandNode(ctx context.Context, tree *PlanTree, nodeID string, context string) error + func (p *Planner) GetReadyNodes(tree *PlanTree) []*PlanNode + func (p *Planner) RecordResult(tree *PlanTree, nodeID string, result *PlanResult) + func (p *Planner) ScoreNode(node *PlanNode, goal PlanGoal) NodeScore + func (p *Planner) Search(ctx context.Context, tree *PlanTree, goal PlanGoal) ([]*PlanNode, error) + func (p *Planner) Summary(tree *PlanTree) string + func (p *Planner) WithPlannerConfig(config PlannerConfig) *Planner + func (p *Planner) WithSearchStrategy(strategy SearchStrategy) *Planner + type PlannerConfig struct + ExplorationC float64 + MCTSIterations int + MaxTreeDepth int + MaxTreeNodes int + Weights ScoringWeights + func DefaultPlannerConfig() PlannerConfig + type PredictedFile struct + Confidence float64 + Path string + type PromptOptimizer struct + func NewPromptOptimizer(storePath string) *PromptOptimizer + func (po *PromptOptimizer) Clear() error + func (po *PromptOptimizer) GetBestVariant(promptKey string) (*PromptVariant, bool) + func (po *PromptOptimizer) GetVariants(promptKey string) []*PromptVariant + func (po *PromptOptimizer) RecordOutcome(promptKey, variant string, success bool, tokens int, duration time.Duration) + type PromptVariant struct + AvgDuration time.Duration + AvgTokens int + BasePrompt string + Created time.Time + FailureCount int + ID string + LastUsed time.Time + SuccessCount int + SuccessRate float64 + UseCount int + Variation string + func (pv *PromptVariant) Score() float64 + type ReflectionResult struct + Alternative string + Category string + Matched bool + PredictedFiles []string + RootCause string + ShouldRetry bool + Suggestion string + type Reflector struct + func NewReflector(client Client, errorStore *memory.ErrorStore) *Reflector + func (r *Reflector) AddPattern(pattern *regexp.Regexp, category, suggestion string, shouldRetry bool, ...) + func (r *Reflector) Analyze(ctx context.Context, toolName string, args map[string]any, errorMsg string) *ReflectionResult + func (r *Reflector) BuildIntervention(toolName string, args map[string]any, result *ReflectionResult, ...) string + func (r *Reflector) LearnFromError(errorType, pattern, solution string, tags []string) error + func (r *Reflector) SetPredictor(predictor FilePredictor) + type Registry struct + func NewRegistry() *Registry + func (r *Registry) GeminiTools() []*genai.Tool + func (r *Registry) Get(name string) (Tool, bool) + func (r *Registry) List() []Tool + func (r *Registry) MustRegister(tool Tool) + func (r *Registry) Names() []string + func (r *Registry) Register(tool Tool) error + type Response struct + FinishReason genai.FinishReason + FunctionCalls []*genai.FunctionCall + InputTokens int + OutputTokens int + Parts []*genai.Part + Text string + func ProcessStream(ctx context.Context, sr *StreamResponse, handler *StreamHandler) (*Response, error) + type ResponseChunk struct + Done bool + Error error + FinishReason genai.FinishReason + FunctionCalls []*genai.FunctionCall + InputTokens int + OutputTokens int + Parts []*genai.Part + Text string + type RetryConfig struct + InitialDelay time.Duration + MaxDelay time.Duration + MaxRetries int + Multiplier float64 + func DefaultRetryConfig() RetryConfig + type RouteDecision struct + Analysis *TaskComplexity + Background bool + Handler string + Message string + Reasoning string + SubAgentType string + SuggestedModel string + ThinkingBudget int32 + type Router struct + func NewRouter(opts ...RouterOption) *Router + func (r *Router) Analyze(message string) *TaskComplexity + func (r *Router) GetConversationMode() string + func (r *Router) GetErrorRate() float64 + func (r *Router) GetStrategySuccessRate(strategy ExecutionStrategy) float64 + func (r *Router) RecordOutcome(message string, analysis *TaskComplexity, success bool) + func (r *Router) RecordTypedOutcome(message string, taskType TaskType, strategy ExecutionStrategy, success bool) + func (r *Router) Route(message string) *RouteDecision + func (r *Router) SetPlanChecker(pc PlanChecker) + func (r *Router) TrackOperation(toolName string, success bool) + type RouterOption func(*Router) + func WithDecomposeThreshold(threshold int) RouterOption + func WithFastModel(model string) RouterOption + func WithParallelThreshold(threshold int) RouterOption + func WithRouterEnabled(enabled bool) RouterOption + func WithRouterOptimizer(optimizer *StrategyOptimizer) RouterOption + type Runner struct + func NewRunner(client Client, registry *Registry, opts ...RunnerOption) *Runner + func (r *Runner) Cancel(agentID string) error + func (r *Runner) GetResult(agentID string) (*AgentResult, bool) + func (r *Runner) ListRunning() []string + func (r *Runner) Memory() *SharedMemory + func (r *Runner) Spawn(ctx context.Context, task AgentTask) (string, *AgentResult, error) + func (r *Runner) SpawnAsync(ctx context.Context, task AgentTask) (string, error) + func (r *Runner) Wait(ctx context.Context, agentID string) (*AgentResult, error) + func (r *Runner) WaitAll(ctx context.Context) map[string]*AgentResult + type RunnerConfig struct + DefaultMaxTurns int + DefaultTimeout time.Duration + MaxAgents int + OnAgentComplete func(agentID string, result *AgentResult) + OnAgentProgress func(agentID string, text string) + OnAgentStart func(agentID string, task AgentTask) + SystemPrompt string + type RunnerOption func(*Runner) + func WithMaxAgents(n int) RunnerOption + func WithOnAgentComplete(fn func(agentID string, result *AgentResult)) RunnerOption + func WithOnAgentProgress(fn func(agentID string, text string)) RunnerOption + func WithOnAgentStart(fn func(agentID string, task AgentTask)) RunnerOption + func WithRunnerDelegation(ds *DelegationStrategy) RunnerOption + func WithRunnerMaxTurns(n int) RunnerOption + func WithRunnerReflector(ref *Reflector) RunnerOption + func WithRunnerSystemPrompt(prompt string) RunnerOption + func WithRunnerTimeout(d time.Duration) RunnerOption + func WithSharedMemory(mem *SharedMemory) RunnerOption + type SafetyLevel string + const SafetyLevelCaution + const SafetyLevelCritical + const SafetyLevelDangerous + const SafetyLevelSafe + type ScoringWeights struct + Cost float64 + Progress float64 + Success float64 + func DefaultScoringWeights() ScoringWeights + type SearchStrategy string + const SearchAStar + const SearchBeam + const SearchMCTS + type SerializedAgentState struct + History []SerializedContent + MaxTurns int + Scratchpad string + ToolsUsed []string + TurnCount int + type SerializedContent struct + Parts []SerializedPart + Role string + func SerializeHistory(history []*genai.Content) []SerializedContent + type SerializedFunc struct + Args map[string]any + ID string + Name string + Response map[string]any + type SerializedPart struct + FunctionCall *SerializedFunc + FunctionResp *SerializedFunc + Text string + Type string + type Session struct + func NewSession(id string) *Session + func (s *Session) AddContent(content *genai.Content) + func (s *Session) AddModelResponse(content *genai.Content) + func (s *Session) AddUserMessage(msg string) + func (s *Session) Clear() + func (s *Session) CreatedAt() time.Time + func (s *Session) GetHistory() []*genai.Content + func (s *Session) GetVersion() int64 + func (s *Session) ID() string + func (s *Session) Len() int + func (s *Session) ReplaceWithSummary(summary *genai.Content, recentMessages []*genai.Content) + func (s *Session) SetMaxMessages(n int) + func (s *Session) SetOnChange(fn func(ChangeEvent)) + func (s *Session) Summary() string + type SessionStore struct + func NewSessionStore(dir string) *SessionStore + func (ss *SessionStore) Delete(id string) error + func (ss *SessionStore) List() ([]string, error) + func (ss *SessionStore) Load(id string) (*Session, error) + func (ss *SessionStore) Save(session *Session) error + type SharedEntry struct + Key string + Source string + TTL time.Duration + Timestamp time.Time + Type SharedEntryType + Value any + Version int + func (e *SharedEntry) IsExpired() bool + type SharedEntryType string + const MaxSharedEntries + const SharedEntryTypeContextSnapshot + const SharedEntryTypeDecision + const SharedEntryTypeFact + const SharedEntryTypeFileState + const SharedEntryTypeInsight + type SharedMemory struct + func NewSharedMemory() *SharedMemory + func (sm *SharedMemory) CleanupExpired() int + func (sm *SharedMemory) Clear() + func (sm *SharedMemory) Delete(key string) + func (sm *SharedMemory) Get(key string) (any, bool) + func (sm *SharedMemory) GetContextSnapshot() *ContextSnapshot + func (sm *SharedMemory) GetContextSnapshotForPrompt() string + func (sm *SharedMemory) GetForContext(agentID string, maxEntries int) string + func (sm *SharedMemory) Keys() []string + func (sm *SharedMemory) ReadAll() []*SharedEntry + func (sm *SharedMemory) ReadByType(entryType SharedEntryType) []*SharedEntry + func (sm *SharedMemory) ReadEntry(key string) (*SharedEntry, bool) + func (sm *SharedMemory) SaveContextSnapshot(snapshot *ContextSnapshot, sourceAgent string) + func (sm *SharedMemory) Set(key string, value any, ttl time.Duration) + func (sm *SharedMemory) Stats() SharedMemoryStats + func (sm *SharedMemory) Subscribe(agentID string) <-chan *SharedEntry + func (sm *SharedMemory) Unsubscribe(agentID string) + func (sm *SharedMemory) Write(key string, value any, entryType SharedEntryType, sourceAgent string) + func (sm *SharedMemory) WriteWithTTL(key string, value any, entryType SharedEntryType, sourceAgent string, ...) + type SharedMemoryStats struct + ByType map[SharedEntryType]int + DroppedMessages int64 + Subscribers int + TotalEntries int + type SmartRouter struct + func NewSmartRouter(optimizer *StrategyOptimizer, opts ...RouterOption) *SmartRouter + func (sr *SmartRouter) GetAdaptiveStats() map[string]*StrategyMetrics + func (sr *SmartRouter) Route(message string) *RouteDecision + type StatusCallback interface + OnError func(err error, recoverable bool) + OnRateLimit func(waitTime time.Duration) + OnRetry func(attempt, maxAttempts int, delay time.Duration, reason string) + OnStreamIdle func(elapsed time.Duration) + OnStreamResume func() + type StrategyMetrics struct + AvgDuration time.Duration + FailureCount int + LastUsed time.Time + StrategyName string + SuccessCount int + TaskTypes map[string]int + TotalTime time.Duration + func (sm *StrategyMetrics) SuccessRate() float64 + type StrategyOptimizer struct + func NewStrategyOptimizer(storePath string) *StrategyOptimizer + func (so *StrategyOptimizer) Clear() error + func (so *StrategyOptimizer) GetBestStrategy(taskType string) string + func (so *StrategyOptimizer) GetStrategies() map[string]*StrategyMetrics + func (so *StrategyOptimizer) RecordOutcome(taskType, strategy string, success bool, duration time.Duration) + type StreamHandler struct + OnDone func(response *Response) + OnError func(err error) + OnText func(text string) + OnToolCall func(fc *genai.FunctionCall) + OnToolResult func(name string, result string) + func NewStreamHandler(opts ...StreamHandlerOption) *StreamHandler + type StreamHandlerOption func(*StreamHandler) + func WithStreamOnDone(fn func(*Response)) StreamHandlerOption + func WithStreamOnError(fn func(error)) StreamHandlerOption + func WithStreamOnText(fn func(string)) StreamHandlerOption + func WithStreamOnToolCall(fn func(*genai.FunctionCall)) StreamHandlerOption + type StreamResponse struct + Chunks <-chan ResponseChunk + Done <-chan struct{} + func (sr *StreamResponse) Collect(ctx context.Context) (*Response, error) + type TaskComplexity struct + Reasoning string + Score int + Strategy ExecutionStrategy + Type TaskType + type TaskPriority int + const TaskPriorityHigh + const TaskPriorityLow + const TaskPriorityNormal + type TaskStatus string + const TaskStatusBlocked + const TaskStatusCompleted + const TaskStatusFailed + const TaskStatusPending + const TaskStatusReady + const TaskStatusRunning + type TaskType string + const TaskTypeBackground + const TaskTypeComplex + const TaskTypeExploration + const TaskTypeMultiTool + const TaskTypeQuestion + const TaskTypeRefactoring + const TaskTypeSingleTool + type Tool interface + Declaration func() *genai.FunctionDeclaration + Description func() string + Execute func(ctx context.Context, args map[string]any) (*ToolResult, error) + Name func() string + type ToolCallFromText struct + Args map[string]any + Name string + Tool string + type ToolDependencyClassifier struct + func NewToolDependencyClassifier() *ToolDependencyClassifier + func (c *ToolDependencyClassifier) AddWriteTool(name string) + func (c *ToolDependencyClassifier) ClassifyDependencies(calls []*genai.FunctionCall) []ToolGroup + func (c *ToolDependencyClassifier) IsWriteTool(name string) bool + func (c *ToolDependencyClassifier) OptimizeForParallelism(calls []*genai.FunctionCall) []*genai.FunctionCall + type ToolExecuteFunc func(ctx context.Context, name string, args map[string]any) (*ToolResult, error) + type ToolGroup struct + Calls []*genai.FunctionCall + Parallel bool + type ToolResult struct + Content string + Data any + Duration string + Error string + ExecutionSummary *ExecutionSummary + MultimodalParts []*MultimodalPart + SafetyLevel SafetyLevel + Success bool + func NewErrorResult(errMsg string) *ToolResult + func NewSuccessResult(content string) *ToolResult + func (r *ToolResult) ToMap() map[string]any + type ToolUsageGuide struct + CommonMistakes string + Description string + Examples string + HowToRespond string + WhenToUse string + func GetToolGuide(toolName string) (ToolUsageGuide, bool) + type ValidatingTool interface + Validate func(args map[string]any) error + type ValidationError struct + Field string + Message string + func (e *ValidationError) Error() string