Documentation
¶
Overview ¶
Package yamlconfig parses DraftCrew YAML configuration files into Go structs.
Package yamlconfig parses DraftCrew YAML and JSONC configuration files into Go structs.
Index ¶
- func AutoDetect(dir string) (string, error)
- func ResolveInputs(cfg *CrewConfig, cliFlags map[string]string, stdin io.Reader) map[string]string
- func SubstitutePlaceholders(cfg *CrewConfig, inputs map[string]string)
- func ToCrewConfig(cfg *CrewConfig) (*crew.Config, *MCPSetup, *EvalConfig, error)
- func ValidateKnowledgeStorage(cfg *KnowledgeStorageConfig) error
- type AgentConfig
- type CrewConfig
- func Parse(data []byte) (*CrewConfig, error)
- func ParseDir(dir string) (*CrewConfig, error)
- func ParseFile(path string) (*CrewConfig, error)
- func ParseFiles(paths ...string) (*CrewConfig, error)
- func ParseJSONC(data []byte) (*CrewConfig, error)
- func ParseJSONCDir(dir string) (*CrewConfig, error)
- func ParseJSONCFile(path string) (*CrewConfig, error)
- type EvalConfig
- type EvalCriterionConfig
- type FlowEdgeConditionConfig
- type FlowEdgeConfig
- type KnowledgeConfig
- type KnowledgeStorageConfig
- type LLMConfig
- type MCPServerConfig
- type MCPSetup
- type TaskConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AutoDetect ¶ added in v0.8.0
@sk-task jsonc-config-format#T3.3: implement AutoDetect (AC-004, AC-005, AC-006, AC-007) AutoDetect detects the config format in a directory.
func ResolveInputs ¶ added in v0.8.0
@sk-task jsonc-config-format#T3.3: implement ResolveInputs (AC-010) ResolveInputs resolves placeholder variables using CLI flags, env vars, then interactive prompt. Order: cliFlags > env DRAFTCREW_<KEY> > stdin prompt > inputs default.
func SubstitutePlaceholders ¶ added in v0.8.0
func SubstitutePlaceholders(cfg *CrewConfig, inputs map[string]string)
@sk-task jsonc-config-format#T3.3: implement SubstitutePlaceholders (AC-010) SubstitutePlaceholders replaces {variable} patterns in all agent and task string fields.
func ToCrewConfig ¶
func ToCrewConfig(cfg *CrewConfig) (*crew.Config, *MCPSetup, *EvalConfig, error)
ToCrewConfig converts a parsed CrewConfig into runtime types. Returns crew.Config, optional MCPSetup, optional EvalConfig, and error.
func ValidateKnowledgeStorage ¶ added in v0.9.0
func ValidateKnowledgeStorage(cfg *KnowledgeStorageConfig) error
ValidateKnowledgeStorage validates the knowledge storage config block. Returns nil when backend is empty, "memory", or absent (default in-memory).
Types ¶
type AgentConfig ¶
type AgentConfig struct {
Role string `yaml:"role"`
Goal string `yaml:"goal"`
Backstory string `yaml:"backstory,omitempty"`
LLM *LLMConfig `yaml:"llm,omitempty"`
Tools []string `yaml:"tools,omitempty"`
MaxIter int `yaml:"max_iter,omitempty"`
AllowDelegation bool `yaml:"allow_delegation,omitempty"`
Skills []string `yaml:"skills,omitempty"`
// @sk-task planner#T4.1: agent-level planning config (AC-010)
Planning bool `yaml:"planning,omitempty" json:"planning,omitempty"`
PlanningLLM *LLMConfig `yaml:"planning_llm,omitempty" json:"planning_llm,omitempty"`
}
AgentConfig describes an agent in YAML.
type CrewConfig ¶
type CrewConfig struct {
SchemaVersion string `yaml:"schema_version,omitempty" json:"schema_version,omitempty"`
LLM *LLMConfig `yaml:"llm,omitempty" json:"llm,omitempty"`
Agents []AgentConfig `yaml:"agents" json:"agents"`
Tasks []TaskConfig `yaml:"tasks" json:"tasks"`
Process string `yaml:"process" json:"process"`
MCPServers []MCPServerConfig `yaml:"mcp_servers,omitempty" json:"mcp_servers,omitempty"`
Eval *EvalConfig `yaml:"eval,omitempty" json:"eval,omitempty"`
FlowEdges []FlowEdgeConfig `yaml:"flow_edges,omitempty" json:"flow_edges,omitempty"`
// @sk-task jsonc-config-format#T1.1: add Inputs field for placeholder variable definitions (AC-001, AC-010)
Inputs map[string]string `yaml:"inputs,omitempty" json:"inputs,omitempty"`
Skills []string `yaml:"skills,omitempty" json:"skills,omitempty"`
// @sk-task planner#T4.1: crew-level planning config (AC-010, AC-011)
Planning bool `yaml:"planning,omitempty" json:"planning,omitempty"`
PlanningLLM *LLMConfig `yaml:"planning_llm,omitempty" json:"planning_llm,omitempty"`
// @sk-task storage-backends#T4.1: knowledge storage config (AC-011)
Knowledge *KnowledgeConfig `yaml:"knowledge,omitempty" json:"knowledge,omitempty"`
}
CrewConfig represents the root structure of a crew.yaml file.
func Parse ¶
func Parse(data []byte) (*CrewConfig, error)
Parse unmarshals YAML data into a CrewConfig.
func ParseDir ¶
func ParseDir(dir string) (*CrewConfig, error)
ParseDir reads all YAML files from a directory and merges them.
func ParseFile ¶
func ParseFile(path string) (*CrewConfig, error)
ParseFile reads and parses a single YAML file.
func ParseFiles ¶
func ParseFiles(paths ...string) (*CrewConfig, error)
ParseFiles parses and merges multiple YAML files.
func ParseJSONC ¶ added in v0.8.0
func ParseJSONC(data []byte) (*CrewConfig, error)
@sk-task jsonc-config-format#T2.1: implement ParseJSONC (AC-001, AC-002, AC-003) ParseJSONC parses a JSONC byte slice into a CrewConfig struct.
func ParseJSONCDir ¶ added in v0.8.0
func ParseJSONCDir(dir string) (*CrewConfig, error)
@sk-task jsonc-config-format#T3.1: implement ParseJSONCDir with split layout (AC-008) ParseJSONCDir parses a directory with crew.jsonc + optional agents/*.jsonc + tasks/*.jsonc.
func ParseJSONCFile ¶ added in v0.8.0
func ParseJSONCFile(path string) (*CrewConfig, error)
@sk-task jsonc-config-format#T2.1: implement ParseJSONCFile (AC-001, AC-002, AC-003) ParseJSONCFile reads and parses a JSONC file into a CrewConfig struct.
type EvalConfig ¶
type EvalConfig struct {
Criteria []EvalCriterionConfig `yaml:"criteria,omitempty"`
}
EvalConfig describes eval criteria in YAML.
type EvalCriterionConfig ¶
type EvalCriterionConfig struct {
Type string `yaml:"type"`
Value string `yaml:"value,omitempty"`
Prompt string `yaml:"prompt,omitempty"`
Task string `yaml:"task,omitempty"`
}
EvalCriterionConfig describes a single eval criterion.
type FlowEdgeConditionConfig ¶ added in v0.6.0
type FlowEdgeConditionConfig struct {
Field string `yaml:"field"`
Operator string `yaml:"operator"`
Value string `yaml:"value"`
}
FlowEdgeConditionConfig describes a condition for a flow edge in YAML.
type FlowEdgeConfig ¶ added in v0.6.0
type FlowEdgeConfig struct {
From string `yaml:"from"`
To string `yaml:"to"`
Condition *FlowEdgeConditionConfig `yaml:"condition,omitempty"`
}
FlowEdgeConfig describes a flow edge in YAML.
type KnowledgeConfig ¶ added in v0.9.0
type KnowledgeConfig struct {
Storage *KnowledgeStorageConfig `yaml:"storage,omitempty" json:"storage,omitempty"`
}
KnowledgeConfig describes the knowledge block in YAML.
type KnowledgeStorageConfig ¶ added in v0.9.0
type KnowledgeStorageConfig struct {
Backend string `yaml:"backend" json:"backend"`
URL string `yaml:"url,omitempty" json:"url,omitempty"`
APIKey string `yaml:"api_key,omitempty" json:"api_key,omitempty"`
Collection string `yaml:"collection,omitempty" json:"collection,omitempty"`
}
KnowledgeStorageConfig describes a knowledge storage backend in YAML.
type LLMConfig ¶
type LLMConfig struct {
Provider string `yaml:"provider"`
Model string `yaml:"model,omitempty"`
APIKey string `yaml:"api_key"`
BaseURL string `yaml:"base_url,omitempty"`
Temperature float64 `yaml:"temperature,omitempty"`
Region string `yaml:"region,omitempty"` // Bedrock
ProjectID string `yaml:"project_id,omitempty"` // Vertex AI
Location string `yaml:"location,omitempty"` // Vertex AI
}
LLMConfig describes an LLM provider configuration in YAML.
type MCPServerConfig ¶
type MCPServerConfig struct {
Transport string `yaml:"transport"`
Command string `yaml:"command,omitempty"`
Args []string `yaml:"args,omitempty"`
URL string `yaml:"url,omitempty"`
}
MCPServerConfig describes an MCP server connection in YAML.
type MCPSetup ¶
type MCPSetup struct {
Servers []MCPServerConfig
}
MCPSetup holds the parsed MCP server configurations for the CLI.
type TaskConfig ¶
type TaskConfig struct {
Description string `yaml:"description"`
Agent string `yaml:"agent"`
Context []string `yaml:"context,omitempty"`
ExpectedOutput string `yaml:"expected_output,omitempty" json:"expected_output,omitempty"`
FlowNodeID string `yaml:"flow_node_id,omitempty"`
}
TaskConfig describes a task in YAML.