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

runtime

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: 44 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NativeCheckpointUsage

func NativeCheckpointUsage(ctx context.Context, store agentcore.Store, appID, runID string) (json.RawMessage, error)

NativeCheckpointUsage recovers durable usage even if execution returned an error.

func NativeInterruptedEffects added in v0.11.2

func NativeInterruptedEffects(ctx context.Context, store agentcore.Store, appID, runID string) (json.RawMessage, error)

NativeInterruptedEffects exposes checkpointed uncertainties to cancellation summaries and successor context without returning private provider state.

Types

type A2AAdapter added in v0.13.4

type A2AAdapter struct {
	// contains filtered or unexported fields
}

A2AAdapter runs a turn on an external agent over the A2A v1.0 protocol. The runtime sends one message per turn and follows the resulting task by polling GetTask until it finishes or asks for input. Polling survives proxies and activity retries better than a two-hour stream, and a retried activity can pick the task up again from the persisted task id.

func NewA2AAdapter added in v0.13.4

func NewA2AAdapter() *A2AAdapter

func (*A2AAdapter) CancelRemote added in v0.13.4

func (a *A2AAdapter) CancelRemote(ctx context.Context, run *agentcore.AgentRun, targetContext *host.TargetContext) error

CancelRemote asks the external agent to cancel the run's task. The caller supplies a freshly resolved target context with the connection details.

func (*A2AAdapter) Execute added in v0.13.4

func (a *A2AAdapter) Execute(execCtx *ExecutionContext) (*Result, error)

func (*A2AAdapter) Kind added in v0.13.4

func (a *A2AAdapter) Kind() string

func (*A2AAdapter) NeedsRemoteCancel added in v0.13.4

func (a *A2AAdapter) NeedsRemoteCancel(run *agentcore.AgentRun) bool

NeedsRemoteCancel reports whether the run has a remote task that is still alive, including one paused for input.

type Adapter

type Adapter interface {
	Kind() string
	Execute(ctx *ExecutionContext) (*Result, error)
}

type ArtifactWriter

type ArtifactWriter interface {
	WriteArtifact(ctx context.Context, artifact agentcore.AgentRunArtifact) error
}

type EinoAgenticModelFactory

type EinoAgenticModelFactory struct {
	Model    einomodel.AgenticModel
	Provider string
}

func (EinoAgenticModelFactory) ResolveNativeModel

func (f EinoAgenticModelFactory) ResolveNativeModel(ctx context.Context, execCtx *ExecutionContext, definitions []tools.Definition) (NativeModel, error)

type EinoChatModelFactory

type EinoChatModelFactory struct {
	Model einomodel.ToolCallingChatModel
}

func (EinoChatModelFactory) ResolveNativeModel

func (f EinoChatModelFactory) ResolveNativeModel(ctx context.Context, execCtx *ExecutionContext, definitions []tools.Definition) (NativeModel, error)

type EinoProviderFactory

type EinoProviderFactory struct {
	AnthropicAPIKey   string
	AnthropicBaseURL  string
	OpenAIAPIKey      string
	OpenAIBaseURL     string
	OpenRouterAPIKey  string
	OpenRouterBaseURL string
	DefaultProvider   string
	DefaultModel      string
	MaxTokens         int
}

func (EinoProviderFactory) ResolveNativeModel

func (f EinoProviderFactory) ResolveNativeModel(ctx context.Context, execCtx *ExecutionContext, definitions []tools.Definition) (NativeModel, error)

type Event

type Event = sdk.Event

type EventSink

type EventSink interface {
	Emit(ctx context.Context, event Event)
}

type ExecutionContext

