local

package
v0.5.0 Latest Latest
Warning

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

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

Documentation

Overview

Package local provides an embedded local mode for running agents in-process with filesystem access. This enables CLI assistants like Gemini CLI and Codex that lack native sub-agents to leverage multi-agent orchestration via MCP.

Package local provides an embedded local mode for running agents in-process.

Package local provides an embedded local mode for running agents in-process.

Package local provides an embedded local mode for running agents in-process.

Package local provides an embedded local mode for running agents in-process.

Package local provides an embedded local mode for running agents in-process.

Package local provides an embedded local mode for running agents in-process.

Package local provides an embedded local mode for running agents in-process.

Package local provides an embedded local mode for running agents in-process.

Package local provides an embedded local mode for running agents in-process.

Index

Constants

This section is empty.

Variables

CanonicalModelMap maps multi-agent-spec canonical model names to provider-specific model IDs. Canonical models: haiku, sonnet, opus

View Source
var CanonicalToolMap = map[string]string{
	"Read":      "read",
	"Write":     "write",
	"Edit":      "write",
	"Glob":      "glob",
	"Grep":      "grep",
	"Bash":      "shell",
	"WebSearch": "shell",
	"WebFetch":  "shell",
	"Task":      "",
}

CanonicalToolMap maps multi-agent-spec canonical tool names to AgentKit local tool names. Canonical tools are defined in: https://github.com/plexusone/multi-agent-spec

View Source
var CommonCLITools = map[string]string{
	"gh":            "GitHub CLI - https://cli.github.com/ or `brew install gh`",
	"git":           "Git - https://git-scm.com/ or `brew install git`",
	"go":            "Go - https://go.dev/dl/ or `brew install go`",
	"node":          "Node.js - https://nodejs.org/ or `brew install node`",
	"npm":           "npm - included with Node.js",
	"jq":            "jq - https://jqlang.github.io/jq/ or `brew install jq`",
	"curl":          "curl - https://curl.se/ or `brew install curl`",
	"docker":        "Docker - https://docs.docker.com/get-docker/",
	"kubectl":       "kubectl - https://kubernetes.io/docs/tasks/tools/",
	"aws":           "AWS CLI - https://aws.amazon.com/cli/ or `brew install awscli`",
	"gcloud":        "Google Cloud SDK - https://cloud.google.com/sdk/docs/install",
	"terraform":     "Terraform - https://www.terraform.io/downloads or `brew install terraform`",
	"golangci-lint": "golangci-lint - https://golangci-lint.run/usage/install/ or `brew install golangci-lint`",
	"schangelog":    "schangelog - https://github.com/grokify/structured-changelog",
	"gocoverbadge":  "gocoverbadge - `go install github.com/grokify/gocoverbadge@latest`",
}

CommonCLITools maps common tool names to installation hints.

View Source
var ErrHITLRequired = errors.New("human-in-the-loop input required")

ErrHITLRequired is returned when an agent needs human input to proceed.

Functions

func BuildDAG

func BuildDAG(workflow *WorkflowSpec) map[string][]string

BuildDAG creates a dependency graph from workflow steps. Returns a map of step name to list of dependent step names (steps that depend on this step).

func DefaultStateDir

func DefaultStateDir() string

DefaultStateDir returns the default state directory path. This is .agent-state in the current working directory.

func GetCanonicalModelForProvider

func GetCanonicalModelForProvider(provider omnillm.ProviderName) map[string]string

GetCanonicalModelForProvider returns all canonical model mappings for a specific provider.

func GetInstallHint

func GetInstallHint(cli string) string

GetInstallHint returns installation instructions for a CLI tool.

func GetRootSteps

func GetRootSteps(workflow *WorkflowSpec) []string

GetRootSteps returns steps with no dependencies (entry points).

func IsCanonicalModel

func IsCanonicalModel(model string) bool

IsCanonicalModel returns true if the model name is a canonical model (haiku, sonnet, opus).

func IsHITLError

func IsHITLError(err error) bool

IsHITLError checks if an error is an HITL request.

func LoadFromSpec

func LoadFromSpec(specDir string, llmCfg LLMConfig) (*Config, *TeamSpec, error)

LoadFromSpec loads configuration from multi-agent-spec files. It expects a team.json file and an agents/ directory with agent definitions.

func MapCanonicalModel

func MapCanonicalModel(canonical string, provider omnillm.ProviderName) string

MapCanonicalModel converts a multi-agent-spec canonical model name to a provider-specific model ID. If the model is not a canonical name (haiku, sonnet, opus), it is returned as-is. If the provider is not found in the mapping, the canonical name is returned.

func MapCanonicalTools

func MapCanonicalTools(canonical []string) []string

MapCanonicalTools converts multi-agent-spec canonical tool names to AgentKit local tool names. Unknown tools are skipped. Empty mappings (like "Task") are also skipped.

func ProviderNameFromString

func ProviderNameFromString(name string) omnillm.ProviderName

ProviderNameFromString converts a string provider name to omnillm.ProviderName. Returns the input as ProviderName if not recognized (allows custom providers).

func TopologicalSort

func TopologicalSort(workflow *WorkflowSpec) ([]string, error)

TopologicalSort returns steps in execution order respecting dependencies. Returns an error if there are circular dependencies.

func WorkspaceStateDir

func WorkspaceStateDir(workspace string) string

WorkspaceStateDir returns the state directory for a workspace. This is .agent-state within the workspace directory.

Types

type AgentConfig

type AgentConfig struct {
	// Name is the unique identifier for the agent.
	Name string `yaml:"name" json:"name"`

	// Description explains when to use this agent.
	Description string `yaml:"description" json:"description"`

	// Instructions is the system prompt or path to a markdown file.
	Instructions string `yaml:"instructions" json:"instructions"`

	// Tools lists the tools available to this agent.
	// Available: read, write, glob, grep, shell
	Tools []string `yaml:"tools" json:"tools"`

	// Model overrides the default LLM model for this agent.
	Model string `yaml:"model,omitempty" json:"model,omitempty"`

	// MaxTokens limits the response length.
	MaxTokens int `yaml:"max_tokens,omitempty" json:"max_tokens,omitempty"`
}

AgentConfig defines a single agent.

type AgentInfo

type AgentInfo struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

AgentInfo holds basic information about an agent.

type AgentResult

type AgentResult struct {
	Agent   string `json:"agent"`
	Input   string `json:"input"`
	Output  string `json:"output"`
	Success bool   `json:"success"`
	Error   string `json:"error,omitempty"`
}

AgentResult holds the result of an agent invocation.

