crew

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetOutput

func GetOutput[T any](r *Result, taskID string) (T, error)

GetOutput extracts and unmarshals a typed result from a crew execution result.

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
}

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 New

func New(cfg Config) *Crew

New creates a new Crew with the given configuration.

func (*Crew) Kickoff

func (c *Crew) Kickoff(ctx context.Context) (*Result, error)

Kickoff starts the crew's task execution using the configured process type.

func (*Crew) Resume

func (c *Crew) Resume(ctx context.Context, freshCrew *Crew, checkpointID string) (*Result, error)

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) SetStepCallback

func (c *Crew) SetStepCallback(cb callback.Callback)

SetStepCallback replaces the crew's step callback. Used by telemetry bridge.

func (*Crew) StepCallback

func (c *Crew) StepCallback() callback.Callback

StepCallback returns the crew's current step callback.

type NodeState

type NodeState struct {
	TaskID    string
	Processed bool
	Failed    bool
	Output    string
	Error     string
}

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.

type Result

type Result struct {
	Tasks map[string]*task.Task
	Usage map[string]int
}

Result contains the outputs and usage metrics from a crew execution.

Jump to

Keyboard shortcuts

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