Documentation
¶
Index ¶
- Constants
- func GenerateTaskID() string
- type AgentToolUseTracker
- type AgentType
- type ApprovalRecord
- type DefaultRunHooks
- func (h *DefaultRunHooks) OnAfterHandoff(ctx context.Context, agent AgentType, handoffAgent AgentType, ...) error
- func (h *DefaultRunHooks) OnAgentStart(ctx context.Context, agent AgentType, input interface{}) error
- func (h *DefaultRunHooks) OnBeforeHandoff(ctx context.Context, agent AgentType, handoffAgent AgentType) error
- func (h *DefaultRunHooks) OnHandoff(ctx context.Context, fromAgent AgentType, toAgent AgentType) error
- func (h *DefaultRunHooks) OnRunEnd(ctx context.Context, result *result.RunResult) error
- func (h *DefaultRunHooks) OnRunStart(ctx context.Context, agent *agent.Agent, input interface{}) error
- func (h *DefaultRunHooks) OnTurnEnd(ctx context.Context, agent *agent.Agent, turn int, result *SingleTurnResult) error
- func (h *DefaultRunHooks) OnTurnStart(ctx context.Context, agent *agent.Agent, turn int) error
- type DefaultToolUseBehavior
- type HandoffInputData
- type HandoffInputFilter
- type InputGuardrail
- type Interaction
- type ModelRequestType
- type ModelSettingsType
- type NextStep
- type NextStepFinalOutput
- type NextStepHandoff
- type NextStepInterruption
- type NextStepRunAgain
- type OutputGuardrail
- type ProcessedResponse
- type RecoveryConfig
- type RetryConfig
- type RunConfig
- type RunContext
- func (rc *RunContext) AddUsage(requests, inputTokens, outputTokens, totalTokens int)
- func (rc *RunContext) ApproveTool(toolName, callID string)
- func (rc *RunContext) IsToolApproved(toolName, callID string) bool
- func (rc *RunContext) IsToolRejected(toolName, callID string) bool
- func (rc *RunContext) RejectTool(toolName, callID string)
- type RunHooks
- type RunOptions
- type RunState
- type Runner
- func (r *Runner) Run(ctx context.Context, agent AgentType, opts *RunOptions) (*result.RunResult, error)
- func (r *Runner) RunStreaming(ctx context.Context, agent AgentType, opts *RunOptions) (*result.StreamedRunResult, error)
- func (r *Runner) RunSync(agent AgentType, opts *RunOptions) (*result.RunResult, error)
- func (r *Runner) WithDefaultMaxTurns(maxTurns int) *Runner
- func (r *Runner) WithDefaultProvider(provider model.Provider) *Runner
- type SingleTurnResult
- type StateManagementConfig
- type StopOnFirstToolBehavior
- type TaskContext
- func (t *TaskContext) AddInteraction(role string, content interface{})
- func (t *TaskContext) AddMetadata(key string, value interface{})
- func (t *TaskContext) AddRelatedTask(taskID string)
- func (t *TaskContext) Complete(result interface{})
- func (t *TaskContext) Fail(err error)
- func (t *TaskContext) GetArtifact() interface{}
- func (t *TaskContext) GetDelegationChain() string
- func (t *TaskContext) GetInteractionHistory() []Interaction
- func (t *TaskContext) GetLastInteraction() *Interaction
- func (t *TaskContext) GetMetadata(key string) interface{}
- func (t *TaskContext) GetResult() interface{}
- func (t *TaskContext) IsComplete() bool
- func (t *TaskContext) IsFailed() bool
- func (t *TaskContext) IsFinished() bool
- func (t *TaskContext) IsPending() bool
- func (t *TaskContext) SetArtifact(artifact interface{}, artifactType string)
- func (t *TaskContext) SetDescription(description string)
- func (t *TaskContext) ToJSON() (string, error)
- type TaskStatus
- type ToolResult
- type ToolRunFunction
- type ToolRunHandoff
- type ToolUseBehavior
- type TracingConfig
- type TurnResult
- type Usage
- type ValidationConfig
- type ValidationRule
- type ValidationSeverity
- type WorkflowConfig
- type WorkflowRunner
- type WorkflowState
- type WorkflowStateStore
- type WorkingContext
Constants ¶
const (
// DefaultMaxTurns is the default maximum number of turns
DefaultMaxTurns = 10
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AgentToolUseTracker ¶
type AgentToolUseTracker struct {
// contains filtered or unexported fields
}
AgentToolUseTracker tracks which tools each agent has used Similar to OpenAI's AgentToolUseTracker
func NewAgentToolUseTracker ¶
func NewAgentToolUseTracker() *AgentToolUseTracker
NewAgentToolUseTracker creates a new tool use tracker
func (*AgentToolUseTracker) AddToolUse ¶
func (t *AgentToolUseTracker) AddToolUse(agentName string, toolNames []string)
AddToolUse adds tool names to the tracker for an agent
func (*AgentToolUseTracker) HasUsedTools ¶
func (t *AgentToolUseTracker) HasUsedTools(agentName string) bool
HasUsedTools checks if an agent has used any tools
type ApprovalRecord ¶
ApprovalRecord tracks approval state for a tool call
type DefaultRunHooks ¶
type DefaultRunHooks struct{}
DefaultRunHooks provides a default implementation of RunHooks
func (*DefaultRunHooks) OnAfterHandoff ¶
func (h *DefaultRunHooks) OnAfterHandoff(ctx context.Context, agent AgentType, handoffAgent AgentType, result interface{}) error
OnAfterHandoff is called after a handoff completes
func (*DefaultRunHooks) OnAgentStart ¶
func (h *DefaultRunHooks) OnAgentStart(ctx context.Context, agent AgentType, input interface{}) error
OnAgentStart is called when an agent starts (first turn or after handoff)
func (*DefaultRunHooks) OnBeforeHandoff ¶
func (h *DefaultRunHooks) OnBeforeHandoff(ctx context.Context, agent AgentType, handoffAgent AgentType) error
OnBeforeHandoff is called before a handoff occurs (deprecated, use OnHandoff)
func (*DefaultRunHooks) OnHandoff ¶
func (h *DefaultRunHooks) OnHandoff(ctx context.Context, fromAgent AgentType, toAgent AgentType) error
OnHandoff is called when a handoff occurs
func (*DefaultRunHooks) OnRunStart ¶
func (h *DefaultRunHooks) OnRunStart(ctx context.Context, agent *agent.Agent, input interface{}) error
OnRunStart is called when the run starts
func (*DefaultRunHooks) OnTurnEnd ¶
func (h *DefaultRunHooks) OnTurnEnd(ctx context.Context, agent *agent.Agent, turn int, result *SingleTurnResult) error
OnTurnEnd is called when a turn ends
func (*DefaultRunHooks) OnTurnStart ¶
OnTurnStart is called when a turn starts
type DefaultToolUseBehavior ¶
type DefaultToolUseBehavior struct{}
DefaultToolUseBehavior is the default behavior: always continue after tools
func (*DefaultToolUseBehavior) ShouldStop ¶
func (b *DefaultToolUseBehavior) ShouldStop(ctx context.Context, toolResults []ToolResult) (bool, interface{})
type HandoffInputData ¶
type HandoffInputData struct {
// InputHistory is the original input to the run
InputHistory interface{}
// PreHandoffItems are items generated before the handoff
PreHandoffItems []result.RunItem
// NewItems are items generated in the current step (including the handoff call)
NewItems []result.RunItem
// RunContext is the shared run context
RunContext *RunContext
}
HandoffInputData contains the data passed to a handoff input filter This follows OpenAI's HandoffInputData pattern
func (*HandoffInputData) AllItems ¶
func (d *HandoffInputData) AllItems() []interface{}
AllItems returns all items that should be passed to the next agent This combines inputHistory, preHandoffItems, and newItems
type HandoffInputFilter ¶
type HandoffInputFilter func(input interface{}) (interface{}, error)
HandoffInputFilter is a function that filters input during handoffs
type InputGuardrail ¶
type InputGuardrail interface {
// Check checks the input
Check(input interface{}) (bool, string, error)
}
InputGuardrail is an interface for input guardrails
type Interaction ¶
type Interaction struct {
// Role is the role of the interaction (e.g., "user", "agent")
Role string
// Content is the content of the interaction
Content interface{}
// Timestamp is the time the interaction occurred
Timestamp time.Time
}
Interaction represents a single interaction in a task's history
type ModelRequestType ¶
Type aliases to help with import resolution
type ModelSettingsType ¶
Type aliases to help with import resolution
type NextStep ¶
type NextStep interface {
StepType() string
}
NextStep represents the next step in the agent loop. Similar to OpenAI's NextStep discriminated union in both Python and TypeScript. This follows OpenAI's discriminated union pattern for controlling loop flow.
type NextStepFinalOutput ¶
type NextStepFinalOutput struct {
Output interface{}
}
NextStepFinalOutput indicates the agent has produced a final output
func (*NextStepFinalOutput) StepType ¶
func (n *NextStepFinalOutput) StepType() string
type NextStepHandoff ¶
type NextStepHandoff struct {
NewAgent AgentType
Input interface{}
}
NextStepHandoff indicates a handoff to another agent
func (*NextStepHandoff) StepType ¶
func (n *NextStepHandoff) StepType() string
type NextStepInterruption ¶
type NextStepInterruption struct {
Interruptions []result.RunItem // Items that require approval/intervention
}
NextStepInterruption indicates the run was interrupted (e.g., for tool approval)
func (*NextStepInterruption) StepType ¶
func (n *NextStepInterruption) StepType() string
type NextStepRunAgain ¶
type NextStepRunAgain struct{}
NextStepRunAgain indicates the loop should continue with another turn
func (*NextStepRunAgain) StepType ¶
func (n *NextStepRunAgain) StepType() string
type OutputGuardrail ¶
type OutputGuardrail interface {
// Check checks the output
Check(output interface{}) (bool, string, error)
}
OutputGuardrail is an interface for output guardrails
type ProcessedResponse ¶
type ProcessedResponse struct {
ToolCalls []ToolRunFunction
Handoffs []ToolRunHandoff
Messages []result.RunItem
HasToolsOrHandoffs bool
ToolsUsed []string // Names of all tools used (for tracking)
}
ProcessedResponse contains the processed model response. Similar to OpenAI's ProcessedResponse in both Python and TypeScript. It categorizes the model output into messages, tool calls, handoffs, and tracks tools used.
type RecoveryConfig ¶
type RecoveryConfig struct {
// AutomaticRecovery indicates whether to attempt automatic recovery
AutomaticRecovery bool
// RecoveryFunc is called to attempt recovery from a panic
RecoveryFunc func(ctx interface{}, agent AgentType, state *WorkflowState, rec interface{}) error
// OnPanic is called when a panic occurs
OnPanic func(ctx interface{}, panicErr interface{}) error
// MaxRecoveryAttempts is the maximum number of recovery attempts
MaxRecoveryAttempts int
}
RecoveryConfig configures failure recovery
type RetryConfig ¶
type RetryConfig struct {
// MaxRetries is the maximum number of retries for a failed operation
MaxRetries int
// RetryDelay is the delay between retries
RetryDelay time.Duration
// RetryBackoffFactor is the factor to multiply delay by after each retry
RetryBackoffFactor float64
// RetryableErrors are error types that should trigger a retry
RetryableErrors []string
// OnRetry is called before each retry attempt
OnRetry func(attempt int, err error) error
}
RetryConfig configures retry behavior
type RunConfig ¶
type RunConfig struct {
// Model is a model override (string or Model)
Model interface{}
// ModelProvider is the provider for resolving model names
ModelProvider model.Provider
// ModelSettings are global model settings
ModelSettings *model.Settings
// HandoffInputFilter is a global handoff input filter
HandoffInputFilter HandoffInputFilter
// InputGuardrails are global input guardrails
InputGuardrails []InputGuardrail
// OutputGuardrails are global output guardrails
OutputGuardrails []OutputGuardrail
// TracingDisabled indicates whether tracing is disabled
TracingDisabled bool
// TracingConfig is tracing configuration
TracingConfig *TracingConfig
}
RunConfig configures global settings
type RunContext ¶
type RunContext struct {
// Context is user-provided custom context
Context interface{}
// Usage tracks token usage across the run
Usage *Usage
// contains filtered or unexported fields
}
RunContext shares context across agent turns and handoffs Similar to OpenAI's RunContext, it tracks usage, approvals, and custom context
func NewRunContext ¶
func NewRunContext(context interface{}) *RunContext
NewRunContext creates a new RunContext
func (*RunContext) AddUsage ¶
func (rc *RunContext) AddUsage(requests, inputTokens, outputTokens, totalTokens int)
AddUsage adds token usage to the context
func (*RunContext) ApproveTool ¶
func (rc *RunContext) ApproveTool(toolName, callID string)
ApproveTool marks a tool call as approved
func (*RunContext) IsToolApproved ¶
func (rc *RunContext) IsToolApproved(toolName, callID string) bool
IsToolApproved checks if a tool call is approved
func (*RunContext) IsToolRejected ¶
func (rc *RunContext) IsToolRejected(toolName, callID string) bool
IsToolRejected checks if a tool call is rejected
func (*RunContext) RejectTool ¶
func (rc *RunContext) RejectTool(toolName, callID string)
RejectTool marks a tool call as rejected
type RunHooks ¶
type RunHooks interface {
// OnRunStart is called when the run starts
OnRunStart(ctx context.Context, agent *agent.Agent, input interface{}) error
// OnAgentStart is called when an agent starts (first turn or after handoff)
// Similar to Python's hooks.on_agent_start
OnAgentStart(ctx context.Context, agent AgentType, input interface{}) error
// OnTurnStart is called when a turn starts
OnTurnStart(ctx context.Context, agent *agent.Agent, turn int) error
// OnTurnEnd is called when a turn ends
OnTurnEnd(ctx context.Context, agent *agent.Agent, turn int, result *SingleTurnResult) error
// OnRunEnd is called when the run ends
OnRunEnd(ctx context.Context, result *result.RunResult) error
// OnHandoff is called when a handoff occurs (from_agent -> to_agent)
// Similar to Python's hooks.on_handoff
OnHandoff(ctx context.Context, fromAgent AgentType, toAgent AgentType) error
// OnBeforeHandoff is called before a handoff occurs (deprecated, use OnHandoff)
OnBeforeHandoff(ctx context.Context, agent AgentType, handoffAgent AgentType) error
// OnAfterHandoff is called after a handoff completes
OnAfterHandoff(ctx context.Context, agent AgentType, handoffAgent AgentType, result interface{}) error
}
RunHooks defines lifecycle hooks for a run
type RunOptions ¶
type RunOptions struct {
// Input is the input to the run
Input interface{}
// Context is a user-provided context object
Context interface{}
// MaxTurns is the maximum number of turns
MaxTurns int
// Hooks are lifecycle hooks for the run
Hooks RunHooks
// RunConfig is global configuration
RunConfig *RunConfig
// WorkflowConfig configures workflow-specific behavior
WorkflowConfig *WorkflowConfig
}
RunOptions configures a run
type RunState ¶
type RunState struct {
// OriginalInput is the initial input to the run, never mutated
OriginalInput interface{}
// GeneratedItems are items generated during the run (messages, tool calls, etc.)
// These accumulate over time
GeneratedItems []result.RunItem
// CurrentAgent is the agent currently handling the conversation
CurrentAgent AgentType
// CurrentStep determines what should happen next in the loop
CurrentStep NextStep
// CurrentTurn is the current turn number
CurrentTurn int
// MaxTurns is the maximum number of turns allowed
MaxTurns int
// ConsecutiveToolCalls tracks consecutive calls to the same tool
ConsecutiveToolCalls int
// RawResponses stores all raw model responses
RawResponses []model.Response
// LastTurnResponse stores the last model response for interruption handling
LastTurnResponse *model.Response
// RunContext shares context across handoffs (usage, approvals, custom context)
RunContext *RunContext
// ToolUseTracker tracks which tools each agent has used
ToolUseTracker *AgentToolUseTracker
// ShouldRunAgentStartHooks controls when agent start hooks should run
// Set to true on first turn or after handoff
ShouldRunAgentStartHooks bool
}
RunState tracks the state of an agent run. Similar to OpenAI's RunState in both Python and TypeScript. It maintains originalInput separately from generatedItems, following OpenAI's pattern.
func NewRunState ¶
func NewRunState(agent AgentType, input interface{}, maxTurns int, runContext *RunContext) *RunState
NewRunState creates a new RunState
func (*RunState) AddGeneratedItem ¶
AddGeneratedItem adds a new item to the generated items list
func (*RunState) AddGeneratedItems ¶
AddGeneratedItems adds multiple items to the generated items list
func (*RunState) AddRawResponse ¶
AddRawResponse adds a raw model response
func (*RunState) GetTurnInput ¶
func (s *RunState) GetTurnInput() []interface{}
GetTurnInput combines originalInput and generatedItems to create the input for the next turn This follows OpenAI's getTurnInput pattern, filtering out internal items like approvals
func (*RunState) IncrementTurn ¶
func (s *RunState) IncrementTurn()
IncrementTurn increments the turn counter
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner executes agents
func (*Runner) Run ¶
func (r *Runner) Run(ctx context.Context, agent AgentType, opts *RunOptions) (*result.RunResult, error)
Run executes an agent with the given input and options
func (*Runner) RunStreaming ¶
func (r *Runner) RunStreaming(ctx context.Context, agent AgentType, opts *RunOptions) (*result.StreamedRunResult, error)
RunStreaming executes an agent with streaming responses
func (*Runner) WithDefaultMaxTurns ¶
WithDefaultMaxTurns sets the default maximum turns
type SingleTurnResult ¶
SingleTurnResult contains the result of a single turn
type StateManagementConfig ¶
type StateManagementConfig struct {
// PersistState indicates whether to persist workflow state
PersistState bool
// StateStore is the interface for storing workflow state
StateStore WorkflowStateStore
// CheckpointFrequency determines how often to save state
CheckpointFrequency time.Duration
// RestoreOnFailure indicates whether to restore state on failure
RestoreOnFailure bool
}
StateManagementConfig configures workflow state management
type StopOnFirstToolBehavior ¶
type StopOnFirstToolBehavior struct{}
StopOnFirstToolBehavior stops execution after the first tool
func (*StopOnFirstToolBehavior) ShouldStop ¶
func (b *StopOnFirstToolBehavior) ShouldStop(ctx context.Context, toolResults []ToolResult) (bool, interface{})
type TaskContext ¶
type TaskContext struct {
// TaskID is a unique identifier for the task
TaskID string
// ParentAgentName is the name of the agent that delegated the task
ParentAgentName string
// ChildAgentName is the name of the agent executing the task
ChildAgentName string
// Status indicates the current status of the task
Status TaskStatus
// CreatedAt is the time the task was created
CreatedAt time.Time
// CompletedAt is the time the task was completed
CompletedAt *time.Time
// Result contains the result of the task
Result interface{}
// RelatedTaskIDs contains IDs of related tasks (e.g., parent, children)
RelatedTaskIDs []string
// TaskDescription contains a human-readable description of the task
TaskDescription string
// WorkingContext contains context information about what is being worked on
WorkingContext *WorkingContext
// InteractionHistory contains the history of interactions for this task
InteractionHistory []Interaction
}
TaskContext tracks information about a delegated task
func NewTaskContext ¶
func NewTaskContext(taskID, parentName, childName string) *TaskContext
NewTaskContext creates a new task context
func (*TaskContext) AddInteraction ¶
func (t *TaskContext) AddInteraction(role string, content interface{})
AddInteraction adds an interaction to the task history
func (*TaskContext) AddMetadata ¶
func (t *TaskContext) AddMetadata(key string, value interface{})
AddMetadata adds metadata to the task context
func (*TaskContext) AddRelatedTask ¶
func (t *TaskContext) AddRelatedTask(taskID string)
AddRelatedTask adds a related task ID
func (*TaskContext) Complete ¶
func (t *TaskContext) Complete(result interface{})
Complete marks the task as complete with a result
func (*TaskContext) Fail ¶
func (t *TaskContext) Fail(err error)
Fail marks the task as failed with an error
func (*TaskContext) GetArtifact ¶
func (t *TaskContext) GetArtifact() interface{}
GetArtifact returns the working artifact for the task
func (*TaskContext) GetDelegationChain ¶
func (t *TaskContext) GetDelegationChain() string
GetDelegationChain returns the delegation chain in the format "parent -> child"
func (*TaskContext) GetInteractionHistory ¶
func (t *TaskContext) GetInteractionHistory() []Interaction
GetInteractionHistory returns the interaction history for the task
func (*TaskContext) GetLastInteraction ¶
func (t *TaskContext) GetLastInteraction() *Interaction
GetLastInteraction returns the most recent interaction
func (*TaskContext) GetMetadata ¶
func (t *TaskContext) GetMetadata(key string) interface{}
GetMetadata retrieves metadata from the task context
func (*TaskContext) GetResult ¶
func (t *TaskContext) GetResult() interface{}
GetResult returns the task result
func (*TaskContext) IsComplete ¶
func (t *TaskContext) IsComplete() bool
IsComplete checks if the task is complete
func (*TaskContext) IsFailed ¶
func (t *TaskContext) IsFailed() bool
IsFailed checks if the task has failed
func (*TaskContext) IsFinished ¶
func (t *TaskContext) IsFinished() bool
IsFinished checks if the task is either complete or failed
func (*TaskContext) IsPending ¶
func (t *TaskContext) IsPending() bool
IsPending checks if the task is still pending
func (*TaskContext) SetArtifact ¶
func (t *TaskContext) SetArtifact(artifact interface{}, artifactType string)
SetArtifact sets the working artifact for the task
func (*TaskContext) SetDescription ¶
func (t *TaskContext) SetDescription(description string)
SetDescription sets a human-readable description for the task
func (*TaskContext) ToJSON ¶
func (t *TaskContext) ToJSON() (string, error)
ToJSON converts the task context to JSON
type TaskStatus ¶
type TaskStatus string
TaskStatus represents the status of a delegated task
const ( // TaskStatusPending indicates the task is in progress TaskStatusPending TaskStatus = "pending" // TaskStatusComplete indicates the task is complete TaskStatusComplete TaskStatus = "complete" // TaskStatusFailed indicates the task failed TaskStatusFailed TaskStatus = "failed" )
type ToolResult ¶
ToolResult represents the result of executing a tool
type ToolRunFunction ¶
ToolRunFunction represents a function tool call to execute. Similar to OpenAI's ToolRunFunction type in both SDKs.
type ToolRunHandoff ¶
ToolRunHandoff represents a handoff call to another agent. Similar to OpenAI's ToolRunHandoff type in both SDKs.
type ToolUseBehavior ¶
type ToolUseBehavior interface {
// ShouldStop determines if execution should stop after tool execution
// Returns (shouldStop, finalOutput)
ShouldStop(ctx context.Context, toolResults []ToolResult) (bool, interface{})
}
ToolUseBehavior determines how tool outputs are handled Similar to OpenAI's toolUseBehavior
type TracingConfig ¶
type TracingConfig struct {
// WorkflowName is the name of the workflow
WorkflowName string
// TraceID is a custom trace ID
TraceID string
// GroupID is a grouping identifier
GroupID string
// Metadata is additional metadata
Metadata map[string]interface{}
}
TracingConfig configures tracing
type TurnResult ¶
type TurnResult struct {
// OriginalInput is the original input (may be mutated by handoff filters)
OriginalInput interface{}
// GeneratedItems are all items generated during this turn
GeneratedItems []result.RunItem
// NextStep determines what should happen next
NextStep NextStep
// ModelResponse is the raw model response for this turn
ModelResponse *model.Response
}
TurnResult represents the result of processing a single turn. Similar to OpenAI's SingleStepResult in both Python and TypeScript. It contains the generated items, next step, and raw model response for a turn.
func NewTurnResult ¶
func NewTurnResult(originalInput interface{}, generatedItems []result.RunItem, nextStep NextStep, modelResponse *model.Response) *TurnResult
NewTurnResult creates a new TurnResult
type ValidationConfig ¶
type ValidationConfig struct {
// PreHandoffValidation validates data before handoff
PreHandoffValidation []ValidationRule
// PostHandoffValidation validates data after handoff
PostHandoffValidation []ValidationRule
// PhaseTransitionValidation validates phase transitions
PhaseTransitionValidation []ValidationRule
}
ValidationConfig configures validation behavior
type ValidationRule ¶
type ValidationRule struct {
// Name is the name of the rule
Name string
// Validate is the validation function
Validate func(data interface{}) (bool, error)
// ErrorMessage is the message to show on validation failure
ErrorMessage string
// Severity determines if validation failure should block progress
Severity ValidationSeverity
}
ValidationRule defines a validation rule
type ValidationSeverity ¶
type ValidationSeverity string
ValidationSeverity indicates the severity of a validation failure
const ( // ValidationError indicates a blocking validation failure ValidationError ValidationSeverity = "error" // ValidationWarning indicates a non-blocking validation failure ValidationWarning ValidationSeverity = "warning" )
type WorkflowConfig ¶
type WorkflowConfig struct {
// RetryConfig configures retry behavior for handoffs and tool calls
RetryConfig *RetryConfig
// StateManagement configures how workflow state is managed
StateManagement *StateManagementConfig
// ValidationConfig configures input/output validation between phases
ValidationConfig *ValidationConfig
// RecoveryConfig configures how to handle and recover from failures
RecoveryConfig *RecoveryConfig
}
WorkflowConfig configures workflow behavior
type WorkflowRunner ¶
type WorkflowRunner struct {
*Runner
// contains filtered or unexported fields
}
WorkflowRunner extends the base Runner with workflow capabilities
func NewWorkflowRunner ¶
func NewWorkflowRunner(baseRunner *Runner, config *WorkflowConfig) *WorkflowRunner
NewWorkflowRunner creates a new workflow runner
func (*WorkflowRunner) RunWorkflow ¶
func (wr *WorkflowRunner) RunWorkflow(ctx context.Context, agent AgentType, opts *RunOptions) (*result.RunResult, error)
RunWorkflow executes a workflow with the given options
type WorkflowState ¶
type WorkflowState struct {
// CurrentPhase is the current phase of the workflow
CurrentPhase string
// CompletedPhases are the phases that have been completed
CompletedPhases []string
// Artifacts are data produced during workflow execution
Artifacts map[string]interface{}
// LastCheckpoint is when the state was last saved
LastCheckpoint time.Time
// Metadata is additional workflow metadata
Metadata map[string]interface{}
}
WorkflowState represents the current state of a workflow
type WorkflowStateStore ¶
type WorkflowStateStore interface {
// SaveState saves the current workflow state
SaveState(workflowID string, state interface{}) error
// LoadState loads a workflow state
LoadState(workflowID string) (interface{}, error)
// ListCheckpoints lists available checkpoints for a workflow
ListCheckpoints(workflowID string) ([]string, error)
// DeleteCheckpoint deletes a checkpoint
DeleteCheckpoint(workflowID string, checkpointID string) error
}
WorkflowStateStore defines the interface for storing workflow state
type WorkingContext ¶
type WorkingContext struct {
// Artifact is the primary artifact being worked on (e.g., code, text)
Artifact interface{} `json:"artifact,omitempty"`
// ArtifactType indicates the type of artifact (e.g., "code", "text")
ArtifactType string `json:"artifact_type,omitempty"`
// Metadata contains additional metadata about the task
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
WorkingContext contains context information about the task