type AgentResultReport

type AgentResultReport struct {
	// Schema is the JSON Schema reference for validation.
	Schema string `json:"$schema,omitempty"`

	// AgentID is the agent identifier.
	AgentID string `json:"agent_id"`

	// StepID is the workflow step identifier.
	StepID string `json:"step_id"`

	// Inputs contains values received from upstream agents.
	Inputs map[string]any `json:"inputs,omitempty"`

	// Outputs contains values produced for downstream agents.
	Outputs map[string]any `json:"outputs,omitempty"`

	// Checks contains individual validation checks.
	Checks []CheckResult `json:"checks"`

	// Status is the overall status for this agent.
	Status ReportStatus `json:"status"`

	// ExecutedAt is when the agent completed execution.
	ExecutedAt time.Time `json:"executed_at"`

	// AgentModel is the LLM model used.
	AgentModel string `json:"agent_model,omitempty"`

	// Duration is the execution duration.
	Duration string `json:"duration,omitempty"`

	// Error is the error message if the agent failed.
	Error string `json:"error,omitempty"`
}

AgentResult represents individual agent validation output. See: https://github.com/plexusone/multi-agent-spec/blob/main/schema/report/agent-result.schema.json

func BuildAgentResult

func BuildAgentResult(stepResult *StepResult, stepSpec *StepSpec, model string) *AgentResultReport

BuildAgentResult creates an agent result report from a step result.

func (*AgentResultReport) ToJSON

func (r *AgentResultReport) ToJSON() ([]byte, error)

ToJSON serializes the agent result to JSON.

type AgentSpec

type AgentSpec struct {
	// Name is the unique identifier for the agent.
	Name string `json:"name"`

	// Description explains the agent's purpose and capabilities.
	Description string `json:"description"`

	// Model is the model capability tier: "haiku", "sonnet", "opus".
	Model string `json:"model,omitempty"`

	// Tools lists the canonical tools the agent can use.
	Tools []string `json:"tools,omitempty"`

	// Skills lists the skills the agent can invoke.
	Skills []string `json:"skills,omitempty"`

	// Dependencies lists other agents this agent depends on.
	Dependencies []string `json:"dependencies,omitempty"`

	// Requires lists external tools or binaries required.
	Requires []string `json:"requires,omitempty"`

	// Credentials defines secrets/credentials the agent needs.
	// Values can be omnivault URIs (env://VAR, op://vault/item, aws-sm://secret).
	Credentials map[string]CredentialSpec `json:"credentials,omitempty"`

	// Instructions is the system prompt for the agent.
	Instructions string `json:"instructions,omitempty"`

	// Tasks defines tasks this agent can perform.
	Tasks []TaskSpec `json:"tasks,omitempty"`
}

AgentSpec represents a multi-agent-spec agent definition. See: https://github.com/plexusone/multi-agent-spec/blob/main/schema/agent/agent.schema.json

func LoadAgentSpec

func LoadAgentSpec(path string) (*AgentSpec, error)

LoadAgentSpec loads an agent specification from a JSON or Markdown file. Markdown files must have YAML frontmatter with agent metadata.

type AgentTask

type AgentTask struct {
	Agent string `json:"agent"`
	Input string `json:"input"`
}

AgentTask represents a task to be executed by an agent.

type CheckResult

type CheckResult struct {
	// ID is the check identifier.
	ID string `json:"id"`

	// Status is the check status.
	Status ReportStatus `json:"status"`

	// Detail contains additional information.
	Detail string `json:"detail,omitempty"`

	// Metadata contains structured data about the check.
	Metadata map[string]any `json:"metadata,omitempty"`
}

CheckResult represents the result of an individual validation check.

type CommandResult

type CommandResult struct {
	Command  string   `json:"command"`
	Args     []string `json:"args,omitempty"`
	Stdout   string   `json:"stdout"`
	Stderr   string   `json:"stderr"`
	ExitCode int      `json:"exit_code"`
}

CommandResult holds the result of a command execution.

func (*CommandResult) Success

func (r *CommandResult) Success() bool

Success returns true if the command exited successfully.

type CompletionResponse

type CompletionResponse struct {
	Content   string     `json:"content"`
	ToolCalls []ToolCall `json:"tool_calls,omitempty"`
	Done      bool       `json:"done"`
}

CompletionResponse holds the LLM response.

type Config

type Config struct {
	// Mode should be "local" for embedded mode.
	Mode string `yaml:"mode" json:"mode"`

	// Workspace is the root directory for filesystem access.
	// Defaults to current working directory.
	Workspace string `yaml:"workspace" json:"workspace"`

	// Agents defines the available agents.
	Agents []AgentConfig `yaml:"agents" json:"agents"`

	// MCP configures the MCP server interface.
	MCP MCPConfig `yaml:"mcp" json:"mcp"`

	// LLM configures the language model.
	LLM LLMConfig `yaml:"llm" json:"llm"`

	// Timeouts for various operations.
	Timeouts TimeoutConfig `yaml:"timeouts" json:"timeouts"`
}

Config holds configuration for local embedded mode.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns a configuration with sensible defaults.

func LoadConfig

func LoadConfig(path string) (*Config, error)

LoadConfig loads configuration from a JSON or YAML file. The format is detected by file extension (.json, .yaml, .yml).

func LoadConfigFromBytes

func LoadConfigFromBytes(data []byte, format ConfigFormat) (*Config, error)

LoadConfigFromBytes loads configuration from bytes with explicit format.

func (*Config) GetAgentConfig

func (c *Config) GetAgentConfig(name string) (*AgentConfig, error)

GetAgentConfig returns the configuration for a specific agent.

func (*Config) ListAgentNames

func (c *Config) ListAgentNames() []string

ListAgentNames returns the names of all configured agents.

func (*Config) Validate

func (c *Config) Validate() error

Validate checks that the configuration is valid.

type ConfigFormat

type ConfigFormat string

ConfigFormat specifies the configuration file format.

const (
	// FormatJSON indicates JSON format.
	FormatJSON ConfigFormat = "json"
	// FormatYAML indicates YAML format.
	FormatYAML ConfigFormat = "yaml"
)

type CredentialSpec

type CredentialSpec struct {
	// Description explains what this credential is for.
	Description string `json:"description,omitempty"`

	// Required indicates if this credential must be present.
	Required bool `json:"required,omitempty"`

	// Source is the omnivault URI (env://VAR, op://vault/item, aws-sm://secret).
	Source string `json:"source"`
}

CredentialSpec defines a credential requirement. Can be unmarshaled from either a string (URI) or an object.

