Documentation
¶
Index ¶
- Constants
- func BuiltinWorkflowScript(name string) (string, bool)
- func RenderPromptCatalog(ctx context.Context, library *Library, limit int) string
- func RenderPromptCatalogDefinitions(defs []Definition, limit int) string
- func ValidWorkflowName(name string) bool
- type ActorContext
- type AgentSpawner
- type AgentTaskResult
- type AgentTaskSpec
- type AgentToolPlanner
- type Definition
- type DefinitionStatus
- type FileRunEventStore
- func (s *FileRunEventStore) Append(ctx context.Context, event RunEvent) error
- func (s *FileRunEventStore) List(ctx context.Context, runID RunID) ([]RunEvent, error)
- func (s *FileRunEventStore) ListRuns(ctx context.Context, limit int) ([]Run, error)
- func (s *FileRunEventStore) LoadRun(ctx context.Context, runID RunID) (Run, error)
- func (s *FileRunEventStore) RunDir(runID RunID) (string, error)
- type Library
- func (l *Library) List(ctx context.Context) ([]Definition, error)
- func (l *Library) PrepareGenerated(ctx context.Context, script, saveAs string) (ResolvedScript, error)
- func (l *Library) Resolve(ctx context.Context, name string) (ResolvedScript, error)
- func (l *Library) SaveGenerated(ctx context.Context, script, saveAs string) (ResolvedScript, error)
- type LibraryRoot
- type ResolvedScript
- type Run
- type RunEvent
- type RunEventStore
- type RunID
- type RunListStore
- type RunManager
- type ScriptMeta
- type ScriptPhase
- type ScriptRunner
- type TaskID
- type TaskScheduler
- type Tool
- type ToolOptions
- type WorkflowInput
- type WorkflowOutput
Constants ¶
View Source
const ( RunStatusRunning = "running" RunStatusCompleted = "completed" RunStatusFailed = "failed" RunStatusCancelled = "cancelled" TaskStatusQueued = "queued" TaskStatusRunning = "running" TaskStatusCompleted = "completed" TaskStatusFailed = "failed" TaskStatusCancelled = "cancelled" ActorKindWorkflow = "workflow" ActorKindAgent = "agent" ActorKindSubagent = "subagent" EventRunStarted = "run_started" EventRunCompleted = "run_completed" EventRunFailed = "run_failed" EventRunCancelled = "run_cancelled" EventTaskStarted = "task_started" EventTaskProgress = "task_progress" EventTaskCompleted = "task_completed" EventTaskFailed = "task_failed" EventTaskCancelled = "task_cancelled" EventWorkflowStarted = "workflow_started" EventWorkflowCompleted = "workflow_completed" EventWorkflowFailed = "workflow_failed" EventBudgetUpdated = "budget_updated" EventPhaseStarted = "phase_started" EventLog = "log" EventScriptReady = "workflow_script_validated" )
View Source
const BuiltinDeepResearchName = "deep-research"
View Source
const DefaultMaxConcurrency = 3
View Source
const DefaultPromptCatalogLimit = 12
View Source
const MaxWorkflowScriptBytes = 512 * 1024
View Source
const WorkflowFileExt = ".js"
View Source
const WorkflowStatusAsyncLaunched = "async_launched"
Variables ¶
This section is empty.
Functions ¶
func BuiltinWorkflowScript ¶
func RenderPromptCatalog ¶
func RenderPromptCatalogDefinitions ¶
func RenderPromptCatalogDefinitions(defs []Definition, limit int) string
func ValidWorkflowName ¶
Types ¶
type ActorContext ¶
type ActorContext struct {
RunID RunID `json:"run_id"`
TaskID TaskID `json:"task_id,omitempty"`
ParentSessionID string `json:"parent_session_id,omitempty"`
ActorKind string `json:"actor_kind,omitempty"`
ParentTaskID TaskID `json:"parent_task_id,omitempty"`
WorkflowName string `json:"workflow_name,omitempty"`
Role string `json:"role,omitempty"`
Phase string `json:"phase,omitempty"`
Label string `json:"label,omitempty"`
CallKey string `json:"call_key,omitempty"`
SpecHash string `json:"spec_hash,omitempty"`
Sequence int64 `json:"sequence,omitempty"`
}
type AgentSpawner ¶
type AgentSpawner interface {
SpawnSubagentWithProgress(ctx context.Context, req tasks.SpawnSubagentRequest, progress func(core.ToolProgress)) (tasks.SpawnSubagentResponse, error)
}
type AgentTaskResult ¶
type AgentTaskResult struct {
TaskID TaskID `json:"task_id"`
ChildSessionID string `json:"child_session_id,omitempty"`
Status string `json:"status"`
// Report is the subagent's full final message — what a schemaless agent()
// call returns to a workflow script. Summary is only a one-line preview and
// must never be the value handed back to scripts.
Report string `json:"report,omitempty"`
Summary string `json:"summary,omitempty"`
StructuredResult any `json:"structured_result,omitempty"`
ToolCalls []string `json:"tool_calls,omitempty"`
Usage llm.Usage `json:"usage,omitempty"`
DurationMS int64 `json:"duration_ms,omitempty"`
Error string `json:"error,omitempty"`
}
type AgentTaskSpec ¶
type AgentTaskSpec struct {
Prompt string `json:"prompt"`
Role string `json:"role,omitempty"`
Agent tasks.AgentDefinition `json:"agent,omitempty"`
Model string `json:"model,omitempty"`
Effort string `json:"effort,omitempty"`
PermissionMode string `json:"permissionMode,omitempty"`
MaxTurns int `json:"maxTurns,omitempty"`
Background bool `json:"background,omitempty"`
Isolation string `json:"isolation,omitempty"`
Skills []string `json:"skills,omitempty"`
MCPServers []string `json:"mcpServers,omitempty"`
InitialPrompt string `json:"initialPrompt,omitempty"`
Memory string `json:"memory,omitempty"`
MaxToolIters int `json:"max_tool_iters,omitempty"`
MaxToolCalls int `json:"max_tool_calls,omitempty"`
Phase string `json:"phase,omitempty"`
Label string `json:"label,omitempty"`
Capabilities []string `json:"capabilities,omitempty"`
OutputSchema map[string]any `json:"output_schema,omitempty"`
}
type AgentToolPlanner ¶
type AgentToolPlanner interface {
AllowedSubagentTools(req tasks.SpawnSubagentRequest) ([]string, error)
}
type Definition ¶
type DefinitionStatus ¶
type DefinitionStatus string
const ( DefinitionReady DefinitionStatus = "ready" DefinitionProblem DefinitionStatus = "problem" )
type FileRunEventStore ¶
type FileRunEventStore struct {
// contains filtered or unexported fields
}
func NewFileRunEventStore ¶
func NewFileRunEventStore(dataDir string) (*FileRunEventStore, error)
func (*FileRunEventStore) Append ¶
func (s *FileRunEventStore) Append(ctx context.Context, event RunEvent) error
type Library ¶
type Library struct {
Roots []LibraryRoot
}
func NewLibrary ¶
func NewLibraryWithRoots ¶
func NewLibraryWithRoots(roots []LibraryRoot) *Library
func (*Library) PrepareGenerated ¶ added in v0.1.34
func (*Library) SaveGenerated ¶ added in v0.1.34
type LibraryRoot ¶
type ResolvedScript ¶
type ResolvedScript struct {
Definition Definition
Script string
}
func ResolveScriptPath ¶ added in v0.1.34
func ResolveScriptPath(ctx context.Context, path string) (ResolvedScript, error)
type RunEvent ¶
type RunEvent struct {
RunID RunID `json:"run_id"`
TaskID TaskID `json:"task_id,omitempty"`
Type string `json:"type"`
Time time.Time `json:"time"`
Message string `json:"message,omitempty"`
Data map[string]any `json:"data,omitempty"`
Status string `json:"status,omitempty"`
ParentTaskID TaskID `json:"parent_task_id,omitempty"`
WorkflowName string `json:"workflow_name,omitempty"`
Phase string `json:"phase,omitempty"`
Label string `json:"label,omitempty"`
Role string `json:"role,omitempty"`
SessionID string `json:"session_id,omitempty"`
}
type RunEventStore ¶
type RunListStore ¶
type RunManager ¶
type RunManager struct {
Store RunEventStore
Scheduler *TaskScheduler
Now func() time.Time
}
func NewRunManager ¶
func NewRunManager(store RunEventStore, scheduler *TaskScheduler) *RunManager
func (*RunManager) RunAgents ¶
func (m *RunManager) RunAgents(ctx context.Context, runID RunID, parentSessionID string, specs []AgentTaskSpec, maxConcurrency int) ([]AgentTaskResult, error)
type ScriptMeta ¶
type ScriptMeta struct {
Name string `json:"name"`
Description string `json:"description"`
WhenToUse string `json:"whenToUse,omitempty"`
RiskNote string `json:"riskNote,omitempty"`
EstimatedAgents int `json:"estimatedAgents,omitempty"`
DefaultBudgetTokens int `json:"defaultBudgetTokens,omitempty"`
Phases []ScriptPhase `json:"phases,omitempty"`
}
type ScriptPhase ¶
type ScriptRunner ¶
type ScriptRunner struct {
Manager *RunManager
Store RunEventStore
Scheduler *TaskScheduler
DataDir string
Library *Library
Now func() time.Time
MaxAgentCalls int
JSTimeout time.Duration
CompileValidate bool
// contains filtered or unexported fields
}
func NewScriptRunner ¶
func NewScriptRunner(dataDir string, manager *RunManager) *ScriptRunner
func (*ScriptRunner) StartWorkflow ¶
func (r *ScriptRunner) StartWorkflow(ctx context.Context, parentSessionID string, input WorkflowInput) (WorkflowOutput, error)
type TaskScheduler ¶
type TaskScheduler struct {
Store RunEventStore
Spawner AgentSpawner
Now func() time.Time
}
func NewTaskScheduler ¶
func NewTaskScheduler(store RunEventStore, spawner AgentSpawner) *TaskScheduler
func (*TaskScheduler) SpawnAgent ¶
func (s *TaskScheduler) SpawnAgent(ctx context.Context, actor ActorContext, spec AgentTaskSpec) (AgentTaskResult, error)
type Tool ¶
type Tool struct {
// contains filtered or unexported fields
}
func NewTool ¶
func NewTool(runner *ScriptRunner, parentSessionIDFunc ...func() string) Tool
func NewToolWithOptions ¶ added in v0.1.36
func NewToolWithOptions(runner *ScriptRunner, opts ToolOptions) Tool
func (Tool) Description ¶
func (Tool) Parameters ¶
type ToolOptions ¶ added in v0.1.36
type WorkflowInput ¶
type WorkflowInput struct {
Action string `json:"action,omitempty"`
Script string `json:"script,omitempty"`
Name string `json:"name,omitempty"`
Args any `json:"args,omitempty"`
ScriptPath string `json:"scriptPath,omitempty"`
SaveAs string `json:"saveAs,omitempty"`
ResumeFromRunID string `json:"resumeFromRunId,omitempty"`
BudgetTokens *int `json:"budgetTokens,omitempty"`
}
type WorkflowOutput ¶
type WorkflowOutput struct {
Status string `json:"status"`
TaskID string `json:"taskId"`
RunID RunID `json:"runId,omitempty"`
Summary string `json:"summary,omitempty"`
TranscriptDir string `json:"transcriptDir,omitempty"`
ScriptPath string `json:"scriptPath,omitempty"`
SessionURL string `json:"sessionUrl,omitempty"`
Warning string `json:"warning,omitempty"`
Error string `json:"error,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.