type ExecutionContext struct {
	ModelCredentials          *modelauth.Manager
	Context                   context.Context
	AppID                     string
	Agent                     *agentcore.Agent
	Run                       *agentcore.AgentRun
	Store                     agentcore.Store
	TargetContext             *host.TargetContext
	WorkspaceLease            *agentcore.WorkspaceLease
	AllowedTools              map[string]bool
	Tools                     *tools.Registry
	WorkspaceManager          tools.WorkspaceManager
	SkillRefs                 []agentcore.SkillRef
	SkillDefinitions          []skills.Definition
	AvailableSkillRefs        []agentcore.SkillRef
	AvailableSkillDefinitions []skills.Definition
	SkillInstructions         string
	SkillPolicy               skills.Policy
	UsesSplitSkills           bool
	StagedSkillRoot           string
	ArtifactWriter            ArtifactWriter
	InteractionBroker         InteractionBroker
	EventSink                 EventSink
	MCPBrokerURL              string
	MCPBrokerToken            string
}

type InteractionBroker

type InteractionBroker interface {
	RequestInteraction(ctx context.Context, interaction agentcore.AgentRunInteraction) error
}

type NativeAdapter

type NativeAdapter struct {
	// contains filtered or unexported fields
}

func NewNativeAdapter

func NewNativeAdapter() *NativeAdapter

func NewNativeAdapterWithConfig

func NewNativeAdapterWithConfig(cfg NativeConfig) *NativeAdapter

func (*NativeAdapter) Execute

func (a *NativeAdapter) Execute(execCtx *ExecutionContext) (*Result, error)

func (*NativeAdapter) Kind

func (a *NativeAdapter) Kind() string

type NativeBlock

type NativeBlock struct {
	Type           string          `json:"type"`
	Text           string          `json:"text,omitempty"`
	ToolCallID     string          `json:"tool_call_id,omitempty"`
	ToolName       string          `json:"tool_name,omitempty"`
	Input          json.RawMessage `json:"input,omitempty"`
	Output         string          `json:"output,omitempty"`
	IsError        bool            `json:"is_error,omitempty"`
	FinishRejected bool            `json:"-"`
}

type NativeConfig

type NativeConfig struct {
	Reviewer     *TypeSafeReviewer
	ModelFactory NativeModelFactory
	MaxToolSteps int
}

func DefaultNativeConfigFromEnv

func DefaultNativeConfigFromEnv() NativeConfig

type NativeContextPolicy

type NativeContextPolicy struct {
	Enabled          bool  `json:"enabled"`
	ContextWindow    int   `json:"context_window,omitempty"`
	InputLimit       int   `json:"input_limit,omitempty"`
	MaxOutputTokens  int   `json:"max_output_tokens,omitempty"`
	TriggerTokens    int   `json:"trigger_tokens,omitempty"`
	KeepRecentTokens int   `json:"keep_recent_tokens,omitempty"`
	UserAnchorTokens int   `json:"user_anchor_tokens,omitempty"`
	SummaryTokens    int   `json:"summary_tokens,omitempty"`
	SafetyTokens     int   `json:"safety_tokens,omitempty"`
	MaxTotalTokens   int64 `json:"max_total_tokens,omitempty"`
}

NativeContextPolicy is opt-in until a provider/model's limits are configured.

type NativeMessage

type NativeMessage struct {
	ProviderState    *NativeProviderState `json:"provider_state,omitempty"`
	Role             string               `json:"role"`
	Content          string               `json:"content,omitempty"`
	ReasoningContent string               `json:"reasoning_content,omitempty"`
	Blocks           []NativeBlock        `json:"blocks,omitempty"`
	ContextSummary   bool                 `json:"context_summary,omitempty"`
	// Provenance is checkpoint metadata; it is not a provider role. Empty is
	// retained for old checkpoints and must not be upgraded to known human.
	Provenance string `json:"provenance,omitempty"`
}

type NativeModel

type NativeModel interface {
	Generate(ctx context.Context, req NativeModelRequest) (*NativeModelResponse, error)
}

type NativeModelFactory

type NativeModelFactory interface {
	ResolveNativeModel(ctx context.Context, execCtx *ExecutionContext, definitions []tools.Definition) (NativeModel, error)
}

type NativeModelRequest

type NativeModelRequest struct {
	SystemPrompt string             `json:"system_prompt,omitempty"`
	Messages     []NativeMessage    `json:"messages"`
	Tools        []tools.Definition `json:"tools,omitempty"`
	Step         int                `json:"step"`
}

type NativeModelResponse

