Documentation
¶
Index ¶
Constants ¶
const ( PriorityHigh = kernel.PriorityHigh PriorityNormal = kernel.PriorityNormal PriorityLow = kernel.PriorityLow )
Variables ¶
This section is empty.
Functions ¶
func ParsePriority ¶
ParsePriority converts a priority string to a kernel.Priority value.
Types ¶
type AgentLoaderFunc ¶
AgentLoaderFunc loads an agent definition by name.
type AgentSpec ¶
type AgentSpec struct {
Intent string `yaml:"intent"`
Agent string `yaml:"agent,omitempty"`
Model string `yaml:"model,omitempty"`
Provider string `yaml:"provider,omitempty"`
Skills []string `yaml:"skills,omitempty"`
Priority string `yaml:"priority,omitempty"`
ContextBudget int `yaml:"context_budget,omitempty"`
TimeoutMs int64 `yaml:"timeout_ms,omitempty"`
DependsOn map[string]string `yaml:"depends_on,omitempty"`
SLA *kernel.SLASpec `yaml:"sla,omitempty"`
Candidates []string `yaml:"candidates,omitempty"` // candidate agents for auto-selection (Story 21.3)
}
AgentSpec defines a single agent in the compose workflow.
type ComposeExitStatus ¶
ComposeExitStatus records a process exit status for compose.
type ComposeSpawnOpts ¶
type ComposeSpawnOpts struct {
Model string
Provider string
SystemPrompt string
ParentPID types.PID
ContextBudget int
TimeoutMs int64
TraceID types.TraceID
ParentSpanID types.SpanID
}
ComposeSpawnOpts contains spawn options for the compose engine.
type ComposeSpec ¶
type ComposeSpec struct {
Version string `yaml:"version"`
Intent string `yaml:"intent"`
Model string `yaml:"model,omitempty"`
Provider string `yaml:"provider,omitempty"`
TokenBudget int `yaml:"token_budget,omitempty"`
Agents map[string]*AgentSpec `yaml:"agents"`
}
ComposeSpec is the top-level structure of rnix-compose.yaml.
func ParseBytes ¶
func ParseBytes(data []byte) (*ComposeSpec, error)
ParseBytes parses rnix-compose.yaml content from bytes.
func ParseFile ¶
func ParseFile(path string) (*ComposeSpec, error)
ParseFile reads and parses a rnix-compose.yaml file from the given path.
type DAG ¶
DAG represents the directed acyclic graph of agent dependencies.
func BuildDAG ¶
func BuildDAG(spec *ComposeSpec) (*DAG, error)
BuildDAG constructs a DAG from a ComposeSpec, detecting cycles.
func (*DAG) DetectCycle ¶
DetectCycle uses DFS three-color marking to detect cycles. Returns the cycle path and error if a cycle is found, or (nil, nil) if acyclic.
func (*DAG) TopologicalSort ¶
TopologicalSort returns layers of nodes that can be executed in parallel. Uses Kahn's algorithm (BFS with in-degree counting).
type DAGNode ¶
type DAGNode struct {
Name string
Spec *AgentSpec
DependsOn []string // upstream dependency agent names
DependedBy []string // downstream agents that depend on this node
}
DAGNode represents a single node in the DAG.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine orchestrates multi-agent workflows based on a ComposeSpec.
func NewEngine ¶
func NewEngine(spec *ComposeSpec, ks KernelSpawner, al AgentLoaderFunc) (*Engine, error)
NewEngine creates a new compose engine, building the DAG and detecting cycles.
func NewEngineWithReputation ¶
func NewEngineWithReputation(spec *ComposeSpec, ks KernelSpawner, al AgentLoaderFunc, rs *kernel.ReputationStore) (*Engine, error)
NewEngineWithReputation creates a compose engine with an optional ReputationStore for persisting SLA evaluation results.
func (*Engine) Execute ¶
func (e *Engine) Execute(ctx context.Context) ([]ScheduleResult, error)
Execute runs all agents in topological order, parallelizing within layers.
func (*Engine) SetSynergyMatrix ¶
func (e *Engine) SetSynergyMatrix(m *kernel.SynergyMatrix)
SetSynergyMatrix sets the synergy matrix for recording skill combination results (Story 21.5).
type KernelSpawner ¶
type KernelSpawner interface {
Spawn(intent string, agent *agents.AgentInfo, opts ComposeSpawnOpts) (types.PID, error)
Wait(pid types.PID) (ComposeExitStatus, error)
GetProcessResult(pid types.PID) (string, bool)
// GetSpanID returns the SpanID for a completed process (for trace parent-child, Story 15.1).
// Returns false if the process has no SpanID or is unknown.
GetSpanID(pid types.PID) (types.SpanID, bool)
// GetTokensUsed returns the token consumption for a completed process (Story 21.1).
// Returns false if the process is unknown or has no token data.
GetTokensUsed(pid types.PID) (int, bool)
}
KernelSpawner defines the kernel operations needed by the compose engine.