func (*CredentialSpec) UnmarshalJSON

func (c *CredentialSpec) UnmarshalJSON(data []byte) error

UnmarshalJSON allows CredentialSpec to be either a string or object.

type DAGExecutor

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

DAGExecutor executes workflows based on dependency graphs.

func NewDAGExecutor

func NewDAGExecutor(agents map[string]*EmbeddedAgent, stateBackend StateBackend) *DAGExecutor

NewDAGExecutor creates a new DAG executor.

func (*DAGExecutor) ExecuteWorkflow

func (e *DAGExecutor) ExecuteWorkflow(ctx context.Context, team *TeamSpec, input string) (*WorkflowResult, error)

ExecuteWorkflow executes a workflow according to its type.

func (*DAGExecutor) ResumeWorkflow

func (e *DAGExecutor) ResumeWorkflow(ctx context.Context, runID string, team *TeamSpec) (*WorkflowResult, error)

ResumeWorkflow resumes a previously saved workflow execution.

func (*DAGExecutor) SetHITLHandler

func (e *DAGExecutor) SetHITLHandler(handler HITLHandler)

SetHITLHandler sets the handler for human-in-the-loop requests. If not set, HITL requests cause the workflow to pause and wait for resume.

func (*DAGExecutor) SetMaxConcurrency

func (e *DAGExecutor) SetMaxConcurrency(n int)

SetMaxConcurrency sets the maximum number of concurrent steps.

type Duration

type Duration time.Duration

Duration is a time.Duration that supports human-readable strings in JSON/YAML. Examples: "5m", "30s", "2h30m", "100ms"

func (Duration) Duration

func (d Duration) Duration() time.Duration

Duration returns the time.Duration value.

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler for Duration.

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler for Duration.

func (*Duration) UnmarshalYAML

func (d *Duration) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler for Duration.

type EmbeddedAgent

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

EmbeddedAgent is a lightweight agent that runs in-process.

func NewEmbeddedAgent

func NewEmbeddedAgent(cfg AgentConfig, toolSet *ToolSet, llm LLMClient) (*EmbeddedAgent, error)

NewEmbeddedAgent creates a new embedded agent.

func (*EmbeddedAgent) Description

func (a *EmbeddedAgent) Description() string

Description returns the agent's description.

func (*EmbeddedAgent) Invoke

func (a *EmbeddedAgent) Invoke(ctx context.Context, input string) (*AgentResult, error)

Invoke runs the agent with the given input and returns the result.

func (*EmbeddedAgent) Name

func (a *EmbeddedAgent) Name() string

Name returns the agent's name.

type ExecutionState

type ExecutionState struct {
	// RunID is the unique identifier for this execution run.
	RunID string `json:"run_id"`

	// WorkflowID identifies the workflow being executed.
	WorkflowID string `json:"workflow_id"`

	// Status is the overall execution status.
	Status ExecutionStatus `json:"status"`

	// Steps contains the state of each step in the workflow.
	Steps map[string]*StepState `json:"steps"`

	// Context holds shared data across steps (e.g., accumulated results).
	Context map[string]any `json:"context,omitempty"`

	// StartedAt is when execution began.
	StartedAt time.Time `json:"started_at"`

	// UpdatedAt is when the state was last updated.
	UpdatedAt time.Time `json:"updated_at"`

	// CompletedAt is when execution finished (success or failure).
	CompletedAt *time.Time `json:"completed_at,omitempty"`

	// Error contains error details if the execution failed.
	Error string `json:"error,omitempty"`
}

ExecutionState represents the complete state of a workflow execution.

func FromJSON

func FromJSON(data []byte) (*ExecutionState, error)

FromJSON deserializes execution state from JSON.

func NewExecutionState

func NewExecutionState(runID, workflowID string) *ExecutionState

NewExecutionState creates a new ExecutionState for a workflow run.

func (*ExecutionState) AddStep

func (s *ExecutionState) AddStep(stepID, agentName string, dependencies []string)

AddStep adds a new step to the execution state.

func (*ExecutionState) Cancel

func (s *ExecutionState) Cancel()

Cancel marks the execution as cancelled.

func (*ExecutionState) Complete

func (s *ExecutionState) Complete()

Complete marks the execution as completed.

func (*ExecutionState) Fail

func (s *ExecutionState) Fail(errMsg string)

Fail marks the execution as failed.

func (*ExecutionState) GetContext

func (s *ExecutionState) GetContext(key string) (any, bool)

GetContext retrieves a value from the execution context.

func (*ExecutionState) GetReadySteps

func (s *ExecutionState) GetReadySteps() []string

GetReadySteps returns steps that are ready to execute (pending with all dependencies completed).

func (*ExecutionState) GetWaitingHITLStep

func (s *ExecutionState) GetWaitingHITLStep() *StepState

GetWaitingHITLStep returns the step waiting for HITL, if any.

func (*ExecutionState) IsComplete

func (s *ExecutionState) IsComplete() bool

IsComplete returns true if the execution has finished (success, failure, or cancelled).

func (*ExecutionState) IsWaitingHITL

func (s *ExecutionState) IsWaitingHITL() bool

IsWaitingHITL returns true if any step is waiting for human input.

func (*ExecutionState) MarkStepCompleted

func (s *ExecutionState) MarkStepCompleted(stepID, output string)

MarkStepCompleted marks a step as completed with output.

func (*ExecutionState) MarkStepFailed

func (s *ExecutionState) MarkStepFailed(stepID, errMsg string)

MarkStepFailed marks a step as failed with an error.

func (*ExecutionState) MarkStepRunning

func (s *ExecutionState) MarkStepRunning(stepID, input string)

MarkStepRunning marks a step as running.

func (*ExecutionState) MarkStepSkipped

func (s *ExecutionState) MarkStepSkipped(stepID string)

MarkStepSkipped marks a step as skipped.

func (*ExecutionState) MarkStepWaitingHITL

func (s *ExecutionState) MarkStepWaitingHITL(stepID string, request *HITLRequest)

MarkStepWaitingHITL marks a step as waiting for human input.

func (*ExecutionState) PauseForHITL

func (s *ExecutionState) PauseForHITL()

PauseForHITL marks the execution as waiting for human input.

func (*ExecutionState) ProvideHITLResponse

func (s *ExecutionState) ProvideHITLResponse(stepID string, response *HITLResponse)

ProvideHITLResponse provides a human response to a waiting step.

func (*ExecutionState) SetContext

func (s *ExecutionState) SetContext(key string, value any)

SetContext sets a value in the execution context.

func (*ExecutionState) Start