type NativeModelResponse struct {
	Message      NativeMessage         `json:"message"`
	Usage        NativeUsage           `json:"usage,omitempty"`
	Continuation *ProviderContinuation `json:"continuation,omitempty"`
	Incomplete   bool                  `json:"incomplete,omitempty"`
}

type NativeModelStream

type NativeModelStream interface {
	Recv() (*NativeModelResponse, error)
	Close()
}

type NativeProviderState

type NativeProviderState struct {
	Provider  string          `json:"provider"`
	Reasoning json.RawMessage `json:"reasoning"`
}

NativeProviderState is internal checkpoint state, not displayable reasoning.

type NativeStreamingModel

type NativeStreamingModel interface {
	Stream(ctx context.Context, req NativeModelRequest) (NativeModelStream, error)
}

type NativeSummaryModel

type NativeSummaryModel interface {
	Summarize(context.Context, string, int) (*NativeModelResponse, error)
}

NativeSummaryModel generates a bounded summary without exposing tools.

type NativeUsage

type NativeUsage struct {
	InputTokens           int64 `json:"input_tokens,omitempty"`
	CachedInputTokens     int64 `json:"cached_input_tokens,omitempty"`
	OutputTokens          int64 `json:"output_tokens,omitempty"`
	ReasoningOutputTokens int64 `json:"reasoning_output_tokens,omitempty"`
}

type ProviderCapability

type ProviderCapability struct {
	Protocols                []string `json:"protocols,omitempty"`
	Controls                 []string `json:"controls,omitempty"`
	TranscriptContinuation   bool     `json:"transcript_continuation"`
	LosslessResponseReplay   bool     `json:"lossless_response_replay"`
	AuthModes                []string `json:"auth_modes"`
	RunCredentialsConfigured bool     `json:"run_credentials_configured"`
	Name                     string   `json:"name"`
	Configured               bool     `json:"configured"`
	DefaultModel             string   `json:"default_model"`
	BaseURLOverridden        bool     `json:"base_url_overridden"`
}

ProviderCapability reports whether a native-SDK model provider is configured (i.e. its API key is present) along with the default model it would use.

func NativeProviderCapabilities

func NativeProviderCapabilities() []ProviderCapability

NativeProviderCapabilities returns the configuration state of each supported native-SDK provider, derived from the environment. It is the single source of truth for which providers/models the runtime would use.

type ProviderContinuation

type ProviderContinuation struct {
	Provider           string `json:"provider,omitempty"`
	ResponseID         string `json:"response_id,omitempty"`
	PreviousResponseID string `json:"previous_response_id,omitempty"`
	AfterSequenceNo    int    `json:"after_sequence_no,omitempty"`
}

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

func NewRegistry

func NewRegistry(adapters ...Adapter) *Registry

func (*Registry) Get

func (r *Registry) Get(kind string) (Adapter, error)

type RemoteCanceler added in v0.13.4

type RemoteCanceler interface {
	NeedsRemoteCancel(run *agentcore.AgentRun) bool
	CancelRemote(ctx context.Context, run *agentcore.AgentRun, targetContext *host.TargetContext) error
}

RemoteCanceler is implemented by adapters whose work continues on another service. Engine.CancelRun asks them to stop that work; worker shutdown does not, because a durable retry resumes the same remote work.

type Result

type Result struct {
	AssistantMessage      string
	AssistantMessageID    string
	OutputSummary         json.RawMessage
	WaitForApproval       bool
	AwaitingInput         bool
	AwaitingAuth          bool
	MessagesPersisted     bool
	TurnFinished          bool
	TurnOutcome           string
	CompletionCorrections int
}

type TypeSafeReviewer added in v0.11.2

type TypeSafeReviewer struct {
	APIKey              string
	Model               string
	EvaluatedModel      string
	AskedThreshold      float64
	HazardThreshold     float64
	EscalationThreshold float64
	AutoApprove         bool
	Client              *http.Client
}

TypeSafeReviewer is operator-owned configuration, independent of run models. Enabling it discloses selected command/repository context to TypeSafe.

Jump to

Keyboard shortcuts

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