agent

package
v0.6.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2026 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContextBuilder

type ContextBuilder struct {
	// contains filtered or unexported fields
}

func NewContextBuilder

func NewContextBuilder(workspacePath string) *ContextBuilder

NewContextBuilder creates a context builder

func (*ContextBuilder) BuildMessages

func (c *ContextBuilder) BuildMessages(history []*session.Message, current string, media []string) []*schema.Message

BuildMessages constructs the full message list

func (*ContextBuilder) BuildSystemPrompt

func (c *ContextBuilder) BuildSystemPrompt() string

BuildSystemPrompt assembles the system prompt

func (*ContextBuilder) InvalidateCache added in v0.6.3

func (c *ContextBuilder) InvalidateCache(changedPath string)

InvalidateCache clears the cached system prompt parts if the changed path is relevant. If changedPath is empty, it forces invalidation.

func (*ContextBuilder) SetRuntimeMetrics added in v0.6.3

func (c *ContextBuilder) SetRuntimeMetrics(recorder *metrics.RuntimeMetrics)

SetRuntimeMetrics attaches a runtime metrics recorder

type Loop

type Loop struct {
	OnToolStart  func(name, args string)
	OnToolFinish func(name, result string, err error)
	// contains filtered or unexported fields
}

Loop is the main agent processing loop

func NewLoop

func NewLoop(cfg *config.Config, msgBus *bus.MessageBus, chatModel model.ChatModel) (*Loop, error)

NewLoop creates a new agent loop

func (*Loop) AuditRuntimePolicyStartup added in v0.4.2

func (l *Loop) AuditRuntimePolicyStartup(ctx context.Context, cfg *config.Config)

AuditRuntimePolicyStartup writes startup policy audit events.

func (*Loop) ProcessDirect

func (l *Loop) ProcessDirect(ctx context.Context, content string) (string, error)

ProcessDirect processes a message directly (for CLI)

func (*Loop) ProcessForChannel added in v0.1.4

func (l *Loop) ProcessForChannel(ctx context.Context, channel, chatID, senderID, content string) (string, error)

ProcessForChannel processes a message directly for a given channel/session.

func (*Loop) ProcessForChannelWithSession added in v0.3.0

func (l *Loop) ProcessForChannelWithSession(ctx context.Context, channel, chatID, senderID, sessionID, content string) (string, error)

ProcessForChannelWithSession processes a message for a channel/chat using an optional explicit session id.

func (*Loop) RegisterDefaultTools

func (l *Loop) RegisterDefaultTools(cfg *config.Config) error

RegisterDefaultTools registers all built-in tools

func (*Loop) Run

func (l *Loop) Run(ctx context.Context) error

Run starts the agent loop

func (*Loop) SetActivityRecorder added in v0.3.0

func (l *Loop) SetActivityRecorder(recorder func(channel, chatID string))

SetActivityRecorder attaches a callback used to track the latest active channel/chat.

func (*Loop) SetRuntimeMetrics added in v0.4.2

func (l *Loop) SetRuntimeMetrics(recorder *metrics.RuntimeMetrics)

SetRuntimeMetrics attaches a runtime metrics recorder for tool execution stats.

func (*Loop) Tools added in v0.2.0

func (l *Loop) Tools() *tools.Registry

Tools returns the tool registry.

type SubagentManager added in v0.3.0

type SubagentManager struct {
	// contains filtered or unexported fields
}

SubagentManager executes delegated tasks in background or synchronously.

func NewSubagentManager added in v0.3.0

func NewSubagentManager(msgBus *bus.MessageBus, processor subagentProcessor, timeout time.Duration) *SubagentManager

NewSubagentManager creates a subagent manager.

func NewSubagentManagerWithOptions added in v0.5.0

func NewSubagentManagerWithOptions(msgBus *bus.MessageBus, processor subagentProcessor, options SubagentManagerOptions) *SubagentManager

NewSubagentManagerWithOptions creates a subagent manager with orchestration options.

func (*SubagentManager) RunSync added in v0.3.0

RunSync executes a subagent task synchronously and returns its result.

func (*SubagentManager) RunWorkflow added in v0.5.0

func (m *SubagentManager) RunWorkflow(ctx context.Context, req tools.WorkflowRequest) (string, error)

RunWorkflow executes a subagent workflow in sequential or parallel mode and returns an aggregated summary.

func (*SubagentManager) Spawn added in v0.3.0

Spawn starts a subagent task asynchronously.

type SubagentManagerOptions added in v0.5.0

type SubagentManagerOptions struct {
	Timeout        time.Duration
	Retry          int
	MaxConcurrency int
}

SubagentManagerOptions configures timeout/retry/concurrency for delegated tasks.

type SubagentTaskRequest added in v0.3.0

type SubagentTaskRequest struct {
	Task           string
	Label          string
	OriginChannel  string
	OriginChatID   string
	OriginSenderID string
	RequestID      string
}

SubagentTaskRequest defines a delegated subagent run request.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL