Documentation
¶
Index ¶
- func GetOutput[T any](r *Result, taskID string) (T, error)
- type Checkpoint
- type CheckpointStore
- type Config
- type Crew
- func (c *Crew) FrameStream() <-chan stream.Frame
- func (c *Crew) InjectTask(t *task.Task) error
- func (c *Crew) IsPaused() bool
- func (c *Crew) Kickoff(ctx context.Context) (*Result, error)
- func (c *Crew) KickoffStream(ctx context.Context) (<-chan CrewStreamingOutput, error)
- func (c *Crew) Pause()
- func (c *Crew) Resume(ctx context.Context, freshCrew *Crew, checkpointID string) (*Result, error)
- func (c *Crew) ResumeExecution()
- func (c *Crew) SetStepCallback(cb callback.Callback)
- func (c *Crew) StepCallback() callback.Callback
- func (c *Crew) Train(ctx context.Context, iterations int, inputs map[string]any, trainingDir string, ...) (*TrainingReport, error)
- type CrewStreamingOutput
- type NodeState
- type ProcessType
- type Result
- type TrainingReport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Checkpoint ¶
type Checkpoint struct {
ID string
ProcessType string
Phase string
NodeStates map[string]*NodeState
OrderedTaskIDs []string // preserves task execution order for resume
CreatedAt time.Time
UpdatedAt time.Time
}
Checkpoint represents a snapshot of crew execution state.
type CheckpointStore ¶
type CheckpointStore interface {
Save(ctx context.Context, ckpt *Checkpoint) error
Load(ctx context.Context, id string) (*Checkpoint, error)
List(ctx context.Context, filter map[string]any) ([]*Checkpoint, error)
Delete(ctx context.Context, id string) error
}
CheckpointStore defines the interface for checkpoint persistence. The implementation is provided by the checkpoint package to avoid circular dependency.
type Config ¶
type Config struct {
Agents []*agent.Agent
Tasks []*task.Task
Process ProcessType
ManagerLLM llm.Client
ManagerAgent *agent.Agent
Verbose bool
MaxRPM int
MaxCycles int
StepCallback callback.Callback
CheckpointStore CheckpointStore
// @sk-task knowledge-sources#T4.1: shared knowledge sources (AC-008)
KnowledgeSources []knowledge.KnowledgeSource
FlowEdges []flow.Edge
// @sk-task output-streaming#T2.1: streaming flag (AC-001, AC-002)
Stream bool
// @sk-task unified-memory#T3.1: crew-level memory (AC-004)
Memory *memory.UnifiedMemory
}
Config defines the configuration for a Crew.
type Crew ¶
type Crew struct {
// contains filtered or unexported fields
}
Crew orchestrates a group of agents to execute a collection of tasks.
func (*Crew) FrameStream ¶ added in v0.7.0
FrameStream returns a merged frame channel from all agents. Returns nil if no agents have frame channels.
func (*Crew) InjectTask ¶ added in v0.6.0
InjectTask queues a new task for execution. Returns an error if the queue is full.
func (*Crew) KickoffStream ¶ added in v0.7.0
func (c *Crew) KickoffStream(ctx context.Context) (<-chan CrewStreamingOutput, error)
KickoffStream starts the crew's task execution and returns a channel of per-task chunks. Stream must be true in Config, otherwise KickoffStream returns an error. The channel is closed after the last task. Only sequential process is supported for streaming.
func (*Crew) Pause ¶ added in v0.6.0
func (c *Crew) Pause()
Pause suspends crew execution at the next task boundary.
func (*Crew) Resume ¶
Resume restores crew execution from a checkpoint, using a fresh crew for agents/LLMs. Completed tasks are not re-executed (matched by index position in the tasks slice); remaining tasks execute normally.
func (*Crew) ResumeExecution ¶ added in v0.6.0
func (c *Crew) ResumeExecution()
ResumeExecution continues a paused crew.
func (*Crew) SetStepCallback ¶
SetStepCallback replaces the crew's step callback. Used by telemetry bridge.
func (*Crew) StepCallback ¶
StepCallback returns the crew's current step callback.
func (*Crew) Train ¶ added in v0.4.0
func (c *Crew) Train(ctx context.Context, iterations int, inputs map[string]any, trainingDir string, feedbackFn func(iteration int, result *Result) training.Feedback, ) (*TrainingReport, error)
Train runs the crew N iterations, collects human feedback after each iteration, persists negative feedback (Rating < 0), and consolidates advice per agent after all iterations. Only sequential process is supported; other processes return ErrInvalidProcess.
type CrewStreamingOutput ¶ added in v0.7.0
type CrewStreamingOutput struct {
TaskID string
AgentRole string
Content string
IsLast bool
TokenUsage llm.Usage
Error string
}
CrewStreamingOutput is a per-task output chunk delivered in real time.
type NodeState ¶
NodeState represents the execution state of a single task or flow node within a checkpoint.
type ProcessType ¶
type ProcessType string
ProcessType defines the execution strategy for a crew.
const ( ProcessSequential ProcessType = "sequential" ProcessHierarchical ProcessType = "hierarchical" ProcessConsensual ProcessType = "consensual" ProcessReflective ProcessType = "reflective" ProcessFlow ProcessType = "flow" ProcessStateMachine ProcessType = "state_machine" )
Supported crew process types.