func (s *ExecutionState) Start()

Start marks the execution as running.

func (*ExecutionState) ToJSON

func (s *ExecutionState) ToJSON() ([]byte, error)

ToJSON serializes the execution state to JSON.

type ExecutionStatus

type ExecutionStatus string

ExecutionStatus represents the status of a workflow execution.

const (
	// StatusPending indicates execution has not yet started.
	StatusPending ExecutionStatus = "pending"

	// StatusRunning indicates execution is in progress.
	StatusRunning ExecutionStatus = "running"

	// StatusCompleted indicates execution finished successfully.
	StatusCompleted ExecutionStatus = "completed"

	// StatusFailed indicates execution failed with an error.
	StatusFailed ExecutionStatus = "failed"

	// StatusCancelled indicates execution was cancelled.
	StatusCancelled ExecutionStatus = "cancelled"

	// StatusWaitingHITL indicates execution is paused waiting for human input.
	StatusWaitingHITL ExecutionStatus = "waiting_hitl"
)

type FileInfo

type FileInfo struct {
	Name  string `json:"name"`
	IsDir bool   `json:"is_dir"`
	Size  int64  `json:"size"`
}

FileInfo holds basic file information.

type FileStateBackend

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

FileStateBackend implements StateBackend using the filesystem. State is stored as JSON files in a directory structure:

<base_dir>/
  <run_id>.json

This backend is suitable for single-machine deployments and development.

func NewFileStateBackend

func NewFileStateBackend(baseDir string) (*FileStateBackend, error)

NewFileStateBackend creates a new FileStateBackend with the given base directory. If the directory doesn't exist, it will be created.

func (*FileStateBackend) DeleteState

func (b *FileStateBackend) DeleteState(ctx context.Context, runID string) error

DeleteState removes the execution state file for a given run ID.

func (*FileStateBackend) ListRuns

func (b *FileStateBackend) ListRuns(ctx context.Context, workflowID string) ([]string, error)

ListRuns returns all run IDs, optionally filtered by workflow ID. If workflowID is empty, all runs are returned.

func (*FileStateBackend) LoadState

func (b *FileStateBackend) LoadState(ctx context.Context, runID string) (*ExecutionState, error)

LoadState retrieves the execution state from a JSON file. Returns nil, nil if no state exists for the run ID.

func (*FileStateBackend) SaveState

func (b *FileStateBackend) SaveState(ctx context.Context, runID string, state *ExecutionState) error

SaveState persists the execution state to a JSON file.

type GlobTool

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

GlobTool wraps GlobFiles as a Tool interface.

func (*GlobTool) Description

func (t *GlobTool) Description() string

func (*GlobTool) Execute

func (t *GlobTool) Execute(ctx context.Context, args map[string]any) (any, error)

func (*GlobTool) Name

func (t *GlobTool) Name() string

type GrepMatch

type GrepMatch struct {
	File    string `json:"file"`
	Line    int    `json:"line"`
	Content string `json:"content"`
}

GrepMatch represents a single grep match.

type GrepTool

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

GrepTool wraps GrepFiles as a Tool interface.

func (*GrepTool) Description

func (t *GrepTool) Description() string

func (*GrepTool) Execute

func (t *GrepTool) Execute(ctx context.Context, args map[string]any) (any, error)

func (*GrepTool) Name

func (t *GrepTool) Name() string

type HITLError

type HITLError struct {
	Request *HITLRequest
}

HITLError wraps an HITL request as an error for agents to return.

func NewApprovalRequest

func NewApprovalRequest(question, context string) *HITLError

NewApprovalRequest creates an HITL error for approval requests.

func NewChoiceRequest

func NewChoiceRequest(question, context string, options []string) *HITLError

NewChoiceRequest creates an HITL error for choice requests.

func NewHITLError

func NewHITLError(requestType, question string) *HITLError

NewHITLError creates a new HITL error with a request.

func NewInputRequest

func NewInputRequest(question, context, defaultValue string) *HITLError

NewInputRequest creates an HITL error for free-form input requests.

func NewReviewRequest

func NewReviewRequest(question, content string) *HITLError

NewReviewRequest creates an HITL error for review requests.

func (*HITLError) Error

func (e *HITLError) Error() string

Error implements the error interface.

func (*HITLError) Unwrap

func (e *HITLError) Unwrap() error

Unwrap returns the underlying ErrHITLRequired error.

type HITLHandler

type HITLHandler func(runID, stepName string, request *HITLRequest) (*HITLResponse, error)

HITLHandler is a callback for handling HITL requests. Implementations can prompt the user interactively, send notifications, or save the request for later response.

type HITLRequest

type HITLRequest struct {
	// RequestType is the kind of input needed: "approval", "input", "choice", "review".
	RequestType string `json:"request_type"`

	// Question is what the agent is asking.
	Question string `json:"question"`

	// Context provides background information for the human.
	Context string `json:"context,omitempty"`

	// Options are available choices (for "choice" type).
	Options []string `json:"options,omitempty"`

	// DefaultValue is the suggested default response.
	DefaultValue string `json:"default_value,omitempty"`

	// CreatedAt is when the request was created.
	CreatedAt time.Time `json:"created_at"`
}

HITLRequest represents a human-in-the-loop request from an agent.

func GetHITLRequest

func GetHITLRequest(err error) *HITLRequest

GetHITLRequest extracts the HITL request from an error.

type HITLResponse

type HITLResponse struct {
	// Response is the human's input.
	Response string `json:"response"`

	// Approved is true for approval-type requests.
	Approved *bool `json:"approved,omitempty"`

	// SelectedOption is the chosen option index (for choice-type).
	SelectedOption *int `json:"selected_option,omitempty"`

	// RespondedAt is when the response was provided.
	RespondedAt time.Time `json:"responded_at"`
}

HITLResponse represents the human's response to a HITL request.

func DefaultHITLHandler

func DefaultHITLHandler(runID, stepName string, request *HITLRequest) (*HITLResponse, error)

DefaultHITLHandler returns nil, causing the workflow to pause. The workflow can be resumed later using the respond command.

type LLMClient

type LLMClient interface {
	// Complete generates a completion for the given messages.
	Complete(ctx context.Context, messages []Message, tools []ToolDefinition) (*CompletionResponse, error)
}

LLMClient defines the interface for language model interactions.

type LLMConfig

