Documentation
¶
Index ¶
- Constants
- func NewObservedUTCPClient(client utcp.UtcpClientInterface) utcp.UtcpClientInterface
- func SaveSkill(dir string, skill SkillDefinition) (string, error)
- func SkillPrompt(routing SkillRouting) string
- func ValidateSkill(skill SkillDefinition) error
- func WithSkillRouting(ctx context.Context, routing SkillRouting) context.Context
- func WithToolExecutionObserver(ctx context.Context, observer func(ToolExecutionEvent)) context.Context
- type Agent
- func (a *Agent) ActiveToolSpecs(routing SkillRouting) []tools.Tool
- func (a *Agent) AsTool(name, description string) Tool
- func (a *Agent) AsUTCPTool(name, description string) tools.Tool
- func (a *Agent) Checkpoint() ([]byte, error)
- func (a *Agent) EnsureSpaceGrants(sessionID string, spaces []string)
- func (a *Agent) Flush(ctx context.Context, sessionID string) error
- func (a *Agent) Generate(ctx context.Context, sessionID, userInput string) (any, error)
- func (a *Agent) GenerateStream(ctx context.Context, sessionID, userInput string) (<-chan models.StreamChunk, error)
- func (a *Agent) GenerateWithFiles(ctx context.Context, sessionID string, userInput string, files []models.File) (string, error)
- func (a *Agent) GenerateWithSkillRouting(ctx context.Context, sessionID, userInput string) (any, error)
- func (a *Agent) RegisterAsUTCPProvider(ctx context.Context, client utcp.UtcpClientInterface, name, description string) error
- func (a *Agent) ReloadSkills() error
- func (a *Agent) Restore(data []byte) error
- func (a *Agent) RetrieveAttachmentFiles(ctx context.Context, sessionID string, limit int) ([]models.File, error)
- func (a *Agent) RouteSkills(input string, limit int) (SkillRouting, error)
- func (agent *Agent) Save(ctx context.Context, role, content string)
- func (a *Agent) SessionMemory() *memory.SessionMemory
- func (a *Agent) SetSharedSpaces(shared *memory.SharedSession)
- func (a *Agent) SkillRegistry() (*SkillRegistry, error)
- func (a *Agent) Skills() []Skill
- func (a *Agent) SubAgents() []SubAgent
- func (a *Agent) ToolSpecs() []tools.Tool
- func (a *Agent) Tools() []Tool
- func (a *Agent) WebUISkills() []SkillDefinition
- func (a *Agent) WebUITools() []ToolSpec
- type AgentState
- type AgentToolAdapter
- type FormatEnforcer
- type InputGuardrails
- type InputSafetyPolicy
- type InputTransformer
- type LLMEvaluatorInputPolicy
- type LLMEvaluatorPolicy
- type ObservedUTCPClient
- type Options
- type OutputGuardrails
- type PIIMaskerTransformer
- type PromptInjectionDetectorPolicy
- type QueryType
- type RegexBlocklistPolicy
- type RegexInputBlocklistPolicy
- type RegexInputReplaceTransformer
- type SafetyPolicy
- type Skill
- type SkillDefinition
- type SkillEvaluation
- type SkillEvaluationResult
- type SkillEvaluator
- type SkillMatch
- type SkillRegistry
- func (r *SkillRegistry) Get(name string) (SkillDefinition, bool)
- func (r *SkillRegistry) List() []SkillDefinition
- func (r *SkillRegistry) Match(input string, limit int) []SkillMatch
- func (r *SkillRegistry) Register(skill SkillDefinition) error
- func (r *SkillRegistry) Remove(name string)
- func (r *SkillRegistry) ResolveDependencies(names []string) ([]SkillDefinition, error)
- type SkillRouting
- type StaticSubAgentDirectory
- type StaticToolCatalog
- type SubAgent
- type SubAgentDirectory
- type SubAgentTool
- type Tool
- type ToolCatalog
- type ToolChoice
- type ToolExecutionEvent
- type ToolRequest
- type ToolResponse
- type ToolSpec
- type WorkspaceAgent
Constants ¶
const DefaultSkillsDir = ".skills"
DefaultSkillsDir is the directory scanned automatically when an Agent is created. A missing directory is treated as an empty skill set.
Variables ¶
This section is empty.
Functions ¶
func NewObservedUTCPClient ¶ added in v1.14.7
func NewObservedUTCPClient(client utcp.UtcpClientInterface) utcp.UtcpClientInterface
func SaveSkill ¶ added in v1.14.4
func SaveSkill(dir string, skill SkillDefinition) (string, error)
SaveSkill persists a v2 skill in the existing human-editable SKILL.md format.
func SkillPrompt ¶ added in v1.14.4
func SkillPrompt(routing SkillRouting) string
func ValidateSkill ¶ added in v1.14.4
func ValidateSkill(skill SkillDefinition) error
func WithSkillRouting ¶ added in v1.14.4
func WithSkillRouting(ctx context.Context, routing SkillRouting) context.Context
func WithToolExecutionObserver ¶ added in v1.14.7
func WithToolExecutionObserver(ctx context.Context, observer func(ToolExecutionEvent)) context.Context
WithToolExecutionObserver attaches a per-request observer to the context. Observers are request-scoped and therefore safe when the same Agent serves multiple concurrent WebUI sessions.
Types ¶
type Agent ¶
type Agent struct {
UTCPClient utcp.UtcpClientInterface
CodeMode *codemode.CodeModeUTCP
AllowUnsafeTools bool
Guardrails *OutputGuardrails
InputGuardrails *InputGuardrails
// contains filtered or unexported fields
}
Agent orchestrates model calls, memory, tools, and sub-agents.
func (*Agent) ActiveToolSpecs ¶ added in v1.14.4
func (a *Agent) ActiveToolSpecs(routing SkillRouting) []tools.Tool
func (*Agent) AsUTCPTool ¶ added in v1.10.0
AsUTCPTool exposes the agent as a UTCP tool with an in-process handler. The tool accepts: - instruction (required): user query for the agent - session_id (optional): custom session id; defaults to a namespaced value derived from the tool name
func (*Agent) Checkpoint ¶ added in v1.10.3
Checkpoint serializes the agent's current state (system prompt and short-term memory) to a byte slice. This can be saved to disk or a database to pause the agent.
func (*Agent) EnsureSpaceGrants ¶
EnsureSpaceGrants gives the provided sessionID writer access to each space. This mirrors how tests set up spaces: mem.Spaces.Grant(space, session, role, ttl).
func (*Agent) GenerateStream ¶ added in v1.10.6
func (a *Agent) GenerateStream(ctx context.Context, sessionID, userInput string) (<-chan models.StreamChunk, error)
GenerateStream provides a streaming interface for the agent's generation process. It follows the same logic as Generate but returns a channel of chunks.
func (*Agent) GenerateWithFiles ¶
func (a *Agent) GenerateWithFiles( ctx context.Context, sessionID string, userInput string, files []models.File, ) (string, error)
GenerateWithFiles sends the user message plus in-memory files to the model without ingesting them into long-term memory. Use this when you already have file bytes (e.g., uploaded via API) and want the model to consider them ephemerally for this turn only. GenerateWithFiles runs the full orchestration pipeline (direct tool → subagent → CodeMode → UTCP tool loop) before falling back to a file-aware model call. Files are forwarded to the planner so tools can be selected with attachment context, but tool execution still uses the normal UTCP arguments.
func (*Agent) GenerateWithSkillRouting ¶ added in v1.14.4
func (a *Agent) GenerateWithSkillRouting(ctx context.Context, sessionID, userInput string) (any, error)
GenerateWithSkillRouting runs one request with an isolated skill/tool scope.
func (*Agent) RegisterAsUTCPProvider ¶ added in v1.10.0
func (a *Agent) RegisterAsUTCPProvider(ctx context.Context, client utcp.UtcpClientInterface, name, description string) error
RegisterAsUTCPProvider registers the agent as a UTCP tool on the provided client. It installs a lightweight in-process transport under the "text" provider type to route CallTool invocations directly to the agent's Generate method.
func (*Agent) ReloadSkills ¶ added in v1.14.4
ReloadSkills reloads the configured local skills directory. It is useful for long-running agents whose .skills files are edited after startup.
func (*Agent) Restore ¶ added in v1.10.3
Restore rehydrates the agent's state from a checkpoint. It restores the system prompt and short-term memory.
func (*Agent) RetrieveAttachmentFiles ¶
func (a *Agent) RetrieveAttachmentFiles(ctx context.Context, sessionID string, limit int) ([]models.File, error)
RetrieveAttachmentFiles returns attachment files stored for the session. It reconstructs the original bytes from base64-encoded metadata, making it suitable for binary assets such as images and videos.
func (*Agent) RouteSkills ¶ added in v1.14.4
func (a *Agent) RouteSkills(input string, limit int) (SkillRouting, error)
func (*Agent) Save ¶
Save stores a conversation turn into all shared spaces. role should be "user" or "agent".
func (*Agent) SessionMemory ¶
func (a *Agent) SessionMemory() *memory.SessionMemory
SessionMemory exposes the underlying session memory (useful for advanced setup/tests).
func (*Agent) SetSharedSpaces ¶
func (a *Agent) SetSharedSpaces(shared *memory.SharedSession)
func (*Agent) SkillRegistry ¶ added in v1.14.4
func (a *Agent) SkillRegistry() (*SkillRegistry, error)
func (*Agent) Skills ¶ added in v1.14.4
Skills returns a snapshot of the skills currently loaded by the Agent.
func (*Agent) WebUISkills ¶ added in v1.14.7
func (a *Agent) WebUISkills() []SkillDefinition
WebUISkills returns the skills currently loaded by the Agent as SkillDefinition values suitable for the Web UI. The runtime Agent stores legacy Skill documents, while SkillDefinition is the richer declarative Skill System 2.0 type, so the legacy fields are wrapped without inventing v2 metadata that is not present at runtime.
func (*Agent) WebUITools ¶ added in v1.14.7
WebUITools returns tool metadata currently visible to the Agent. Invocation remains inside the agent runtime.
type AgentState ¶ added in v1.10.3
type AgentState struct {
SystemPrompt string `json:"system_prompt"`
ShortTerm map[string][]model.MemoryRecord `json:"short_term"`
JoinedSpaces []string `json:"joined_spaces,omitempty"`
Timestamp time.Time `json:"timestamp"`
}
AgentState represents the serializable state of an agent for checkpointing.
type AgentToolAdapter ¶ added in v1.0.9
type AgentToolAdapter struct {
// contains filtered or unexported fields
}
AgentToolAdapter adapts an Agent to the Tool interface.
func (*AgentToolAdapter) Invoke ¶ added in v1.0.9
func (t *AgentToolAdapter) Invoke(ctx context.Context, req ToolRequest) (ToolResponse, error)
func (*AgentToolAdapter) Spec ¶ added in v1.0.9
func (t *AgentToolAdapter) Spec() ToolSpec
type FormatEnforcer ¶ added in v1.11.0
FormatEnforcer defines an interface for validating or repairing the format of LLM responses.
type InputGuardrails ¶ added in v1.11.4
type InputGuardrails struct {
SafetyPolicies []InputSafetyPolicy
Transformers []InputTransformer
}
InputGuardrails holds the input safety policies and transformers.
func (*InputGuardrails) ValidateAndTransform ¶ added in v1.11.4
ValidateAndTransform applies safety checks and transformers to the input.
type InputSafetyPolicy ¶ added in v1.11.4
InputSafetyPolicy defines an interface for validating LLM inputs.
type InputTransformer ¶ added in v1.11.4
InputTransformer defines an interface for modifying or sanitizing LLM inputs.
type LLMEvaluatorInputPolicy ¶ added in v1.11.4
type LLMEvaluatorInputPolicy struct {
// contains filtered or unexported fields
}
LLMEvaluatorInputPolicy uses a secondary language model to evaluate the safety of the proposed input query.
func NewLLMEvaluatorInputPolicy ¶ added in v1.11.4
func NewLLMEvaluatorInputPolicy(model models.Agent, promptTemplate string) *LLMEvaluatorInputPolicy
NewLLMEvaluatorInputPolicy creates a new input safety policy that uses an LLM to evaluate inputs. If promptTemplate is empty, a default evaluation prompt is used.
type LLMEvaluatorPolicy ¶ added in v1.11.1
type LLMEvaluatorPolicy struct {
// contains filtered or unexported fields
}
LLMEvaluatorPolicy uses a secondary language model to evaluate the safety of the proposed response.
func NewLLMEvaluatorPolicy ¶ added in v1.11.1
func NewLLMEvaluatorPolicy(model models.Agent, promptTemplate string) *LLMEvaluatorPolicy
NewLLMEvaluatorPolicy creates a new safety policy that uses an LLM to evaluate responses. If promptTemplate is empty, a default evaluation prompt is used.
type ObservedUTCPClient ¶ added in v1.14.7
type ObservedUTCPClient struct {
utcp.UtcpClientInterface
}
ObservedUTCPClient wraps a UTCP client without changing its behavior. Tool calls made directly by the Agent and calls made from CodeMode both pass through this wrapper, which gives us one canonical execution event stream.
func (*ObservedUTCPClient) CallToolStream ¶ added in v1.14.7
func (c *ObservedUTCPClient) CallToolStream(ctx context.Context, toolName string, args map[string]any) (transports.StreamResult, error)
type Options ¶
type Options struct {
Model models.Agent
Memory *memory.SessionMemory
SystemPrompt string
ContextLimit int
// SkillsDir is scanned for local skill instructions. When empty, .skills
// in the process working directory is used.
SkillsDir string
// DisableSkills prevents automatic loading of local skill instructions.
DisableSkills bool
Tools []Tool
SubAgents []SubAgent
ToolCatalog ToolCatalog
SubAgentDirectory SubAgentDirectory
UTCPClient utcp.UtcpClientInterface
CodeMode *codemode.CodeModeUTCP
AllowUnsafeTools bool
Guardrails *OutputGuardrails
InputGuardrails *InputGuardrails
}
Options configure a new Agent.
type OutputGuardrails ¶ added in v1.11.0
type OutputGuardrails struct {
SafetyPolicies []SafetyPolicy
FormatEnforcers []FormatEnforcer
}
OutputGuardrails holds the policy engines and formatting rules.
func (*OutputGuardrails) ValidateAndRepair ¶ added in v1.11.0
ValidateAndRepair applies safety checks and format enforcing to the response.
type PIIMaskerTransformer ¶ added in v1.11.4
type PIIMaskerTransformer struct {
// contains filtered or unexported fields
}
PIIMaskerTransformer automatically detects personal data and replaces it with generic descriptors like [EMAIL] or [PHONE].
func NewPIIMaskerTransformer ¶ added in v1.11.4
func NewPIIMaskerTransformer(maskEmail, maskPhone, maskSSN, maskCards bool) *PIIMaskerTransformer
NewPIIMaskerTransformer creates a new PII masker transformer configuring the categories to mask.
type PromptInjectionDetectorPolicy ¶ added in v1.11.4
type PromptInjectionDetectorPolicy struct {
// contains filtered or unexported fields
}
PromptInjectionDetectorPolicy scans the user query for common phrases associated with prompt injection attacks (heuristics).
func NewPromptInjectionDetectorPolicy ¶ added in v1.11.4
func NewPromptInjectionDetectorPolicy(customPatterns []string) *PromptInjectionDetectorPolicy
NewPromptInjectionDetectorPolicy creates a new injection detector policy. If customPatterns is provided, they are converted to lowercase and appended to the default patterns list.
type RegexBlocklistPolicy ¶ added in v1.11.1
type RegexBlocklistPolicy struct {
// contains filtered or unexported fields
}
RegexBlocklistPolicy enforces that a configurable list of regular expressions are not matched within the LLM output.
func NewRegexBlocklistPolicy ¶ added in v1.11.1
func NewRegexBlocklistPolicy(patterns []string) (*RegexBlocklistPolicy, error)
NewRegexBlocklistPolicy creates a new policy with the given string regex patterns. It returns an error if any of the patterns fail to compile.
type RegexInputBlocklistPolicy ¶ added in v1.11.4
type RegexInputBlocklistPolicy struct {
// contains filtered or unexported fields
}
RegexInputBlocklistPolicy validates that the input does not match a configurable list of regular expression patterns.
func NewRegexInputBlocklistPolicy ¶ added in v1.11.4
func NewRegexInputBlocklistPolicy(patterns []string) (*RegexInputBlocklistPolicy, error)
NewRegexInputBlocklistPolicy creates a new policy with the given string regex patterns. It returns an error if any of the patterns fail to compile.
type RegexInputReplaceTransformer ¶ added in v1.11.4
type RegexInputReplaceTransformer struct {
// contains filtered or unexported fields
}
RegexInputReplaceTransformer replaces occurrences of a regular expression pattern with a specified replacement string.
func NewRegexInputReplaceTransformer ¶ added in v1.11.4
func NewRegexInputReplaceTransformer(pattern string, replacement string) (*RegexInputReplaceTransformer, error)
NewRegexInputReplaceTransformer creates a new regex replace transformer.
type SafetyPolicy ¶ added in v1.11.0
SafetyPolicy defines an interface for validating LLM responses.
type Skill ¶ added in v1.14.4
Skill is a local instruction document available to an Agent. Instructions are loaded from Markdown, while the optional name and description front matter fields make the rendered prompt easier for a model to navigate.
func LoadSkills ¶ added in v1.14.4
LoadSkills discovers skill documents below dir. It supports the conventional .skills/<name>/SKILL.md layout as well as Markdown files placed directly in .skills. The returned order is stable by path.
A missing skills directory is not an error, so applications can opt in by simply creating it. Symlinks are ignored to keep a skills directory from unexpectedly reading instructions outside its configured root.
type SkillDefinition ¶ added in v1.14.4
type SkillDefinition struct {
Skill
Version string
Tags []string
Triggers []string
Dependencies []string
Tools []string
Evaluator SkillEvaluator
Enabled bool
}
SkillDefinition is the declarative Skill System 2.0 representation.
func LoadSkillDefinitions ¶ added in v1.14.4
func LoadSkillDefinitions(dir string) ([]SkillDefinition, error)
LoadSkillDefinitions upgrades the existing .skills format without breaking it.
type SkillEvaluation ¶ added in v1.14.4
type SkillEvaluationResult ¶ added in v1.14.4
type SkillEvaluator ¶ added in v1.14.4
type SkillEvaluator interface {
Evaluate(context.Context, SkillEvaluation) (SkillEvaluationResult, error)
}
type SkillMatch ¶ added in v1.14.4
type SkillMatch struct {
Skill SkillDefinition
Score float64
Reason string
}
type SkillRegistry ¶ added in v1.14.4
type SkillRegistry struct {
// contains filtered or unexported fields
}
func NewSkillRegistry ¶ added in v1.14.4
func NewSkillRegistry() *SkillRegistry
func (*SkillRegistry) Get ¶ added in v1.14.4
func (r *SkillRegistry) Get(name string) (SkillDefinition, bool)
func (*SkillRegistry) List ¶ added in v1.14.4
func (r *SkillRegistry) List() []SkillDefinition
func (*SkillRegistry) Match ¶ added in v1.14.4
func (r *SkillRegistry) Match(input string, limit int) []SkillMatch
Match performs deterministic lightweight routing before the model call.
func (*SkillRegistry) Register ¶ added in v1.14.4
func (r *SkillRegistry) Register(skill SkillDefinition) error
func (*SkillRegistry) Remove ¶ added in v1.14.4
func (r *SkillRegistry) Remove(name string)
func (*SkillRegistry) ResolveDependencies ¶ added in v1.14.4
func (r *SkillRegistry) ResolveDependencies(names []string) ([]SkillDefinition, error)
ResolveDependencies returns dependency-first order and detects cycles.
type SkillRouting ¶ added in v1.14.4
type SkillRouting struct {
Matches []SkillMatch
Skills []SkillDefinition
Tools map[string]struct{}
}
func (SkillRouting) ActiveSkillNames ¶ added in v1.14.4
func (r SkillRouting) ActiveSkillNames() []string
type StaticSubAgentDirectory ¶
type StaticSubAgentDirectory struct {
// contains filtered or unexported fields
}
StaticSubAgentDirectory is the default SubAgentDirectory implementation.
func NewStaticSubAgentDirectory ¶
func NewStaticSubAgentDirectory(subagents []SubAgent) *StaticSubAgentDirectory
NewStaticSubAgentDirectory constructs a directory from the provided sub-agents.
func (*StaticSubAgentDirectory) All ¶
func (d *StaticSubAgentDirectory) All() []SubAgent
All returns the registered sub-agents in registration order.
func (*StaticSubAgentDirectory) Lookup ¶
func (d *StaticSubAgentDirectory) Lookup(name string) (SubAgent, bool)
Lookup retrieves a sub-agent by name.
func (*StaticSubAgentDirectory) Register ¶
func (d *StaticSubAgentDirectory) Register(subAgent SubAgent) error
Register adds a sub-agent to the directory. Duplicate names return an error.
type StaticToolCatalog ¶
type StaticToolCatalog struct {
// contains filtered or unexported fields
}
StaticToolCatalog is the default in-memory implementation of ToolCatalog used by the runtime.
func NewStaticToolCatalog ¶
func NewStaticToolCatalog(tools []Tool) *StaticToolCatalog
NewStaticToolCatalog constructs a catalog seeded with the provided tools.
func (*StaticToolCatalog) Lookup ¶
func (c *StaticToolCatalog) Lookup(name string) (Tool, ToolSpec, bool)
Lookup returns the tool and its specification if present.
func (*StaticToolCatalog) Register ¶
func (c *StaticToolCatalog) Register(tool Tool) error
Register adds a tool to the catalog using a lower-cased key. Duplicate names return an error.
func (*StaticToolCatalog) Specs ¶
func (c *StaticToolCatalog) Specs() []ToolSpec
Specs returns a snapshot of the tool specifications in registration order.
func (*StaticToolCatalog) Tools ¶
func (c *StaticToolCatalog) Tools() []Tool
Tools returns the registered tools in order.
type SubAgent ¶
type SubAgent interface {
Name() string
Description() string
Run(ctx context.Context, input string) (string, error)
}
SubAgent represents a specialist agent that can be delegated work.
type SubAgentDirectory ¶
type SubAgentDirectory interface {
Register(subAgent SubAgent) error
Lookup(name string) (SubAgent, bool)
All() []SubAgent
}
SubAgentDirectory stores sub-agents by name while preserving insertion order.
type SubAgentTool ¶ added in v1.0.9
type SubAgentTool struct {
// contains filtered or unexported fields
}
SubAgentTool adapts a SubAgent to the Tool interface.
func (*SubAgentTool) Invoke ¶ added in v1.0.9
func (t *SubAgentTool) Invoke(ctx context.Context, req ToolRequest) (ToolResponse, error)
func (*SubAgentTool) Spec ¶ added in v1.0.9
func (t *SubAgentTool) Spec() ToolSpec
type Tool ¶
type Tool interface {
Spec() ToolSpec
Invoke(ctx context.Context, req ToolRequest) (ToolResponse, error)
}
Tool exposes structured metadata and an invocation handler.
func NewAgentTool ¶ added in v1.0.9
NewAgentTool creates a new tool that wraps an Agent.
func NewSubAgentTool ¶ added in v1.0.9
NewSubAgentTool creates a new tool that wraps a SubAgent.
type ToolCatalog ¶
type ToolCatalog interface {
Register(tool Tool) error
Lookup(name string) (Tool, ToolSpec, bool)
Specs() []ToolSpec
Tools() []Tool
}
ToolCatalog maintains an ordered set of tools and provides lookup by name.
type ToolChoice ¶ added in v0.7.5
type ToolExecutionEvent ¶ added in v1.14.7
type ToolExecutionEvent struct {
Type string `json:"type"`
Tool string `json:"tool"`
Arguments map[string]any `json:"arguments,omitempty"`
Result any `json:"result,omitempty"`
Error string `json:"error,omitempty"`
DurationMS int64 `json:"duration_ms,omitempty"`
}
ToolExecutionEvent describes one real UTCP tool execution. It is emitted from the same client used by the agent and CodeMode, so the WebUI can render the actual execution order instead of inferring tool calls from model text.
type ToolRequest ¶
ToolRequest captures an invocation request for a tool.
type ToolResponse ¶
ToolResponse represents the structured response returned by a tool.
type ToolSpec ¶
type ToolSpec struct {
Name string `json:"name"`
Description string `json:"description"`
InputSchema map[string]any `json:"input_schema"`
Examples []map[string]any `json:"examples,omitempty"`
}
ToolSpec describes how the agent should present a tool to the model.
type WorkspaceAgent ¶ added in v1.14.5
type WorkspaceAgent struct {
Agent *Agent
Index *workspace.Index
Context workspace.ContextRequest
}
WorkspaceAgent decorates an Agent with repository-aware context retrieval. The underlying Agent remains responsible for tools, skills, memory, CodeMode, sub-agents, guardrails, and model execution.
func NewWorkspaceAgent ¶ added in v1.14.5
func NewWorkspaceAgent(a *Agent, index *workspace.Index) (*WorkspaceAgent, error)
NewWorkspaceAgent attaches Workspace Intelligence to an existing Agent. The index should normally be built once and kept alive for the lifetime of the agent. If an Embedder is configured, set Context.Semantic to true.
func (*WorkspaceAgent) Generate ¶ added in v1.14.5
Generate retrieves repository context for the request and injects it into the underlying Agent prompt. Tool execution and all other Agent behavior are delegated unchanged to the wrapped Agent.
func (*WorkspaceAgent) GenerateWithFiles ¶ added in v1.14.5
func (a *WorkspaceAgent) GenerateWithFiles(ctx context.Context, sessionID, userInput string, files []models.File) (string, error)
GenerateWithFiles preserves normal Agent file handling while also adding repository context selected from the workspace index.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package arena provides a small, deterministic evaluation harness for go-agent.
|
Package arena provides a small, deterministic evaluation harness for go-agent. |
|
cmd
|
|
|
app
command
main.go — fixed agent-mode with provider flag Runs your Agent with optional file context using GenerateWithFiles.
|
main.go — fixed agent-mode with provider flag Runs your Agent with optional file context using GenerateWithFiles. |
|
codemode
command
|
|
|
example
command
main.go — fixed agent-mode with provider flag, Postgres memory + CreateSchema Runs your Agent with optional file context using GenerateWithFiles.
|
main.go — fixed agent-mode with provider flag, Postgres memory + CreateSchema Runs your Agent with optional file context using GenerateWithFiles. |
|
example/agent_as_tool
command
|
|
|
example/agent_as_utcp_codemode
command
|
|
|
example/autonomous_agent
command
|
|
|
example/autonomous_cron
command
|
|
|
example/checkpoint
command
|
|
|
example/claw_cron
command
|
|
|
example/codemode
command
|
|
|
example/codemode_utcp_workflow
command
|
|
|
example/composability
command
|
|
|
example/graph_workflow
command
|
|
|
example/guardrails
command
|
|
|
example/internal/filestore
Package filestore provides the lightweight JSON-backed memory used by the autonomous examples.
|
Package filestore provides the lightweight JSON-backed memory used by the autonomous examples. |
|
gateway
command
|
|
|
src
|
|
|
models/middleware
Package middleware provides composable policies for model calls.
|
Package middleware provides composable policies for model calls. |