agent

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
	UsageMetrics map[string]int
	// contains filtered or unexported fields
}

Agent represents an AI agent with a role, goal, tools, and memory.

func New

func New(cfg Config) *Agent

New creates a new Agent with the given configuration, applying sensible defaults.

func (*Agent) A2ACard added in v0.2.0

func (a *Agent) A2ACard() *a2a.AgentCard

A2ACard returns the agent's A2A agent card, or nil if not registered.

func (*Agent) A2AClient added in v0.2.0

func (a *Agent) A2AClient() *a2a.A2AClient

A2AClient returns the agent's A2A client, or nil if not enabled.

func (*Agent) A2AServer added in v0.2.0

func (a *Agent) A2AServer() *a2a.A2AServer

A2AServer returns the agent's A2A server, or nil if not enabled.

func (*Agent) AddKnowledgeSources added in v0.4.0

func (a *Agent) AddKnowledgeSources(sources ...knowledge.KnowledgeSource)

@sk-task knowledge-sources#T4.1: AddKnowledgeSources appends shared knowledge sources (AC-008)

func (*Agent) Close added in v0.2.0

func (a *Agent) Close(ctx context.Context)

@sk-task a2a#polish: Close shuts down the A2A server and unregisters the agent card.

func (*Agent) DelegateTo added in v0.2.0

func (a *Agent) DelegateTo(ctx context.Context, role, request string) (*a2a.DelegationFuture, error)

DelegateTo delegates a task to another agent by role and returns a DelegationFuture.

func (*Agent) Equip

func (a *Agent) Equip(t ...tools.Tool)

Equip adds tools to the agent's available tool set.

func (*Agent) Execute

func (a *Agent) Execute(ctx context.Context, taskDesc, expectedOutput string, ctxTasks []string) (string, error)

Execute runs the agent's ReAct loop to complete a given task and returns the output.

func (*Agent) GetBackstory

func (a *Agent) GetBackstory() string

GetBackstory returns the agent's backstory.

func (*Agent) GetGoal

func (a *Agent) GetGoal() string

GetGoal returns the agent's goal.

func (*Agent) GetMaxIter

func (a *Agent) GetMaxIter() int

GetMaxIter returns the maximum number of iterations for the agent's ReAct loop.

func (*Agent) GetRole

func (a *Agent) GetRole() string

GetRole returns the agent's role.

func (*Agent) GetTools

func (a *Agent) GetTools() []tools.Tool

GetTools returns the agent's available tools.

func (*Agent) GetUsageMetrics

func (a *Agent) GetUsageMetrics() map[string]int

GetUsageMetrics returns the agent's token and tool usage metrics.

func (*Agent) HandleA2AMessage added in v0.2.0

func (a *Agent) HandleA2AMessage(ctx context.Context, msg *a2a.A2AMessage) (*a2a.A2AMessage, error)

@sk-task a2a#polish: HandleA2AMessage processes an incoming delegation and returns a typed response.

func (*Agent) MCPServer added in v0.3.0

func (a *Agent) MCPServer() *mcp.MCPServer

MCPServer returns the agent's MCP server, or nil if not started.

func (*Agent) Sandbox added in v0.3.0

func (a *Agent) Sandbox() sandbox.Provider

Sandbox returns the agent's sandbox provider, or nil if not configured.

func (*Agent) StartMCPServer added in v0.3.0

func (a *Agent) StartMCPServer(ctx context.Context, port string) error

@sk-task mcp-sandbox#T2.3: StartMCPServer starts an MCP server exposing the agent's tools.

func (*Agent) StartMCPStdioServer added in v0.3.0

func (a *Agent) StartMCPStdioServer(ctx context.Context) error

@sk-task mcp-sandbox#T2.3: StartMCPStdioServer starts an MCP server over stdio.

type Config

type Config struct {
	Role             string
	Goal             string
	Backstory        string
	LLM              llm.Client
	Tools            []tools.Tool
	Memory           memory.Store
	MaxIter          int
	MaxRPM           int
	MaxRetries       int
	MaxExecutionTime time.Duration
	Verbose          bool
	AllowDelegation  bool
	StepCallback     callback.Callback
	// @sk-task a2a#T3.2: A2A protocol fields (AC-006)
	A2APort         int
	A2AAuthToken    string
	A2ACapabilities []string
	// @sk-task mcp-sandbox#T2.3, T3.1: sandbox type ("wasm"/"docker"/"") (AC-007)
	SandboxType string
	// @sk-task knowledge-sources#T2.2: knowledge sources and pipeline (AC-007)
	KnowledgeSources []knowledge.KnowledgeSource
	// @sk-task guardrails#T3.1: agent-level guardrails validated before final return (AC-009)
	Guardrails []guardrail.Guardrail
	// @sk-task training#T3.1: training directory for advice injection (AC-009, AC-010, AC-015)
	TrainingDir string
}

Config defines the configuration for an Agent.

Jump to

Keyboard shortcuts

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