type LLMConfig struct {
	// Provider is the LLM provider: "openai", "anthropic", "gemini", "ollama".
	Provider string `yaml:"provider" json:"provider"`

	// Model is the default model to use.
	Model string `yaml:"model" json:"model"`

	// APIKey is the API key (can use env var reference like ${OPENAI_API_KEY}).
	APIKey string `yaml:"api_key,omitempty" json:"api_key,omitempty"` //nolint:gosec // G117: Config needs API key field

	// BaseURL overrides the API base URL.
	BaseURL string `yaml:"base_url,omitempty" json:"base_url,omitempty"`

	// Temperature controls randomness (0.0-1.0).
	Temperature float64 `yaml:"temperature,omitempty" json:"temperature,omitempty"`
}

LLMConfig configures the language model provider.

type MCPConfig

type MCPConfig struct {
	// Enabled determines if the MCP server is active.
	Enabled bool `yaml:"enabled" json:"enabled"`

	// Transport is the MCP transport type: "stdio" or "http".
	Transport string `yaml:"transport" json:"transport"`

	// Port is used when transport is "http".
	Port int `yaml:"port,omitempty" json:"port,omitempty"`

	// ServerName is the name reported in MCP server info.
	ServerName string `yaml:"server_name,omitempty" json:"server_name,omitempty"`

	// ServerVersion is the version reported in MCP server info.
	ServerVersion string `yaml:"server_version,omitempty" json:"server_version,omitempty"`
}

MCPConfig configures the MCP server interface.

type Message

type Message struct {
	Role    string `json:"role"` // "system", "user", "assistant", "tool"
	Content string `json:"content"`
	Name    string `json:"name,omitempty"`    // For tool messages
	ToolID  string `json:"tool_id,omitempty"` // For tool messages
}

Message represents a chat message.

type OmniLLMClient

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

OmniLLMClient implements LLMClient using omnillm.ChatClient.

func NewOmniLLMClient

func NewOmniLLMClient(cfg OmniLLMConfig) (*OmniLLMClient, error)

NewOmniLLMClient creates a new LLMClient backed by omnillm.

func NewOmniLLMClientFromConfig

func NewOmniLLMClientFromConfig(cfg LLMConfig) (*OmniLLMClient, error)

NewOmniLLMClientFromConfig creates an OmniLLMClient from the existing LLMConfig type.

func (*OmniLLMClient) Close

func (c *OmniLLMClient) Close() error

Close closes the underlying client.

func (*OmniLLMClient) Complete

func (c *OmniLLMClient) Complete(ctx context.Context, messages []Message, tools []ToolDefinition) (*CompletionResponse, error)

Complete generates a completion for the given messages.

func (*OmniLLMClient) Model

func (c *OmniLLMClient) Model() string

Model returns the current model ID.

func (*OmniLLMClient) Provider

func (c *OmniLLMClient) Provider() omnillm.ProviderName

Provider returns the provider name.

type OmniLLMConfig

type OmniLLMConfig struct {
	// Provider is the LLM provider name (anthropic, openai, gemini, xai, ollama).
	Provider string
	// APIKey is the API key for the provider (not needed for ollama).
	APIKey string //nolint:gosec // G117: Config needs API key field
	// Model is the model ID or canonical name (haiku, sonnet, opus).
	Model string
	// BaseURL is an optional custom base URL for the provider.
	BaseURL string
}

OmniLLMConfig holds configuration for creating an OmniLLMClient.

type OrchestratedResult

type OrchestratedResult struct {
	Task    string         `json:"task"`
	Mode    string         `json:"mode"`
	Results []*AgentResult `json:"results"`
}

OrchestratedResult holds the results of an orchestrated task.

func (*OrchestratedResult) AllSuccessful

func (r *OrchestratedResult) AllSuccessful() bool

AllSuccessful returns true if all agent results were successful.

func (*OrchestratedResult) Summary

func (r *OrchestratedResult) Summary() string

Summary returns a summary of all results.

type OrchestratedTask

type OrchestratedTask struct {
	// Name is a descriptive name for the task.
	Name string `json:"name"`

	// Agents lists the agents to involve, in order of execution for sequential,
	// or all at once for parallel.
	Agents []string `json:"agents"`

	// Input is the task description/prompt.
	Input string `json:"input"`

	// Mode is "parallel" or "sequential".
	Mode string `json:"mode"`
}

OrchestratedTask represents a high-level task that may involve multiple agents.

type PortSpec

type PortSpec struct {
	// Name is the port identifier.
	Name string `json:"name"`

	// Type is the data type: "string", "number", "boolean", "object", "array", "file".
	Type string `json:"type,omitempty"`

	// Description is a human-readable description.
	Description string `json:"description,omitempty"`

	// Required indicates if this input is required (inputs only).
	Required *bool `json:"required,omitempty"`

	// From is the source reference as "step_name.output_name" (inputs only).
	From string `json:"from,omitempty"`

	// Default is the default value if not provided (inputs only).
	Default any `json:"default,omitempty"`
}

PortSpec represents a data port (input or output).

type PrereqCheck

type PrereqCheck struct {
	// Name is the CLI tool name.
	Name string `json:"name"`

	// Found indicates if the tool was found in PATH.
	Found bool `json:"found"`

	// Path is the full path to the tool (if found).
	Path string `json:"path,omitempty"`

	// Version is the tool version (if detectable).
	Version string `json:"version,omitempty"`

	// Error is the error message if the tool was not found.
	Error string `json:"error,omitempty"`
}

PrereqCheck represents the result of checking a single prerequisite.

func CheckCLI

func CheckCLI(name string) PrereqCheck

CheckCLI checks if a CLI tool is available in PATH.

type PrereqResult

type PrereqResult struct {
	// Checks contains results for each prerequisite.
	Checks []PrereqCheck `json:"checks"`

	// AllFound is true if all prerequisites were found.
	AllFound bool `json:"all_found"`

	// Missing lists the names of missing prerequisites.
	Missing []string `json:"missing,omitempty"`
}

PrereqResult holds the results of prerequisite validation.

func CheckPrerequisites

func CheckPrerequisites(requires []string) *PrereqResult

CheckPrerequisites validates that required CLI tools are available.

func ValidateAgentPrerequisites

func ValidateAgentPrerequisites(agent *AgentSpec) *PrereqResult

ValidateAgentPrerequisites checks prerequisites for a single agent.

type ReadTool

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

ReadTool wraps ReadFile as a Tool interface.

func (*ReadTool) Description

func (t *ReadTool) Description() string

func (*ReadTool) Execute

func (t *ReadTool) Execute(ctx context.Context, args map[string]any) (any, error)

func (*ReadTool) Name

func (t *ReadTool) Name() string

type ReportBuilder

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

ReportBuilder helps construct team reports from workflow results.

func NewReportBuilder

