Documentation
¶
Index ¶
- Constants
- Variables
- func ExecutionRootFromContext(ctx context.Context) string
- func NormalizeWorkspaceID(workspaceID string) string
- func SystemPromptAppendFromContext(ctx context.Context) string
- func ToolCallSignature(toolName, toolArgs string) string
- func WithExecutionRoot(ctx context.Context, root string) context.Context
- func WithPromptExecution(ctx context.Context, override *ProviderOverride, source string, ...) context.Context
- func WithRecoveryExecution(ctx context.Context, plan *RecoveryExecutionPlan) context.Context
- func WithRuntimeExecutionRecorder(ctx context.Context, recorder RuntimeExecutionRecorder) context.Context
- func WithRuntimeToolCallRecorder(ctx context.Context, recorder RuntimeToolCallRecorder) context.Context
- func WithSystemPromptAppend(ctx context.Context, value string) context.Context
- type AgentExecutor
- type AgentInfo
- type AgentRuntimeStatus
- type ChannelMessage
- type CheckpointCapability
- type CheckpointContinuation
- type CheckpointFormat
- type CheckpointReference
- type CommandExecutor
- type CommandExecutorOptions
- type ConsensusDecisionRecord
- type ConsensusSpec
- type ConsensusVariantRecord
- type DiffFileChange
- type DiffTimelineEntry
- type DiffTimelineSummary
- type EffectReceipt
- type EffectReceiptStatus
- type ExecuteRequest
- type ExecutorCheckpointSupport
- type FileAttentionSummary
- type PromptExecutionContext
- type PromptExecutionMetadata
- type PromptExecutor
- type PromptExecutorOptions
- type ProviderOverride
- type RecoveryExecutionPlan
- type RecoveryMode
- type RecoveryToolResult
- type ReportChannels
- type ReportRuns
- type ReportSummary
- type ResolvedProviderOverride
- type RestartRequest
- type Run
- type RunCheckpoint
- type RunEvent
- type RunStatus
- type Runtime
- func (r *Runtime) Agents() []map[string]any
- func (r *Runtime) Cancel(runID string) (Run, error)
- func (r *Runtime) CancelByWorkspace(workspaceID, runID string) (Run, error)
- func (r *Runtime) Close(ctx context.Context) error
- func (r *Runtime) ConsensusEnabled() bool
- func (r *Runtime) Enabled() bool
- func (r *Runtime) Get(runID string) (Run, bool)
- func (r *Runtime) GetByWorkspace(workspaceID, runID string) (Run, bool)
- func (r *Runtime) GetOrZero(runID string) Run
- func (r *Runtime) InboundTelegram(botID, threadID, text string, payload map[string]any) (ChannelMessage, error)
- func (r *Runtime) InboundTelegramByWorkspace(workspaceID, botID, threadID, text string, payload map[string]any) (ChannelMessage, error)
- func (r *Runtime) InboundWebhook(channelID, threadID, text string, payload map[string]any) (ChannelMessage, error)
- func (r *Runtime) InboundWebhookByWorkspace(workspaceID, channelID, threadID, text string, payload map[string]any) (ChannelMessage, error)
- func (r *Runtime) List(limit int) []Run
- func (r *Runtime) ListByWorkspace(workspaceID string, limit int) []Run
- func (r *Runtime) LookupAgent(name string) (AgentInfo, bool)
- func (r *Runtime) MessageRead(channelID string, limit int) ([]ChannelMessage, error)
- func (r *Runtime) MessageReadByWorkspace(workspaceID, channelID string, limit int) ([]ChannelMessage, error)
- func (r *Runtime) MessageSend(channelID, threadID, text string) (ChannelMessage, error)
- func (r *Runtime) MessageSendByWorkspace(workspaceID, channelID, threadID, text string) (ChannelMessage, error)
- func (r *Runtime) OutboundTelegram(botID, chatID, threadID, text string, payload map[string]any) (ChannelMessage, error)
- func (r *Runtime) OutboundTelegramByWorkspace(workspaceID, botID, chatID, threadID, text string, payload map[string]any) (ChannelMessage, error)
- func (r *Runtime) Reload() AgentRuntimeStatus
- func (r *Runtime) ReportsChannels(limit int) (ReportChannels, error)
- func (r *Runtime) ReportsChannelsByWorkspace(workspaceID string, limit int) (ReportChannels, error)
- func (r *Runtime) ReportsRuns(limit int) (ReportRuns, error)
- func (r *Runtime) ReportsRunsByWorkspace(workspaceID string, limit int) (ReportRuns, error)
- func (r *Runtime) ReportsSummary() (ReportSummary, error)
- func (r *Runtime) ReportsSummaryByWorkspace(workspaceID string) (ReportSummary, error)
- func (r *Runtime) Restart() AgentRuntimeStatus
- func (r *Runtime) RestartFromCheckpoint(ctx context.Context, req RestartRequest) (Run, error)
- func (r *Runtime) SetAgentsWatchEnabled(enabled bool)
- func (r *Runtime) SetEffectReceiptStore(store *workstore.Store)
- func (r *Runtime) SetExecutors(executors []AgentExecutor, defaultAgent string)
- func (r *Runtime) Spawn(ctx context.Context, req SpawnRequest) (Run, error)
- func (r *Runtime) Status() AgentRuntimeStatus
- func (r *Runtime) SubagentLimits() (maxThreads int, maxDepth int)
- func (r *Runtime) SubscribeRunEvents(runID string) (<-chan RunEvent, func())
- func (r *Runtime) ThreadReply(channelID, threadID, text string) (ChannelMessage, error)
- func (r *Runtime) ThreadReplyByWorkspace(workspaceID, channelID, threadID, text string) (ChannelMessage, error)
- func (r *Runtime) Wait(ctx context.Context, runID string) (Run, error)
- type RuntimeExecutionRecorder
- type RuntimeOptions
- type RuntimeToolCall
- type RuntimeToolCallRecorder
- type RuntimeToolPhase
- type SpawnRequest
- type ToolRequestRecord
- type ToolRequestStatus
- type ToolResultRecord
Constants ¶
const DefaultWorkspaceID = "default"
Variables ¶
var ( ErrRecoveryApprovalRequired = errors.New("agent runtime: recovery approval required") ErrRecoveryModeUnsupported = errors.New("agent runtime: recovery mode unsupported") )
Functions ¶
func ExecutionRootFromContext ¶ added in v0.35.0
func NormalizeWorkspaceID ¶
func SystemPromptAppendFromContext ¶ added in v0.32.68
func ToolCallSignature ¶ added in v0.35.0
func WithExecutionRoot ¶ added in v0.35.0
func WithPromptExecution ¶
func WithPromptExecution(ctx context.Context, override *ProviderOverride, source string, metadata *PromptExecutionMetadata) context.Context
func WithRecoveryExecution ¶ added in v0.35.0
func WithRecoveryExecution(ctx context.Context, plan *RecoveryExecutionPlan) context.Context
func WithRuntimeExecutionRecorder ¶ added in v0.35.0
func WithRuntimeExecutionRecorder(ctx context.Context, recorder RuntimeExecutionRecorder) context.Context
func WithRuntimeToolCallRecorder ¶ added in v0.31.52
func WithRuntimeToolCallRecorder(ctx context.Context, recorder RuntimeToolCallRecorder) context.Context
Types ¶
type AgentExecutor ¶
type AgentInfo ¶
type AgentInfo struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Enabled bool `json:"enabled"`
Kind string `json:"kind,omitempty"`
Source string `json:"source,omitempty"`
Entry string `json:"entry,omitempty"`
PolicyMode string `json:"policy_mode"`
ToolsAllow []string `json:"tools_allow,omitempty"`
ToolsAllowCount int `json:"tools_allow_count"`
ToolsDeny []string `json:"tools_deny,omitempty"`
ToolsDenyCount int `json:"tools_deny_count"`
ToolsRiskMax string `json:"tools_risk_max,omitempty"`
ToolsAllowGroups []string `json:"tools_allow_groups,omitempty"`
ToolsDenyGroups []string `json:"tools_deny_groups,omitempty"`
ToolsAllowPatterns []string `json:"tools_allow_patterns,omitempty"`
SessionRoutingMode string `json:"session_routing_mode,omitempty"`
SessionFixedID string `json:"session_fixed_id,omitempty"`
Tier string `json:"tier,omitempty"`
ProviderOverride *ProviderOverride `json:"provider_override,omitempty"`
CheckpointCapability CheckpointCapability `json:"checkpoint_capability"`
CheckpointLimitation string `json:"checkpoint_limitation,omitempty"`
}
type AgentRuntimeStatus ¶ added in v0.31.5
type AgentRuntimeStatus struct {
Enabled bool `json:"enabled"`
Version int64 `json:"version"`
RunsTotal int `json:"runs_total"`
RunsActive int `json:"runs_active"`
AgentsCount int `json:"agents_count"`
AgentsWatchEnabled bool `json:"agents_watch_enabled"`
AgentsReloadVersion int64 `json:"agents_reload_version"`
AgentsLastReloadAt string `json:"agents_last_reload_at,omitempty"`
ChannelsLocal bool `json:"channels_local_enabled"`
ChannelsWebhook bool `json:"channels_webhook_enabled"`
ChannelsTelegram bool `json:"channels_telegram_enabled"`
PersistenceEnabled bool `json:"persistence_enabled"`
RunsPersistenceEnabled bool `json:"runs_persistence_enabled"`
ChannelsPersistenceEnabled bool `json:"channels_persistence_enabled"`
RestoreOnStartup bool `json:"restore_on_startup"`
PersistenceDir string `json:"persistence_dir,omitempty"`
RunsRestored int `json:"runs_restored"`
ChannelsRestored int `json:"channels_restored"`
LastPersistAt string `json:"last_persist_at,omitempty"`
LastRestoreAt string `json:"last_restore_at,omitempty"`
LastRestoreError string `json:"last_restore_error,omitempty"`
LastReloadAt string `json:"last_reload_at,omitempty"`
LastRestartAt string `json:"last_restart_at,omitempty"`
}
type ChannelMessage ¶
type ChannelMessage struct {
ID string `json:"id"`
WorkspaceID string `json:"-"`
ChannelID string `json:"channel_id"`
ThreadID string `json:"thread_id,omitempty"`
Direction string `json:"direction"`
Source string `json:"source"`
Text string `json:"text"`
Payload map[string]any `json:"payload,omitempty"`
Timestamp string `json:"timestamp"`
}
type CheckpointCapability ¶ added in v0.35.0
type CheckpointCapability string
const ( CheckpointCapabilityRetryOnly CheckpointCapability = "retry_only" CheckpointCapabilityReplay CheckpointCapability = "replay" CheckpointCapabilityResumableStep CheckpointCapability = "resumable_step" CheckpointCapabilityEnvironmentRehydratable CheckpointCapability = "environment_rehydratable" )
type CheckpointContinuation ¶ added in v0.35.0
type CheckpointFormat ¶ added in v0.35.0
type CheckpointFormat string
const ( CheckpointFormatPromptV0 CheckpointFormat = "prompt_checkpoint_v0" CheckpointFormatStepV1 CheckpointFormat = "step_checkpoint_v1" )
type CheckpointReference ¶ added in v0.35.0
type CommandExecutor ¶
type CommandExecutor struct {
// contains filtered or unexported fields
}
func NewCommandExecutor ¶
func NewCommandExecutor(opts CommandExecutorOptions) (*CommandExecutor, error)
func (*CommandExecutor) CheckpointSupport ¶ added in v0.35.0
func (e *CommandExecutor) CheckpointSupport() ExecutorCheckpointSupport
func (*CommandExecutor) Execute ¶
func (e *CommandExecutor) Execute(ctx context.Context, req ExecuteRequest) (string, error)
func (*CommandExecutor) Info ¶
func (e *CommandExecutor) Info() AgentInfo
type CommandExecutorOptions ¶
type ConsensusDecisionRecord ¶ added in v0.35.0
type ConsensusDecisionRecord struct {
Automatic bool `json:"automatic"`
BaselineID string `json:"baseline_id,omitempty"`
DecisionReason string `json:"decision_reason,omitempty"`
ExpectedQualityDelta float64 `json:"expected_quality_delta,omitempty"`
ExpectedTokens int `json:"expected_tokens"`
ExpectedCostUSD float64 `json:"expected_cost_usd"`
TokenBudget int `json:"token_budget"`
CostBudgetUSD float64 `json:"cost_budget_usd"`
Fanout int `json:"fanout"`
ObservedCompleted int `json:"observed_completed"`
ObservedFailed int `json:"observed_failed"`
ObservedTokens int `json:"observed_tokens"`
ObservedCostUSD float64 `json:"observed_cost_usd"`
ObservedOutcome string `json:"observed_outcome,omitempty"`
RecordedAt string `json:"recorded_at"`
ObservedAt string `json:"observed_at,omitempty"`
}
type ConsensusSpec ¶
type ConsensusSpec struct {
Strategy string `json:"strategy,omitempty"`
Variants []ProviderOverride `json:"variants,omitempty"`
Aggregator *ProviderOverride `json:"aggregator,omitempty"`
Automatic bool `json:"automatic,omitempty"`
BaselineID string `json:"baseline_id,omitempty"`
ExpectedQualityDelta float64 `json:"expected_quality_delta,omitempty"`
DecisionReason string `json:"decision_reason,omitempty"`
}
type ConsensusVariantRecord ¶
type ConsensusVariantRecord struct {
VariantIdx int `json:"variant_idx"`
Alias string `json:"alias,omitempty"`
Kind string `json:"kind,omitempty"`
Model string `json:"model,omitempty"`
Status string `json:"status,omitempty"`
Response string `json:"response,omitempty"`
Error string `json:"error,omitempty"`
TokensIn int `json:"tokens_in,omitempty"`
TokensOut int `json:"tokens_out,omitempty"`
CostUSD float64 `json:"cost_usd,omitempty"`
StartedAt string `json:"started_at,omitempty"`
FinishedAt string `json:"finished_at,omitempty"`
}
type DiffFileChange ¶ added in v0.31.99
type DiffTimelineEntry ¶ added in v0.31.99
type DiffTimelineEntry struct {
ID string `json:"id"`
RunID string `json:"run_id"`
SessionID string `json:"session_id,omitempty"`
SessionKind string `json:"session_kind,omitempty"`
Agent string `json:"agent,omitempty"`
Prompt string `json:"prompt,omitempty"`
ParentRunID string `json:"parent_run_id,omitempty"`
RootRunID string `json:"root_run_id,omitempty"`
FlowID string `json:"flow_id,omitempty"`
StepID string `json:"step_id,omitempty"`
StartedAt string `json:"started_at,omitempty"`
CompletedAt string `json:"completed_at,omitempty"`
RepoRoot string `json:"repo_root,omitempty"`
GitInspectorURL string `json:"git_inspector_url,omitempty"`
Summary DiffTimelineSummary `json:"summary"`
Files []DiffFileChange `json:"files,omitempty"`
}
type DiffTimelineSummary ¶ added in v0.31.99
type EffectReceipt ¶ added in v0.35.0
type EffectReceipt struct {
ID string `json:"id"`
LedgerReceiptID string `json:"ledger_receipt_id,omitempty"`
RunID string `json:"run_id"`
RequestID string `json:"request_id"`
IdempotencyKey string `json:"idempotency_key"`
RequestDigest string `json:"request_digest"`
EffectType string `json:"effect_type"`
Status EffectReceiptStatus `json:"status"`
ResultID string `json:"result_id,omitempty"`
ExternalReference string `json:"external_reference,omitempty"`
CreatedAt string `json:"created_at"`
CommittedAt string `json:"committed_at,omitempty"`
}
type EffectReceiptStatus ¶ added in v0.35.0
type EffectReceiptStatus string
const ( EffectReceiptStatusPending EffectReceiptStatus = "pending" EffectReceiptStatusCommitted EffectReceiptStatus = "committed" )
type ExecuteRequest ¶
type ExecuteRequest struct {
RunID string
WorkspaceID string
SessionID string
ExecutionRoot string
Prompt string
SystemPromptAppend string
AllowedTools []string
Tier string
ProviderOverride *ProviderOverride
OverrideSource string
Metadata *PromptExecutionMetadata
RecoveryPlan *RecoveryExecutionPlan
}
type ExecutorCheckpointSupport ¶ added in v0.35.0
type ExecutorCheckpointSupport struct {
Capability CheckpointCapability `json:"capability"`
Limitation string `json:"limitation,omitempty"`
}
type FileAttentionSummary ¶ added in v0.31.52
type FileAttentionSummary struct {
Path string `json:"path"`
Total int `json:"total"`
Reads int `json:"reads,omitempty"`
Edits int `json:"edits,omitempty"`
Lists int `json:"lists,omitempty"`
Writes int `json:"writes,omitempty"`
FirstAt string `json:"first_at,omitempty"`
LastAt string `json:"last_at,omitempty"`
Sparkline []int `json:"sparkline,omitempty"`
}
type PromptExecutionContext ¶
type PromptExecutionContext struct {
ProviderOverride *ProviderOverride
OverrideSource string
Metadata *PromptExecutionMetadata
}
func PromptExecutionFromContext ¶
func PromptExecutionFromContext(ctx context.Context) PromptExecutionContext
type PromptExecutionMetadata ¶
type PromptExecutionMetadata struct {
ResolvedAlias string
ResolvedKind string
ResolvedModel string
OverrideSource string
}
func ResolveOverride ¶
func ResolveOverride(cfg *config.Config, tier string, override *ProviderOverride, overrideSource string) (config.ResolvedLLMTier, PromptExecutionMetadata, error)
type PromptExecutor ¶
type PromptExecutor struct {
// contains filtered or unexported fields
}
func NewPromptExecutor ¶
func NewPromptExecutorWithOptions ¶
func NewPromptExecutorWithOptions(opts PromptExecutorOptions) (*PromptExecutor, error)
func (*PromptExecutor) CheckpointSupport ¶ added in v0.35.0
func (e *PromptExecutor) CheckpointSupport() ExecutorCheckpointSupport
func (*PromptExecutor) Execute ¶
func (e *PromptExecutor) Execute(ctx context.Context, req ExecuteRequest) (string, error)
func (*PromptExecutor) Info ¶
func (e *PromptExecutor) Info() AgentInfo
type PromptExecutorOptions ¶
type PromptExecutorOptions struct {
Name string
Description string
Source string
Entry string
PolicyMode string
ToolsAllow []string
ToolsDeny []string
ToolsRiskMax string
ToolsAllowGroups []string
ToolsDenyGroups []string
ToolsAllowPatterns []string
SessionRoutingMode string
SessionFixedID string
Tier string
ProviderOverride *ProviderOverride
CheckpointSupport ExecutorCheckpointSupport
RunPrompt func(ctx context.Context, runLabel string, prompt string, allowedTools []string, tier string, providerOverride *ProviderOverride) (string, error)
}
type ProviderOverride ¶
type ProviderOverride struct {
Alias string `json:"alias,omitempty" yaml:"alias,omitempty"`
Model string `json:"model,omitempty" yaml:"model,omitempty"`
}
func CloneProviderOverride ¶
func CloneProviderOverride(value *ProviderOverride) *ProviderOverride
type RecoveryExecutionPlan ¶ added in v0.35.0
type RecoveryExecutionPlan struct {
Mode RecoveryMode `json:"mode"`
SourceRunID string `json:"source_run_id"`
CheckpointID string `json:"checkpoint_id"`
ContinuationID string `json:"continuation_id,omitempty"`
ToolResults []RecoveryToolResult `json:"tool_results,omitempty"`
Requests []ToolRequestRecord `json:"requests,omitempty"`
RecordedResults []ToolResultRecord `json:"recorded_results,omitempty"`
EffectReceipts []EffectReceipt `json:"effect_receipts,omitempty"`
}
func RecoveryExecutionFromContext ¶ added in v0.35.0
func RecoveryExecutionFromContext(ctx context.Context) *RecoveryExecutionPlan
type RecoveryMode ¶ added in v0.35.0
type RecoveryMode string
const ( RecoveryModeRetryFromPrompt RecoveryMode = "retry_from_prompt" RecoveryModeReplayFromCheckpoint RecoveryMode = "replay_from_checkpoint" RecoveryModeResumeFromCheckpoint RecoveryMode = "resume_from_checkpoint" )
type RecoveryToolResult ¶ added in v0.35.0
type RecoveryToolResult struct {
RequestID string `json:"request_id"`
Signature string `json:"signature"`
Result string `json:"result"`
IsError bool `json:"is_error,omitempty"`
ReceiptID string `json:"receipt_id,omitempty"`
}
func ConsumeRecoveryToolResult ¶ added in v0.35.0
func ConsumeRecoveryToolResult(plan *RecoveryExecutionPlan, toolName, toolArgs string) (RecoveryToolResult, bool)
ConsumeRecoveryToolResult returns and removes the earliest recorded result matching a tool call. Replay callers must consume results in order so two identical calls do not both reuse the first effect receipt.
func MatchRecoveryToolResult ¶ added in v0.35.0
func MatchRecoveryToolResult(plan *RecoveryExecutionPlan, toolName, toolArgs string) (RecoveryToolResult, bool)
type ReportChannels ¶
type ReportChannels struct {
GeneratedAt string `json:"generated_at"`
ArchiveEnabled bool `json:"archive_enabled"`
Count int `json:"count"`
Messages map[string][]ChannelMessage `json:"messages"`
}
type ReportRuns ¶
type ReportSummary ¶
type ReportSummary struct {
GeneratedAt string `json:"generated_at"`
SummaryEnabled bool `json:"summary_enabled"`
ArchiveEnabled bool `json:"archive_enabled"`
RunsTotal int `json:"runs_total"`
RunsActive int `json:"runs_active"`
RunsByStatus map[string]int `json:"runs_by_status"`
ChannelsTotal int `json:"channels_total"`
MessagesTotal int `json:"messages_total"`
MessagesBySource map[string]int `json:"messages_by_source"`
}
type RestartRequest ¶ added in v0.31.122
type RestartRequest struct {
WorkspaceID string
RunID string
CheckpointID string
Agent string
Tier string
ProviderOverride *ProviderOverride
PromptAdjustment string
Title string
Mode RecoveryMode
ConfirmUnsafeRecovery bool
}
type Run ¶
type Run struct {
ID string `json:"run_id"`
WorkspaceID string `json:"-"`
SessionID string `json:"session_id,omitempty"`
// ExecutionRoot is an optional task-scoped filesystem root provisioned by
// the durable execution plane. It is immutable for the lifetime of a run.
ExecutionRoot string `json:"execution_root,omitempty"`
// TaskID, when set, names the session.Task this run was spawned to work
// on. Read-only metadata that lets UI consumers correlate live run state
// with the task that triggered it. Forwarded from SpawnRequest.TaskID at
// spawn time and never mutated thereafter.
TaskID string `json:"task_id,omitempty"`
WorkID string `json:"work_id,omitempty"`
SessionKind string `json:"session_kind,omitempty"`
Agent string `json:"agent,omitempty"`
Prompt string `json:"prompt,omitempty"`
ParentRunID string `json:"parent_run_id,omitempty"`
RootRunID string `json:"root_run_id,omitempty"`
ParentSessionID string `json:"parent_session_id,omitempty"`
Depth int `json:"depth,omitempty"`
RestartedFromRunID string `json:"restarted_from_run_id,omitempty"`
RestartedFromCheckpointID string `json:"restarted_from_checkpoint_id,omitempty"`
RestartAttempt int `json:"restart_attempt,omitempty"`
RestartReason string `json:"restart_reason,omitempty"`
RecoveryMode RecoveryMode `json:"recovery_mode,omitempty"`
Status RunStatus `json:"status"`
Accepted bool `json:"accepted"`
Response string `json:"response,omitempty"`
Error string `json:"error,omitempty"`
DiagnosticCode string `json:"diagnostic_code,omitempty"`
DiagnosticReason string `json:"diagnostic_reason,omitempty"`
PolicyBlockedTool string `json:"policy_blocked_tool,omitempty"`
PolicyBlockedRule string `json:"policy_blocked_rule,omitempty"`
PolicyBlockedGroup string `json:"policy_blocked_group,omitempty"`
PolicyBlockedSource string `json:"policy_blocked_source,omitempty"`
PolicyAllowedTools []string `json:"policy_allowed_tools,omitempty"`
PolicyDeniedTools []string `json:"policy_denied_tools,omitempty"`
PolicyRiskMax string `json:"policy_risk_max,omitempty"`
FlowID string `json:"flow_id,omitempty"`
StepID string `json:"step_id,omitempty"`
Tier string `json:"tier,omitempty"`
ConsensusMode string `json:"consensus_mode,omitempty"`
ConsensusVariants []ConsensusVariantRecord `json:"consensus_variants,omitempty"`
ConsensusCostUSD float64 `json:"consensus_cost_usd,omitempty"`
ConsensusBudgetUSD float64 `json:"consensus_budget_usd,omitempty"`
ConsensusDecision *ConsensusDecisionRecord `json:"consensus_decision,omitempty"`
FileAttention []FileAttentionSummary `json:"file_attention,omitempty"`
FileOpsTotal int `json:"file_ops_total,omitempty"`
DiffTimeline []DiffTimelineEntry `json:"diff_timeline,omitempty"`
Checkpoints []RunCheckpoint `json:"checkpoints,omitempty"`
ToolRequests []ToolRequestRecord `json:"tool_requests,omitempty"`
ToolResults []ToolResultRecord `json:"tool_results,omitempty"`
EffectReceipts []EffectReceipt `json:"effect_receipts,omitempty"`
LatestContinuation *CheckpointContinuation `json:"latest_continuation,omitempty"`
ProviderOverride *ProviderOverride `json:"provider_override,omitempty"`
ResolvedAlias string `json:"resolved_alias,omitempty"`
ResolvedKind string `json:"resolved_kind,omitempty"`
ResolvedModel string `json:"resolved_model,omitempty"`
OverrideSource string `json:"override_source,omitempty"`
CreatedAt string `json:"created_at"`
StartedAt string `json:"started_at,omitempty"`
CompletedAt string `json:"completed_at,omitempty"`
UpdatedAt string `json:"updated_at"`
}
func NormalizeRunCompatibility ¶ added in v0.35.0
type RunCheckpoint ¶ added in v0.31.122
type RunCheckpoint struct {
SchemaVersion int `json:"schema_version"`
ID string `json:"checkpoint_id"`
RunID string `json:"run_id,omitempty"`
Format CheckpointFormat `json:"format"`
Capability CheckpointCapability `json:"capability"`
Resumable bool `json:"resumable"`
ResumeReason string `json:"resume_reason"`
RecoveryModes []RecoveryMode `json:"recovery_modes"`
RecoveryApprovalRequired bool `json:"recovery_approval_required,omitempty"`
RecoveryApprovalReason string `json:"recovery_approval_reason,omitempty"`
NextAction string `json:"next_action,omitempty"`
StateRefs []CheckpointReference `json:"state_refs,omitempty"`
ToolRequestRefs []CheckpointReference `json:"tool_request_refs,omitempty"`
ToolResultRefs []CheckpointReference `json:"tool_result_refs,omitempty"`
EffectReceiptRefs []CheckpointReference `json:"effect_receipt_refs,omitempty"`
WorkspaceSnapshotRefs []CheckpointReference `json:"workspace_snapshot_refs,omitempty"`
EnvironmentSnapshotRefs []CheckpointReference `json:"environment_snapshot_refs,omitempty"`
Continuation *CheckpointContinuation `json:"continuation,omitempty"`
Kind string `json:"kind"`
Label string `json:"label,omitempty"`
Status RunStatus `json:"status,omitempty"`
Agent string `json:"agent,omitempty"`
Prompt string `json:"prompt,omitempty"`
Tier string `json:"tier,omitempty"`
ProviderOverride *ProviderOverride `json:"provider_override,omitempty"`
AllowedTools []string `json:"allowed_tools,omitempty"`
Error string `json:"error,omitempty"`
CreatedAt string `json:"created_at"`
}
type RunEvent ¶
type RunEvent struct {
Type string `json:"type"`
RunID string `json:"run_id"`
Timestamp string `json:"timestamp,omitempty"`
Agent string `json:"agent,omitempty"`
Status string `json:"status,omitempty"`
Tier string `json:"tier,omitempty"`
ResolvedAlias string `json:"resolved_alias,omitempty"`
ResolvedKind string `json:"resolved_kind,omitempty"`
ResolvedModel string `json:"resolved_model,omitempty"`
Error string `json:"error,omitempty"`
Message string `json:"message,omitempty"`
Response string `json:"response,omitempty"`
VariantCount int `json:"variant_count,omitempty"`
VariantIdx int `json:"variant_idx,omitempty"`
Alias string `json:"alias,omitempty"`
Kind string `json:"kind,omitempty"`
Model string `json:"model,omitempty"`
Strategy string `json:"strategy,omitempty"`
TokenBudget int `json:"token_budget,omitempty"`
TokensIn int `json:"tokens_in,omitempty"`
TokensOut int `json:"tokens_out,omitempty"`
FinalTokens int `json:"final_tokens,omitempty"`
CostUSDEstimate float64 `json:"cost_usd_estimate,omitempty"`
CostUSDActual float64 `json:"cost_usd_actual,omitempty"`
Automatic bool `json:"automatic,omitempty"`
BaselineID string `json:"baseline_id,omitempty"`
ExpectedQualityDelta float64 `json:"expected_quality_delta,omitempty"`
ToolName string `json:"tool_name,omitempty"`
ToolCallID string `json:"tool_call_id,omitempty"`
Path string `json:"path,omitempty"`
Action string `json:"action,omitempty"`
ToolIsError bool `json:"tool_is_error,omitempty"`
CheckpointID string `json:"checkpoint_id,omitempty"`
CheckpointKind string `json:"checkpoint_kind,omitempty"`
}
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
func NewRuntime ¶
func NewRuntime(opts RuntimeOptions) *Runtime
func (*Runtime) CancelByWorkspace ¶
func (*Runtime) ConsensusEnabled ¶ added in v0.31.51
func (*Runtime) GetByWorkspace ¶
func (*Runtime) InboundTelegram ¶
func (*Runtime) InboundTelegramByWorkspace ¶
func (*Runtime) InboundWebhook ¶
func (*Runtime) InboundWebhookByWorkspace ¶
func (*Runtime) ListByWorkspace ¶
func (*Runtime) MessageRead ¶
func (r *Runtime) MessageRead(channelID string, limit int) ([]ChannelMessage, error)
func (*Runtime) MessageReadByWorkspace ¶
func (r *Runtime) MessageReadByWorkspace(workspaceID, channelID string, limit int) ([]ChannelMessage, error)
func (*Runtime) MessageSend ¶
func (r *Runtime) MessageSend(channelID, threadID, text string) (ChannelMessage, error)
func (*Runtime) MessageSendByWorkspace ¶
func (r *Runtime) MessageSendByWorkspace(workspaceID, channelID, threadID, text string) (ChannelMessage, error)
func (*Runtime) OutboundTelegram ¶
func (*Runtime) OutboundTelegramByWorkspace ¶
func (*Runtime) Reload ¶
func (r *Runtime) Reload() AgentRuntimeStatus
func (*Runtime) ReportsChannels ¶
func (r *Runtime) ReportsChannels(limit int) (ReportChannels, error)
func (*Runtime) ReportsChannelsByWorkspace ¶
func (r *Runtime) ReportsChannelsByWorkspace(workspaceID string, limit int) (ReportChannels, error)
ReportsChannelsByWorkspace returns recent in-memory channel messages. See ReportsRunsByWorkspace for why AgentRuntimeArchiveEnabled also gates this endpoint despite reading from in-memory state (RF-057, ID-005).
func (*Runtime) ReportsRuns ¶
func (r *Runtime) ReportsRuns(limit int) (ReportRuns, error)
func (*Runtime) ReportsRunsByWorkspace ¶
func (r *Runtime) ReportsRunsByWorkspace(workspaceID string, limit int) (ReportRuns, error)
ReportsRunsByWorkspace returns recent in-memory run summaries.
Despite the name, the gating flag AgentRuntimeArchiveEnabled doubles as the "report endpoint visibility" switch — it controls both on-disk archive writes and whether this in-memory report endpoint serves data, even though the data itself is from r.runs (memory) and never touches the archive directory. Operators who want only the report endpoint without disk archives still have to enable archive_enabled. Splitting this into a dedicated AgentRuntimeReportEnabled flag is tracked in RF-057 as part of the broader config namespace migration (ID-005).
func (*Runtime) ReportsSummary ¶
func (r *Runtime) ReportsSummary() (ReportSummary, error)
func (*Runtime) ReportsSummaryByWorkspace ¶
func (r *Runtime) ReportsSummaryByWorkspace(workspaceID string) (ReportSummary, error)
func (*Runtime) Restart ¶
func (r *Runtime) Restart() AgentRuntimeStatus
func (*Runtime) RestartFromCheckpoint ¶ added in v0.31.122
func (*Runtime) SetAgentsWatchEnabled ¶
func (*Runtime) SetEffectReceiptStore ¶ added in v0.35.0
func (*Runtime) SetExecutors ¶
func (r *Runtime) SetExecutors(executors []AgentExecutor, defaultAgent string)
func (*Runtime) Status ¶
func (r *Runtime) Status() AgentRuntimeStatus
func (*Runtime) SubagentLimits ¶
func (*Runtime) SubscribeRunEvents ¶
func (*Runtime) ThreadReply ¶
func (r *Runtime) ThreadReply(channelID, threadID, text string) (ChannelMessage, error)
func (*Runtime) ThreadReplyByWorkspace ¶
func (r *Runtime) ThreadReplyByWorkspace(workspaceID, channelID, threadID, text string) (ChannelMessage, error)
type RuntimeExecutionRecorder ¶ added in v0.35.0
type RuntimeExecutionRecorder func(RuntimeToolCall) error
func RuntimeExecutionRecorderFromContext ¶ added in v0.35.0
func RuntimeExecutionRecorderFromContext(ctx context.Context) RuntimeExecutionRecorder
type RuntimeOptions ¶
type RuntimeOptions struct {
Enabled bool
WorkspaceDir string
SessionStore *session.Store
SessionStoreForWorkspace func(workspaceID string) *session.Store
RunPrompt func(ctx context.Context, runLabel string, prompt string) (string, error)
RunPromptCheckpointSupport ExecutorCheckpointSupport
Executors []AgentExecutor
DefaultAgent string
AgentRuntimeAgentsWatchEnabled bool
ChannelsLocalEnabled bool
ChannelsWebhookEnabled bool
ChannelsTelegramEnabled bool
AgentRuntimePersistenceEnabled bool
AgentRuntimeRunsPersistenceEnabled bool
AgentRuntimeChannelsPersistenceEnabled bool
AgentRuntimeRunsMaxRecords int
AgentRuntimeChannelsMaxMessagesPerChannel int
AgentRuntimeSubagentsMaxThreads int
AgentRuntimeSubagentsMaxDepth int
AgentRuntimeConsensusEnabled bool
AgentRuntimeConsensusMaxFanout int
AgentRuntimeConsensusBudgetTokens int
AgentRuntimeConsensusBudgetUSD float64
AgentRuntimeConsensusTimeoutSeconds int
AgentRuntimeConsensusAllowedAliases []string
AgentRuntimeConsensusConcurrentRuns int
AgentRuntimePersistenceDir string
AgentRuntimeRestoreOnStartup bool
AgentRuntimeReportSummaryEnabled bool
AgentRuntimeArchiveEnabled bool
AgentRuntimeArchiveDir string
AgentRuntimeArchiveRetentionDays int
AgentRuntimeArchiveMaxFileBytes int
ResolveProviderOverride func(tier string, override *ProviderOverride) (ResolvedProviderOverride, error)
EstimateTokensCost func(provider, model string, inputTokens, outputTokens int) (float64, bool)
UsageTracker *usage.Tracker
// OnRunsSnapshot observes a read-only copy of the current run slice after
// state changes. It is independent of file persistence so a durable control
// plane can mirror runs even when legacy runs.json storage is disabled.
OnRunsSnapshot func(runs []Run)
Now func() time.Time
}
type RuntimeToolCall ¶ added in v0.31.52
type RuntimeToolCallRecorder ¶ added in v0.31.52
type RuntimeToolCallRecorder func(RuntimeToolCall)
func RuntimeToolCallRecorderFromContext ¶ added in v0.31.52
func RuntimeToolCallRecorderFromContext(ctx context.Context) RuntimeToolCallRecorder
type RuntimeToolPhase ¶ added in v0.35.0
type RuntimeToolPhase string
const ( RuntimeToolPhaseBefore RuntimeToolPhase = "before_tool" RuntimeToolPhaseAfter RuntimeToolPhase = "after_tool" RuntimeToolPhaseProvider RuntimeToolPhase = "provider_tool" RuntimeToolPhaseAfterLLM RuntimeToolPhase = "after_llm" )
type SpawnRequest ¶
type SpawnRequest struct {
WorkspaceID string
WorkID string
SessionID string
TaskID string
ExecutionRoot string
Title string
Prompt string
SystemPromptAppend string
Agent string
ParentRunID string
RootRunID string
ParentSessionID string
Depth int
SessionKind string
SessionHidden bool
FlowID string
StepID string
Tier string
Mode string
Consensus *ConsensusSpec
ProviderOverride *ProviderOverride
RestartedFromRunID string
RestartedFromCheckpointID string
RestartAttempt int
RestartReason string
RecoveryMode RecoveryMode
RecoveryPlan *RecoveryExecutionPlan
}
type ToolRequestRecord ¶ added in v0.35.0
type ToolRequestRecord struct {
ID string `json:"id"`
RunID string `json:"run_id"`
Iteration int `json:"iteration"`
ToolName string `json:"tool_name"`
ToolCallID string `json:"tool_call_id,omitempty"`
ArgsDigest string `json:"args_digest"`
Signature string `json:"signature"`
EffectClass string `json:"effect_class"`
IdempotencyKey string `json:"idempotency_key"`
DownstreamIdempotencyKey string `json:"downstream_idempotency_key,omitempty"`
IdempotencyKeyArgument string `json:"idempotency_key_argument,omitempty"`
SafeToRetryPending bool `json:"safe_to_retry_pending"`
Status ToolRequestStatus `json:"status"`
ResultID string `json:"result_id,omitempty"`
EffectReceiptID string `json:"effect_receipt_id,omitempty"`
RequestedAt string `json:"requested_at"`
CompletedAt string `json:"completed_at,omitempty"`
}
type ToolRequestStatus ¶ added in v0.35.0
type ToolRequestStatus string
const ( ToolRequestStatusPending ToolRequestStatus = "pending" ToolRequestStatusCommitted ToolRequestStatus = "committed" ToolRequestStatusReplayed ToolRequestStatus = "replayed" )
type ToolResultRecord ¶ added in v0.35.0
type ToolResultRecord struct {
ID string `json:"id"`
RunID string `json:"run_id"`
RequestID string `json:"request_id"`
Digest string `json:"digest"`
Result string `json:"result,omitempty"`
IsError bool `json:"is_error,omitempty"`
Replayed bool `json:"replayed,omitempty"`
ReceiptID string `json:"receipt_id,omitempty"`
Truncated bool `json:"truncated,omitempty"`
CreatedAt string `json:"created_at"`
}
Source Files
¶
- checkpoint_types.go
- consensus.go
- events.go
- execute_context.go
- execution_semaphore.go
- executor.go
- persistence.go
- recovery_context.go
- resolve_override.go
- runtime.go
- runtime_archive.go
- runtime_channels.go
- runtime_checkpoints.go
- runtime_diff_timeline.go
- runtime_effect_receipts.go
- runtime_effect_types.go
- runtime_executors.go
- runtime_file_attention.go
- runtime_persist.go
- runtime_reports.go
- runtime_restart.go
- runtime_run_bootstrap.go
- runtime_run_execute.go
- runtime_runs.go
- runtime_tool_capture.go
- runtime_usage_signals.go
- semaphore.go
- system_prompt_context.go
- types.go