Documentation
¶
Index ¶
- Constants
- Variables
- func BlockedReasonForError(err error) (kinds.ReusableAgentBlockedReason, bool)
- func BuildSessionMCPServers(execution *ExecutionContext, ctx SessionMCPContext) ([]model.MCPServer, error)
- func IsValidationError(err error) bool
- type Catalog
- type ExecutionContext
- type MCPConfig
- type MCPServer
- type Metadata
- type NestedBaseRuntime
- type NestedExecutionContext
- type Option
- type Problem
- type Registry
- type ReservedServerRuntimeContext
- type ResolvedAgent
- type RuntimeDefaults
- type Scope
- type SessionMCPContext
- type Source
Constants ¶
const ( // ReservedAgentName is the only disallowed reusable agent slug in v1. ReservedAgentName = "productize" // ReservedMCPServerName is the host-owned MCP server name that agents may not override. ReservedMCPServerName = "productize" )
const ( // DefaultMaxNestedDepth bounds recursive child-agent execution. DefaultMaxNestedDepth = 3 // RunAgentContextEnvVar carries the host-owned nested execution context into // the reserved `productize` MCP server process. RunAgentContextEnvVar = "PRODUCTIZE_RUN_AGENT_CONTEXT" )
Variables ¶
var ( // ErrAgentNotFound indicates that no resolved agent matched the requested name. ErrAgentNotFound = errors.New("agent not found") // ErrInvalidAgentName indicates that an agent directory name failed slug validation. ErrInvalidAgentName = errors.New("invalid agent name") // ErrReservedAgentName indicates that an agent directory uses a reserved slug. ErrReservedAgentName = errors.New("reserved agent name") // ErrMissingAgentDefinition indicates that an agent directory does not contain `AGENT.md`. ErrMissingAgentDefinition = errors.New("missing AGENT.md") // ErrMalformedFrontmatter indicates that `AGENT.md` frontmatter could not be parsed. ErrMalformedFrontmatter = errors.New("malformed AGENT.md front matter") // ErrUnsupportedMetadataField indicates that `AGENT.md` declares a deferred field. ErrUnsupportedMetadataField = errors.New("unsupported agent metadata field") // ErrInvalidRuntimeDefaults indicates that agent runtime defaults are invalid. ErrInvalidRuntimeDefaults = errors.New("invalid agent runtime defaults") // ErrMalformedMCPConfig indicates that `mcp.json` is invalid. ErrMalformedMCPConfig = errors.New("malformed mcp.json") // ErrMissingEnvironmentVariable indicates that a placeholder referenced an unset environment variable. ErrMissingEnvironmentVariable = errors.New("missing environment variable") // ErrReservedMCPServerName indicates that `mcp.json` attempted to declare the host-owned server. ErrReservedMCPServerName = errors.New("reserved MCP server name") )
Functions ¶
func BlockedReasonForError ¶
func BlockedReasonForError(err error) (kinds.ReusableAgentBlockedReason, bool)
BlockedReasonForError classifies reusable-agent errors into the stable machine-readable blocked-reason vocabulary used by runtime signals and nested-agent failures.
func BuildSessionMCPServers ¶
func BuildSessionMCPServers( execution *ExecutionContext, ctx SessionMCPContext, ) ([]model.MCPServer, error)
BuildSessionMCPServers returns the reserved `productize` MCP server plus the selected agent's own MCP servers, in deterministic order.
func IsValidationError ¶
IsValidationError reports whether the provided error describes an invalid reusable-agent definition or MCP configuration.
Types ¶
type Catalog ¶
type Catalog struct {
Agents []ResolvedAgent
Problems []Problem
}
Catalog contains all successfully resolved agents plus non-fatal per-agent problems.
type ExecutionContext ¶
type ExecutionContext struct {
Agent ResolvedAgent
Catalog Catalog
BaseRuntime NestedBaseRuntime
}
ExecutionContext captures the resolved reusable-agent inputs needed by the execution pipeline after runtime precedence has been applied.
func ResolveExecutionContext ¶
func ResolveExecutionContext(ctx context.Context, cfg *model.RuntimeConfig) (*ExecutionContext, error)
ResolveExecutionContext resolves the selected reusable agent, applies its runtime defaults using the documented precedence rules, and returns the reusable prompt-assembly context. When no agent is selected, it returns nil.
func (*ExecutionContext) SystemPrompt ¶
func (c *ExecutionContext) SystemPrompt(baseSystemPrompt string) string
SystemPrompt assembles the canonical system prompt for a selected reusable agent. When no execution context is present, it preserves the existing base system prompt unchanged.
type NestedBaseRuntime ¶
type NestedBaseRuntime struct {
WorkspaceRoot string `json:"workspace_root,omitempty"`
IDE string `json:"ide,omitempty"`
Model string `json:"model,omitempty"`
AddDirs []string `json:"add_dirs,omitempty"`
ReasoningEffort string `json:"reasoning_effort,omitempty"`
AccessMode string `json:"access_mode,omitempty"`
ExplicitRuntime model.ExplicitRuntimeFlags `json:"explicit_runtime,omitempty"`
Timeout time.Duration `json:"timeout,omitempty"`
MaxRetries int `json:"max_retries,omitempty"`
RetryBackoffMultiplier float64 `json:"retry_backoff_multiplier,omitempty"`
}
NestedBaseRuntime captures the pre-agent runtime defaults that child-agent resolution must inherit from the parent host, without leaking prompt input.
func (NestedBaseRuntime) RuntimeConfig ¶
func (r NestedBaseRuntime) RuntimeConfig() model.RuntimeConfig
RuntimeConfig materializes the child-runtime base config used before agent defaults are applied during nested execution.
type NestedExecutionContext ¶
type NestedExecutionContext struct {
Depth int `json:"depth"`
MaxDepth int `json:"max_depth"`
ParentRunID string `json:"parent_run_id,omitempty"`
ParentAgentName string `json:"parent_agent_name,omitempty"`
ParentAccessMode string `json:"parent_access_mode,omitempty"`
AgentPath []string `json:"agent_path,omitempty"`
}
NestedExecutionContext is the host-owned recursion state propagated to the reserved `productize` MCP server. Tool callers do not control these values.
type Option ¶
type Option func(*Registry)
Option configures a Registry.
func WithHomeDir ¶
WithHomeDir overrides how the registry resolves the global agent root.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry discovers, parses, validates, and resolves reusable agents.
type ReservedServerRuntimeContext ¶
type ReservedServerRuntimeContext struct {
BaseRuntime NestedBaseRuntime `json:"base_runtime"`
Nested NestedExecutionContext `json:"nested"`
}
ReservedServerRuntimeContext is serialized into the reserved server environment so future nested tool calls can recreate the child host context.
type ResolvedAgent ¶
type ResolvedAgent struct {
Name string
Metadata Metadata
Runtime RuntimeDefaults
Prompt string
Source Source
MCP *MCPConfig
}
ResolvedAgent is the canonical reusable agent definition consumed by later tasks.
type RuntimeDefaults ¶
RuntimeDefaults contains the runtime defaults declared in `AGENT.md`.
type SessionMCPContext ¶
type SessionMCPContext struct {
RunID string
ParentAgentName string
EffectiveAccessMode string
NestedDepth int
MaxNestedDepth int
AgentPath []string
ReservedServerBinary string
ReservedServerArgs []string
BaseRuntime *model.RuntimeConfig
}
SessionMCPContext describes the host-owned session metadata needed to build the merged MCP server list for one reusable-agent-backed ACP session.