func NewReportBuilder(project, version string) *ReportBuilder

NewReportBuilder creates a new report builder.

func (*ReportBuilder) BuildFromWorkflowResult

func (b *ReportBuilder) BuildFromWorkflowResult(result *WorkflowResult, team *TeamSpec) *TeamReport

BuildFromWorkflowResult creates a team report from a workflow result.

func (*ReportBuilder) SetGeneratedBy

func (b *ReportBuilder) SetGeneratedBy(generatedBy string) *ReportBuilder

SetGeneratedBy sets the coordinator identifier.

func (*ReportBuilder) SetPhase

func (b *ReportBuilder) SetPhase(phase string) *ReportBuilder

SetPhase sets the workflow phase.

func (*ReportBuilder) SetTarget

func (b *ReportBuilder) SetTarget(target string) *ReportBuilder

SetTarget sets the target description.

type ReportStatus

type ReportStatus string

ReportStatus represents the validation status following NASA Go/No-Go terminology.

const (
	// StatusGO indicates all checks passed.
	StatusGO ReportStatus = "GO"

	// StatusWARN indicates non-blocking issues were found.
	StatusWARN ReportStatus = "WARN"

	// StatusNOGO indicates blocking issues were found.
	StatusNOGO ReportStatus = "NO-GO"

	// StatusSKIP indicates the check was skipped.
	StatusSKIP ReportStatus = "SKIP"
)

type Runner

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

Runner orchestrates multiple embedded agents.

func NewRunner

func NewRunner(cfg *Config, llm LLMClient) (*Runner, error)

NewRunner creates a new agent runner.

func (*Runner) Close

func (r *Runner) Close() error

Close cleans up resources.

func (*Runner) ExecuteOrchestrated

func (r *Runner) ExecuteOrchestrated(ctx context.Context, task OrchestratedTask) (*OrchestratedResult, error)

ExecuteOrchestrated runs an orchestrated task involving multiple agents.

func (*Runner) GetAgent

func (r *Runner) GetAgent(name string) (*EmbeddedAgent, bool)

GetAgent returns an agent by name.

func (*Runner) GetAgentInfo

func (r *Runner) GetAgentInfo(name string) (*AgentInfo, error)

GetAgentInfo returns information about an agent.

func (*Runner) Invoke

func (r *Runner) Invoke(ctx context.Context, agentName, input string) (*AgentResult, error)

Invoke runs a single agent synchronously.

func (*Runner) InvokeParallel

func (r *Runner) InvokeParallel(ctx context.Context, tasks []AgentTask) ([]*AgentResult, error)

InvokeParallel runs multiple agents concurrently.

func (*Runner) InvokeSequential

func (r *Runner) InvokeSequential(ctx context.Context, tasks []AgentTask) ([]*AgentResult, error)

InvokeSequential runs multiple agents in sequence, passing context between them.

func (*Runner) ListAgentInfo

func (r *Runner) ListAgentInfo() []AgentInfo

ListAgentInfo returns information about all registered agents.

func (*Runner) ListAgents

func (r *Runner) ListAgents() []string

ListAgents returns the names of all registered agents.

func (*Runner) ToolSet

func (r *Runner) ToolSet() *ToolSet

ToolSet returns the tool set.

func (*Runner) Workspace

func (r *Runner) Workspace() string

Workspace returns the workspace path.

type ShellTool

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

ShellTool wraps RunShell as a Tool interface.

func (*ShellTool) Description

func (t *ShellTool) Description() string

func (*ShellTool) Execute

func (t *ShellTool) Execute(ctx context.Context, args map[string]any) (any, error)

func (*ShellTool) Name

func (t *ShellTool) Name() string

type SpecLoader

type SpecLoader struct {
	// BaseDir is the directory containing spec files.
	BaseDir string

	// AgentsDir is the directory containing agent definitions.
	// Defaults to "agents" relative to BaseDir.
	AgentsDir string

	// TeamsDir is the directory containing team definitions.
	// Defaults to same as BaseDir.
	TeamsDir string
}

SpecLoader loads multi-agent-spec configurations.

func NewSpecLoader

func NewSpecLoader(baseDir string) *SpecLoader

NewSpecLoader creates a new spec loader for the given directory. It auto-detects common directory structures.

func (*SpecLoader) LoadTeam

func (l *SpecLoader) LoadTeam(teamFile string) (*TeamSpec, map[string]*AgentSpec, error)

LoadTeam loads a team and its agents from the spec directory.

func (*SpecLoader) ToConfig

func (l *SpecLoader) ToConfig(team *TeamSpec, agents map[string]*AgentSpec, llmCfg LLMConfig) (*Config, error)

ToConfig converts multi-agent-spec to local Config format.

type StateBackend

type StateBackend interface {
	// SaveState persists the execution state for a given run ID.
	SaveState(ctx context.Context, runID string, state *ExecutionState) error

	// LoadState retrieves the execution state for a given run ID.
	// Returns nil, nil if no state exists for the run ID.
	LoadState(ctx context.Context, runID string) (*ExecutionState, error)

	// DeleteState removes the execution state for a given run ID.
	DeleteState(ctx context.Context, runID string) error

	// ListRuns returns all run IDs, optionally filtered by workflow ID.
	ListRuns(ctx context.Context, workflowID string) ([]string, error)
}

StateBackend defines the interface for persisting agent execution state. This enables resumable workflows and cross-invocation state management.

type StepResult

type StepResult struct {
	// StepID is the step identifier.
	StepID string `json:"step_id"`

	// AgentName is the agent that executed this step.
	AgentName string `json:"agent_name"`

	// Output is the step's output.
	Output string `json:"output"`

	// Error is the error message if the step failed.
	Error string `json:"error,omitempty"`

	// Duration is how long the step took to execute.
	Duration time.Duration `json:"duration"`
}

StepResult holds the result of a single step execution.

type StepSpec

type StepSpec struct {
	// Name is the step identifier (e.g., "pm-validation").
	Name string `json:"name"`

	// Agent is the agent to execute this step.
	Agent string `json:"agent"`

	// DependsOn lists steps that must complete before this step.
	DependsOn []string `json:"depends_on,omitempty"`

	// Inputs are data inputs consumed by this step.
	Inputs []PortSpec `json:"inputs,omitempty"`

	// Outputs are data outputs produced by this step.
	Outputs []PortSpec `json:"outputs,omitempty"`
}

StepSpec represents a single step in the workflow.

func GetStepByName

func GetStepByName(workflow *WorkflowSpec, name string) *StepSpec

GetStepByName finds a step by name in the workflow.

