task

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Description    string
	ExpectedOutput string
	Agent          *agent.Agent
	Context        []*Task
	Tools          []tools.Tool
	AsyncExecution bool
	HumanInput     bool
	Callback       callback.Callback
	OutputFile     string
	FlowNodeID     string
	// @sk-task guardrails#T1.2: guardrails validated after agent returns (AC-007)
	Guardrails          []guardrail.Guardrail
	GuardrailMaxRetries int
}

Config defines the configuration for a Task.

type Task

type Task struct {
	Config
	ID              string
	Processed       bool
	Failed          bool
	Error           error
	Output          string
	OutputCondition string
	NextPaths       map[string]string
	// @sk-task replay-system#T1.1: per-task usage and input context for checkpoint capture (AC-006)
	Usage        map[string]int    // token usage for this task execution; set before saveCheckpoint
	InputContext map[string]string // context results passed to this task; set before saveCheckpoint
}

Task represents a unit of work to be executed by an agent.

func New

func New(cfg Config) *Task

New creates a new Task with the given configuration and a unique ID.

func (*Task) Execute

func (t *Task) Execute(ctx context.Context, contextResults map[string]string) (string, error)

Execute runs the task and returns its output, handling human input and context dependencies.

func (*Task) SetNextPath

func (t *Task) SetNextPath(condition, taskID string)

SetNextPath defines a conditional transition from this task to another task by ID.

Jump to

Keyboard shortcuts

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