Help us shape the future of Go! Take the 2026 Go Developer Survey

agentcore

package
v0.13.21 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MCPTransportStreamableHTTP = "streamable_http"
	MCPToolAccessRead          = "read"
	MCPToolAccessWrite         = "write"
)
View Source
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

View Source
var ErrNativeStateConflict = errors.New("native execution checkpoint changed")

ErrNativeStateConflict prevents two executors from overwriting a checkpoint.

View Source
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 InitialApprovalState(agent *Agent) string

func IsActiveStatus

func IsActiveStatus(status string) bool

func IsTerminalStatus

func IsTerminalStatus(status string) bool

func NormalizeRun

func NormalizeRun(run *AgentRun)

func RequiresExplicitTurnFinish

func RequiresExplicitTurnFinish(run *AgentRun) bool

RequiresExplicitTurnFinish reports whether the current assistant turn must use the runtime-owned finish_turn control tool before it may end.

func ShouldPauseAfterAssistant

func ShouldPauseAfterAssistant(run *AgentRun) bool

func TurnIdentity

func TurnIdentity(run *AgentRun) string

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.

func WithTurnEventMetadata

func WithTurnEventMetadata(run *AgentRun, eventType string, data map[string]interface{}) map[string]interface{}

WithTurnEventMetadata is additive; legacy runs retain their old wire shape.

Types

type Agent

type Agent = sdk.Agent

type AgentRun

type AgentRun = sdk.AgentRun

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 RunInput

type RunInput = sdk.RunInput

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 RunMCPTool struct {
	Name   string `json:"name"`
	Access string `json:"access"`
}

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 RunPage

type RunPage struct {
	Items  []AgentRun `json:"items"`
	Total  int64      `json:"total"`
	Limit  int        `json:"limit"`
	Offset int        `json:"offset"`
}

type RunSearch

type RunSearch struct {
	AppID  string
	Status string
	Query  string
	Limit  int
	Offset int
}

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 SkillRef

type SkillRef = sdk.SkillRef

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 TargetRef

type TargetRef = sdk.TargetRef

type ToolCall

type ToolCall = sdk.ToolCall

type TurnPolicy

type TurnPolicy = sdk.TurnPolicy

func NormalizeTurnPolicy

func NormalizeTurnPolicy(policy TurnPolicy) TurnPolicy

type Usage

type Usage = sdk.Usage

type WorkspaceLease

type WorkspaceLease = sdk.WorkspaceLease

Jump to

Keyboard shortcuts

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