type StepState

type StepState struct {
	// StepID is the unique identifier for this step.
	StepID string `json:"step_id"`

	// AgentName is the name of the agent executing this step.
	AgentName string `json:"agent_name"`

	// Status is the step's execution status.
	Status StepStatus `json:"status"`

	// Input is the input provided to the agent.
	Input string `json:"input,omitempty"`

	// Output is the result returned by the agent.
	Output string `json:"output,omitempty"`

	// Error contains error details if the step failed.
	Error string `json:"error,omitempty"`

	// StartedAt is when the step began execution.
	StartedAt *time.Time `json:"started_at,omitempty"`

	// CompletedAt is when the step finished execution.
	CompletedAt *time.Time `json:"completed_at,omitempty"`

	// Retries is the number of retry attempts made.
	Retries int `json:"retries,omitempty"`

	// Dependencies lists step IDs this step depends on.
	Dependencies []string `json:"dependencies,omitempty"`

	// HITLRequest contains the human-in-the-loop request if waiting for input.
	HITLRequest *HITLRequest `json:"hitl_request,omitempty"`

	// HITLResponse contains the human response when provided.
	HITLResponse *HITLResponse `json:"hitl_response,omitempty"`
}

StepState represents the state of a single step in the workflow.

type StepStatus

type StepStatus string

StepStatus represents the status of a workflow step.

const (
	// StepPending indicates the step has not yet started.
	StepPending StepStatus = "pending"

	// StepBlocked indicates the step is waiting on dependencies.
	StepBlocked StepStatus = "blocked"

	// StepRunning indicates the step is currently executing.
	StepRunning StepStatus = "running"

	// StepCompleted indicates the step finished successfully.
	StepCompleted StepStatus = "completed"

	// StepFailed indicates the step failed with an error.
	StepFailed StepStatus = "failed"

	// StepSkipped indicates the step was skipped (e.g., due to conditions).
	StepSkipped StepStatus = "skipped"

	// StepWaitingHITL indicates the step is waiting for human input.
	StepWaitingHITL StepStatus = "waiting_hitl"
)

type TaskResult

type TaskResult struct {
	// ID is the task identifier.
	ID string `json:"id"`

	// Status is the task status.
	Status ReportStatus `json:"status"`

	// Detail contains additional information.
	Detail string `json:"detail,omitempty"`

	// DurationMS is the execution time in milliseconds.
	DurationMS int64 `json:"duration_ms,omitempty"`

	// Metadata contains structured data about the task execution.
	Metadata map[string]any `json:"metadata,omitempty"`
}

TaskResult represents the result of an individual task.

type TaskSpec

type TaskSpec struct {
	// ID is the unique task identifier.
	ID string `json:"id"`

	// Description explains what this task validates or accomplishes.
	Description string `json:"description"`

	// Type is how the task is executed: "command", "pattern", "file", "manual".
	Type string `json:"type,omitempty"`

	// Command is the shell command to execute (for type: command).
	Command string `json:"command,omitempty"`

	// Pattern is the regex pattern to search for (for type: pattern).
	Pattern string `json:"pattern,omitempty"`

	// File is the file path to check (for type: file).
	File string `json:"file,omitempty"`

	// Files is the glob pattern for files to check (for type: pattern).
	Files string `json:"files,omitempty"`

	// Required indicates if task failure causes agent to report NO-GO.
	Required *bool `json:"required,omitempty"`

	// ExpectedOutput describes what constitutes success.
	ExpectedOutput string `json:"expected_output,omitempty"`

	// HumanInLoop describes when to prompt for human intervention.
	HumanInLoop string `json:"human_in_loop,omitempty"`
}

TaskSpec represents a task an agent can perform.

type TeamPrereqResult

type TeamPrereqResult struct {
	// AgentResults maps agent name to its prerequisite results.
	AgentResults map[string]*PrereqResult `json:"agent_results"`

	// AllFound is true if all prerequisites for all agents were found.
	AllFound bool `json:"all_found"`

	// Missing maps agent name to list of missing CLIs.
	Missing map[string][]string `json:"missing,omitempty"`
}

TeamPrereqResult holds prerequisite results for an entire team.

func ValidateTeamPrerequisites

func ValidateTeamPrerequisites(team *TeamSpec, agents map[string]*AgentSpec) *TeamPrereqResult

ValidateTeamPrerequisites checks prerequisites for all agents in a team.

func (*TeamPrereqResult) PrintMissingWithHints

func (r *TeamPrereqResult) PrintMissingWithHints() string

PrintMissingWithHints returns missing prerequisites with installation hints.

func (*TeamPrereqResult) PrintSummary

func (r *TeamPrereqResult) PrintSummary() string

PrintSummary returns a human-readable summary of the prerequisite check.

type TeamReport

type TeamReport struct {
	// Schema is the JSON Schema reference for validation.
	Schema string `json:"$schema,omitempty"`

	// Project is the project identifier (e.g., "github.com/org/repo").
	Project string `json:"project"`

	// Version is the target release version.
	Version string `json:"version"`

	// Target is a human-readable target description.
	Target string `json:"target,omitempty"`

	// Phase is the current workflow phase.
	Phase string `json:"phase"`

	// Teams contains validation results from each agent/team.
	Teams []TeamResult `json:"teams"`

	// Status is the overall status computed from all teams.
	Status ReportStatus `json:"status"`

	// GeneratedAt is when the report was generated.
	GeneratedAt time.Time `json:"generated_at"`

	// GeneratedBy is the identifier of the coordinator.
	GeneratedBy string `json:"generated_by,omitempty"`
}

TeamReport represents an aggregated multi-agent team validation report. See: https://github.com/plexusone/multi-agent-spec/blob/main/schema/report/team-report.schema.json

func MergeReports

func MergeReports(reports []*TeamReport) *TeamReport

MergeReports merges multiple team reports into one.

func (*TeamReport) PrintSummary

func (r *TeamReport) PrintSummary() string

PrintSummary prints a human-readable summary of the team report.

func (*TeamReport) ToJSON

func (r *TeamReport) ToJSON() ([]byte, error)

ToJSON serializes the team report to JSON.

type TeamResult

type TeamResult struct {
	// ID is the workflow step identifier.
	ID string `json:"id"`

	// Name is the agent name.
	Name string `json:"name"`

	// AgentID is the agent identifier matching team.json agents list.
	AgentID string `json:"agent_id,omitempty"`

	// Model is the LLM model used by this agent.
	Model string `json:"model,omitempty"`

	// DependsOn lists IDs of upstream teams this team depends on.
	DependsOn []string `json:"depends_on,omitempty"`

	// Tasks contains individual task results.
	Tasks []TaskResult `json:"tasks"`

	// Status is the overall status for this team.
	Status ReportStatus `json:"status"`
}

