Documentation
¶
Index ¶
- Constants
- Variables
- func InitialApprovalState(agent *Agent) string
- func IsActiveStatus(status string) bool
- func IsTerminalStatus(status string) bool
- func NormalizeRun(run *AgentRun)
- func RequiresExplicitTurnFinish(run *AgentRun) bool
- func ShouldPauseAfterAssistant(run *AgentRun) bool
- func TurnIdentity(run *AgentRun) string
- func ValidateTurnPolicy(policy TurnPolicy, runtimeKind string) error
- func WithTurnEventMetadata(run *AgentRun, eventType string, data map[string]interface{}) map[string]interface{}
- type Agent
- type AgentRun
- type AgentRunArtifact
- type AgentRunEvent
- type AgentRunInteraction
- type AgentRunMessage
- type ModelCredentialStore
- type NativeState
- type NativeStateStore
- type RunInput
- type RunMCPServer
- type RunMCPTool
- type RunModelCredential
- type RunPage
- type RunSearch
- type RunStatusScan
- type RunSummaryStore
- type SkillRef
- type Store
- type TargetDisplay
- type TargetRef
- type ToolCall
- type TurnPolicy
- type Usage
- type WorkspaceLease
Constants ¶
const ( MCPTransportStreamableHTTP = "streamable_http" MCPToolAccessRead = "read" MCPToolAccessWrite = "write" )
const ( RuntimeNativeSDK = sdk.RuntimeNativeSDK RuntimeCodex = sdk.RuntimeCodex RuntimeOpenCode = sdk.RuntimeOpenCode // RuntimeA2A runs turns on an external agent over the A2A protocol. RuntimeA2A = "a2a" InvocationAutonomous = sdk.InvocationAutonomous InvocationInteractive = sdk.InvocationInteractive ApprovalModeNever = sdk.ApprovalModeNever ApprovalModeAlways = sdk.ApprovalModeAlways // ApprovalModeMutatingTools starts runs immediately and requires approval // only when a mutating tool is about to execute. ApprovalModeMutatingTools = "mutating_tools" // ApprovalModeRiskBased allows routine reversible mutations and pauses // before sensitive or destructive tools. ApprovalModeRiskBased = "risk_based" RunStatusQueued = sdk.RunStatusQueued RunStatusRunning = sdk.RunStatusRunning RunStatusPaused = sdk.RunStatusPaused RunStatusCompleted = sdk.RunStatusCompleted RunStatusFailed = sdk.RunStatusFailed RunStatusCancelled = sdk.RunStatusCancelled PauseReasonNone = sdk.PauseReasonNone PauseReasonHumanInput = sdk.PauseReasonHumanInput PauseReasonHumanApproval = sdk.PauseReasonHumanApproval PauseReasonAuth = sdk.PauseReasonAuth PauseReasonUserMessage = sdk.PauseReasonUserMessage PauseReasonManual = sdk.PauseReasonManual ResumeIntentContinue = sdk.ResumeIntentContinue TurnPolicyCompleteOnFinish = sdk.TurnPolicyCompleteOnFinish TurnPolicyPauseAfterAssist = sdk.TurnPolicyPauseAfterAssist TurnCompletionImplicit = sdk.TurnCompletionImplicit TurnCompletionExplicit = sdk.TurnCompletionExplicit ApprovalNotRequired = sdk.ApprovalNotRequired ApprovalPending = sdk.ApprovalPending ApprovalApproved = sdk.ApprovalApproved ApprovalRejected = sdk.ApprovalRejected )
Variables ¶
var ErrNativeStateConflict = errors.New("native execution checkpoint changed")
ErrNativeStateConflict prevents two executors from overwriting a checkpoint.
var RuntimeBuildRevision = sync.OnceValue(func() string { if info, ok := debug.ReadBuildInfo(); ok { for _, setting := range info.Settings { if setting.Key == "vcs.revision" { return setting.Value } } } return "unknown" })
RuntimeBuildRevision makes rollout diagnostics explicit even for local builds.
Functions ¶
func InitialApprovalState ¶
func IsActiveStatus ¶
func IsTerminalStatus ¶
func NormalizeRun ¶
func NormalizeRun(run *AgentRun)
func RequiresExplicitTurnFinish ¶
RequiresExplicitTurnFinish reports whether the current assistant turn must use the runtime-owned finish_turn control tool before it may end.
func TurnIdentity ¶
TurnIdentity is shared by adapters and lifecycle events. A retry reuses the accepted resume ID; a subsequent user reply or interaction gets a new ID.
func ValidateTurnPolicy ¶
func ValidateTurnPolicy(policy TurnPolicy, runtimeKind string) error
ValidateTurnPolicy rejects unsupported completion contracts before they can be normalized into a weaker policy.
Types ¶
type AgentRunArtifact ¶
type AgentRunArtifact = sdk.AgentRunArtifact
type AgentRunEvent ¶
type AgentRunEvent = sdk.EventEnvelope
type AgentRunInteraction ¶
type AgentRunInteraction = sdk.AgentRunInteraction
type AgentRunMessage ¶
type AgentRunMessage = sdk.AgentRunMessage
type ModelCredentialStore ¶
type ModelCredentialStore interface {
CreateRunWithModelCredential(context.Context, *AgentRun, []RunMCPServer, *RunModelCredential) error
GetRunModelCredential(context.Context, string, string) (*RunModelCredential, error)
ReplaceRunModelCredential(context.Context, *RunModelCredential, int64) (bool, error)
ClearRunModelCredential(context.Context, string, string) error
}
type NativeState ¶
type NativeState struct {
AppID string
RunID string
Version int64
Payload json.RawMessage
}
NativeState is private runtime state, independent of the host's run projection.
type NativeStateStore ¶
type NativeStateStore interface {
LoadNativeState(context.Context, string, string) (*NativeState, error)
SaveNativeState(context.Context, *NativeState, []json.RawMessage) error
}
NativeStateStore atomically checkpoints active context and archives new records. It is optional so existing Store implementations remain source compatible.
type RunMCPServer ¶
type RunMCPServer struct {
AppID string
RunID string
ServerID string
ServerName string
Transport string
URL string
Tools []RunMCPTool
Skills []SkillRef
EncryptedCredential []byte
CreatedAt time.Time
}
RunMCPServer is the encrypted, run-scoped MCP attachment persisted beside a run. EncryptedCredential is opaque outside the MCP credential codec.
type RunMCPTool ¶
type RunModelCredential ¶
type RunModelCredential struct {
AppID string `gorm:"primaryKey"`
RunID string `gorm:"primaryKey"`
Provider string
Kind string
ConnectionID string
AccountID string
EncryptedCredential []byte
Version int64
Revoked bool
}
RunModelCredential is never part of the public run representation.
func (RunModelCredential) TableName ¶
func (RunModelCredential) TableName() string
type RunStatusScan ¶ added in v0.13.20
type RunStatusScan struct {
Statuses []string
ExecutionMode string // optional exact match
UpdatedBefore time.Time // optional; keeps runs updated at or before it
AfterCreated time.Time // keyset cursor from the previous page's last run
AfterID string
Limit int
}
RunStatusScan selects one keyset page of runs in the given statuses, ordered by (created_at, id). Background reconcilers page through it so a large active-run backlog is never loaded into memory at once.
type RunSummaryStore ¶
type RunSummaryStore interface {
UpdateRunOutputSummary(context.Context, string, string, json.RawMessage) error
}
RunSummaryStore updates execution output without writing stale lifecycle state.
type Store ¶
type Store interface {
CreateAgent(ctx context.Context, agent *Agent) error
GetAgent(ctx context.Context, appID, agentID string) (*Agent, error)
ListAgents(ctx context.Context, appID string) ([]Agent, error)
UpdateAgent(ctx context.Context, agent *Agent) error
CreateRun(ctx context.Context, run *AgentRun) error
CreateRunWithMCP(ctx context.Context, run *AgentRun, servers []RunMCPServer) error
GetRun(ctx context.Context, appID, runID string) (*AgentRun, error)
GetRunByHostRunID(ctx context.Context, appID, hostRunID string) (*AgentRun, error)
ListRuns(ctx context.Context, appID string) ([]AgentRun, error)
ListRunsByStatus(ctx context.Context, statuses ...string) ([]AgentRun, error)
ScanRunsByStatus(ctx context.Context, scan RunStatusScan) ([]AgentRun, error)
SearchRuns(ctx context.Context, search RunSearch) (*RunPage, error)
UpdateRun(ctx context.Context, run *AgentRun) error
ListRunMCPServers(ctx context.Context, appID, runID string) ([]RunMCPServer, error)
UpdateRunMCPCredential(ctx context.Context, appID, runID, serverID string, encryptedCredential []byte) error
ClearRunMCPCredentials(ctx context.Context, appID, runID string) error
AppendMessage(ctx context.Context, message *AgentRunMessage) error
ListMessages(ctx context.Context, appID, runID string) ([]AgentRunMessage, error)
AppendArtifact(ctx context.Context, artifact *AgentRunArtifact) error
ListArtifacts(ctx context.Context, appID, runID string) ([]AgentRunArtifact, error)
AppendInteraction(ctx context.Context, interaction *AgentRunInteraction) error
ListInteractions(ctx context.Context, appID, runID string) ([]AgentRunInteraction, error)
UpdateInteraction(ctx context.Context, interaction *AgentRunInteraction) error
AppendToolCall(ctx context.Context, call *ToolCall) error
ListToolCalls(ctx context.Context, appID, runID string) ([]ToolCall, error)
AppendEvent(ctx context.Context, event *AgentRunEvent) error
ListEvents(ctx context.Context, appID, runID string) ([]AgentRunEvent, error)
}
type TargetDisplay ¶
type TargetDisplay = sdk.TargetDisplay
type TurnPolicy ¶
type TurnPolicy = sdk.TurnPolicy
func NormalizeTurnPolicy ¶
func NormalizeTurnPolicy(policy TurnPolicy) TurnPolicy
type WorkspaceLease ¶
type WorkspaceLease = sdk.WorkspaceLease