TeamResult represents validation results from a single team/agent.

type TeamSpec

type TeamSpec struct {
	// Name is the team identifier (e.g., "stats-agent-team").
	Name string `json:"name"`

	// Version is the semantic version of the team definition.
	Version string `json:"version"`

	// Description is a brief description of the team's purpose.
	Description string `json:"description,omitempty"`

	// Agents lists agent names in the team (references agent definitions).
	Agents []string `json:"agents"`

	// Orchestrator is the name of the orchestrator agent (must be in agents list).
	Orchestrator string `json:"orchestrator,omitempty"`

	// Workflow defines agent coordination patterns.
	Workflow *WorkflowSpec `json:"workflow,omitempty"`

	// Context is shared context for all agents.
	Context string `json:"context,omitempty"`
}

TeamSpec represents a multi-agent-spec team definition. See: https://github.com/plexusone/multi-agent-spec/blob/main/schema/orchestration/team.schema.json

func LoadTeamSpec

func LoadTeamSpec(path string) (*TeamSpec, error)

LoadTeamSpec loads a team specification from a JSON file.

type TimeoutConfig

type TimeoutConfig struct {
	// AgentInvoke is the timeout for a single agent invocation.
	AgentInvoke Duration `yaml:"agent_invoke" json:"agent_invoke"`

	// ShellCommand is the timeout for shell command execution.
	ShellCommand Duration `yaml:"shell_command" json:"shell_command"`

	// FileRead is the timeout for file read operations.
	FileRead Duration `yaml:"file_read" json:"file_read"`

	// ParallelTotal is the total timeout for parallel agent execution.
	ParallelTotal Duration `yaml:"parallel_total" json:"parallel_total"`
}

TimeoutConfig defines timeouts for various operations.

type Tool

type Tool interface {
	Name() string
	Description() string
	Execute(ctx context.Context, args map[string]any) (any, error)
}

Tool represents a capability available to agents.

type ToolCall

type ToolCall struct {
	ID        string         `json:"id"`
	Name      string         `json:"name"`
	Arguments map[string]any `json:"arguments"`
}

ToolCall represents an LLM's request to call a tool.

type ToolDefinition

type ToolDefinition struct {
	Name        string                 `json:"name"`
	Description string                 `json:"description"`
	Parameters  map[string]interface{} `json:"parameters"`
}

ToolDefinition defines a tool for the LLM.

type ToolSet

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

ToolSet provides filesystem and shell tools scoped to a workspace.

func NewToolSet

func NewToolSet(workspace string) *ToolSet

NewToolSet creates a new tool set for the given workspace.

func (*ToolSet) CreateTools

func (ts *ToolSet) CreateTools(names []string) ([]Tool, error)

CreateTools creates Tool instances for the specified tool names.

func (*ToolSet) GlobFiles

func (ts *ToolSet) GlobFiles(ctx context.Context, pattern string) ([]string, error)

GlobFiles finds files matching a glob pattern within the workspace.

func (*ToolSet) GrepFiles

func (ts *ToolSet) GrepFiles(ctx context.Context, pattern, filePattern string) ([]GrepMatch, error)

GrepFiles searches for a pattern in files within the workspace.

func (*ToolSet) ListDirectory

func (ts *ToolSet) ListDirectory(ctx context.Context, path string) ([]FileInfo, error)

ListDirectory lists the contents of a directory within the workspace.

func (*ToolSet) ReadFile

func (ts *ToolSet) ReadFile(ctx context.Context, path string) (string, error)

ReadFile reads the contents of a file within the workspace.

func (*ToolSet) RunCommand

func (ts *ToolSet) RunCommand(ctx context.Context, command string, args []string) (*CommandResult, error)

RunCommand executes a shell command within the workspace.

func (*ToolSet) RunShell

func (ts *ToolSet) RunShell(ctx context.Context, shellCmd string) (*CommandResult, error)

RunShell executes a shell command string within the workspace.

func (*ToolSet) SetMaxFileSize

func (ts *ToolSet) SetMaxFileSize(size int64)

SetMaxFileSize sets the maximum file size for read operations.

func (*ToolSet) WriteFile

func (ts *ToolSet) WriteFile(ctx context.Context, path, content string) error

WriteFile writes content to a file within the workspace.

type WorkflowResult

type WorkflowResult struct {
	// RunID is the unique identifier for this execution.
	RunID string `json:"run_id"`

	// WorkflowID is the team/workflow name.
	WorkflowID string `json:"workflow_id"`

	// StepResults contains results for each step.
	StepResults map[string]*StepResult `json:"step_results"`

	// FinalOutput is the final output from the workflow.
	FinalOutput string `json:"final_output"`

	// State is the execution state.
	State *ExecutionState `json:"state,omitempty"`
}

WorkflowResult holds the result of a workflow execution.

type WorkflowSpec

type WorkflowSpec struct {
	// Type is the execution pattern: "sequential", "parallel", "dag", "orchestrated".
	Type string `json:"type"`

	// Steps are the ordered steps in the workflow.
	Steps []StepSpec `json:"steps,omitempty"`
}

WorkflowSpec defines the workflow execution pattern.

type WorkflowType

type WorkflowType string

WorkflowType represents the type of workflow execution.

const (
	// WorkflowSequential executes steps one after another.
	WorkflowSequential WorkflowType = "sequential"

	// WorkflowParallel executes all steps concurrently.
	WorkflowParallel WorkflowType = "parallel"

	// WorkflowDAG executes steps based on dependency graph.
	WorkflowDAG WorkflowType = "dag"

	// WorkflowOrchestrated uses an orchestrator agent to coordinate.
	WorkflowOrchestrated WorkflowType = "orchestrated"
)

func GetWorkflowType

func GetWorkflowType(team *TeamSpec) WorkflowType

GetWorkflowType returns the workflow type from a TeamSpec.

type WriteTool

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

WriteTool wraps WriteFile as a Tool interface.

func (*WriteTool) Description

func (t *WriteTool) Description() string

func (*WriteTool) Execute

func (t *WriteTool) Execute(ctx context.Context, args map[string]any) (any, error)

func (*WriteTool) Name

func (t *WriteTool) Name() string

Directories

Path Synopsis
Package generate provides code generation from multi-agent-spec to Go.
Package generate provides code generation from multi-agent-spec to Go.

Jump to

Keyboard shortcuts

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