Documentation
¶
Overview ¶
Package runtimeapi exposes the public, Temporal-free HTTP boundary of Agent Runtime.
Index ¶
- func NewHandler(config Config) (http.Handler, error)
- type Authenticator
- type Clock
- type Config
- type HMACIdentityCorrelator
- type Identity
- type IdentityCorrelation
- type IdentityCorrelator
- type Observability
- type RequestObservation
- type RequestObserver
- type RequestOutcome
- type Runtime
- type StateRuntime
- func (runtime *StateRuntime) CancelSession(ctx context.Context, identity Identity, ...) (agentruntime.Session, error)
- func (runtime *StateRuntime) CancelTurn(ctx context.Context, identity Identity, request agentruntime.CancelTurnRequest) (agentruntime.Turn, error)
- func (runtime *StateRuntime) CloseSession(ctx context.Context, identity Identity, ...) (agentruntime.Session, error)
- func (runtime *StateRuntime) CreateAgent(ctx context.Context, identity Identity, ...) (agentruntime.AgentSpecification, error)
- func (runtime *StateRuntime) CreatePolicy(ctx context.Context, identity Identity, ...) (agentruntime.Policy, error)
- func (runtime *StateRuntime) CreateSession(ctx context.Context, identity Identity, ...) (agentruntime.Session, error)
- func (runtime *StateRuntime) DecideApproval(ctx context.Context, identity Identity, ...) (agentruntime.Approval, error)
- func (runtime *StateRuntime) Events(ctx context.Context, identity Identity, sessionID agentruntime.SessionID, ...) (agentruntime.EventPage, error)
- func (runtime *StateRuntime) GetAgentRevision(ctx context.Context, identity Identity, agentID agentruntime.AgentID, ...) (agentruntime.AgentSpecification, error)
- func (runtime *StateRuntime) GetPolicy(ctx context.Context, identity Identity, name string, revision uint64) (agentruntime.Policy, error)
- func (runtime *StateRuntime) IdempotencyStatus(ctx context.Context, identity Identity, key string) (agentruntime.IdempotencyStatus, error)
- func (runtime *StateRuntime) InspectApproval(ctx context.Context, identity Identity, approvalID agentruntime.ApprovalID) (agentruntime.Approval, error)
- func (runtime *StateRuntime) InspectSession(ctx context.Context, identity Identity, sessionID agentruntime.SessionID) (agentruntime.SessionView, error)
- func (runtime *StateRuntime) InspectToolCalls(ctx context.Context, identity Identity, sessionID agentruntime.SessionID, ...) (agentruntime.ToolCallPage, error)
- func (runtime *StateRuntime) InspectTurn(ctx context.Context, identity Identity, sessionID agentruntime.SessionID, ...) (agentruntime.Turn, error)
- func (runtime *StateRuntime) OpenArtifact(ctx context.Context, identity Identity, artifactID agentruntime.ArtifactID) (runtimecontent.ArtifactStream, error)
- func (runtime *StateRuntime) ReadArtifact(ctx context.Context, identity Identity, artifactID agentruntime.ArtifactID) (agentruntime.ArtifactDownload, error)
- func (runtime *StateRuntime) ReviseAgent(ctx context.Context, identity Identity, ...) (agentruntime.AgentSpecification, error)
- func (runtime *StateRuntime) RevisePolicy(ctx context.Context, identity Identity, ...) (agentruntime.Policy, error)
- func (runtime *StateRuntime) SendInput(ctx context.Context, identity Identity, request agentruntime.SendInputRequest) (agentruntime.SendInputResult, error)
- type StateRuntimeConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Authenticator ¶
Authenticator turns one bearer credential into a bounded caller identity.
type Config ¶
type Config struct {
Runtime Runtime
Authenticator Authenticator
RequestIDs agentruntime.RequestIDSource
MaxRequestBytes int64
Observability Observability
}
Config declares every dependency and finite request bound used by the API.
type HMACIdentityCorrelator ¶
type HMACIdentityCorrelator struct {
// contains filtered or unexported fields
}
HMACIdentityCorrelator derives stable, keyed, bounded identity correlations.
func NewHMACIdentityCorrelator ¶
func NewHMACIdentityCorrelator(key []byte) (*HMACIdentityCorrelator, error)
NewHMACIdentityCorrelator constructs an identity correlator from an explicit secret key.
func (*HMACIdentityCorrelator) Correlate ¶
func (correlator *HMACIdentityCorrelator) Correlate(identity Identity) IdentityCorrelation
Correlate returns tenant and principal references that cannot be reversed without the configured key.
type IdentityCorrelation ¶
IdentityCorrelation contains non-reversible operator correlation references.
type IdentityCorrelator ¶
type IdentityCorrelator interface {
Correlate(Identity) IdentityCorrelation
}
IdentityCorrelator derives safe operator correlations without returning a raw identity.
type Observability ¶
type Observability struct {
Clock Clock
Observer RequestObserver
IdentityCorrelator IdentityCorrelator
}
Observability declares every dependency required to observe public HTTP requests. Its zero value deliberately disables observations for the local memory-unsafe role.
type RequestObservation ¶
type RequestObservation struct {
RequestID agentruntime.RequestID
Operation string
Status int
Outcome RequestOutcome
FailureCode agentruntime.FailureCode
Duration time.Duration
TenantCorrelation string
PrincipalCorrelation string
}
RequestObservation contains the bounded, application-safe outcome of one HTTP request.
type RequestObserver ¶
type RequestObserver interface {
ObserveRequest(RequestObservation)
}
RequestObserver receives exactly one completed request observation.
type RequestOutcome ¶
type RequestOutcome string
RequestOutcome classifies one bounded HTTP completion without exposing request data.
const ( // RequestOutcomeSucceeded reports a completed non-error HTTP request. RequestOutcomeSucceeded RequestOutcome = "succeeded" // RequestOutcomeFailed reports a completed HTTP request with a safe failure status. RequestOutcomeFailed RequestOutcome = "failed" // RequestOutcomeCancelled reports a request whose caller context ended before completion. RequestOutcomeCancelled RequestOutcome = "cancelled" )
type Runtime ¶
type Runtime interface {
CreateAgent(context.Context, Identity, agentruntime.CreateAgentRequest) (agentruntime.AgentSpecification, error)
ReviseAgent(context.Context, Identity, agentruntime.ReviseAgentRequest) (agentruntime.AgentSpecification, error)
GetAgentRevision(context.Context, Identity, agentruntime.AgentID, agentruntime.AgentRevisionID) (agentruntime.AgentSpecification, error)
CreatePolicy(context.Context, Identity, agentruntime.CreatePolicyRequest) (agentruntime.Policy, error)
RevisePolicy(context.Context, Identity, agentruntime.RevisePolicyRequest) (agentruntime.Policy, error)
GetPolicy(context.Context, Identity, string, uint64) (agentruntime.Policy, error)
ReadArtifact(context.Context, Identity, agentruntime.ArtifactID) (agentruntime.ArtifactDownload, error)
InspectApproval(context.Context, Identity, agentruntime.ApprovalID) (agentruntime.Approval, error)
DecideApproval(context.Context, Identity, agentruntime.DecideApprovalRequest) (agentruntime.Approval, error)
IdempotencyStatus(context.Context, Identity, string) (agentruntime.IdempotencyStatus, error)
CreateSession(context.Context, Identity, agentruntime.CreateSessionRequest) (agentruntime.Session, error)
SendInput(context.Context, Identity, agentruntime.SendInputRequest) (agentruntime.SendInputResult, error)
InspectSession(context.Context, Identity, agentruntime.SessionID) (agentruntime.SessionView, error)
InspectTurn(context.Context, Identity, agentruntime.SessionID, agentruntime.TurnID) (agentruntime.Turn, error)
Events(context.Context, Identity, agentruntime.SessionID, agentruntime.Cursor, int) (agentruntime.EventPage, error)
CancelTurn(context.Context, Identity, agentruntime.CancelTurnRequest) (agentruntime.Turn, error)
CloseSession(context.Context, Identity, agentruntime.CloseSessionRequest) (agentruntime.Session, error)
CancelSession(context.Context, Identity, agentruntime.CancelSessionRequest) (agentruntime.Session, error)
}
Runtime owns the internal application operations used by the public HTTP routes.
type StateRuntime ¶
type StateRuntime struct {
// contains filtered or unexported fields
}
StateRuntime is the application seam that will route every public operation through content staging, compiler, planner, and state persistence.
func NewStateRuntime ¶
func NewStateRuntime(config StateRuntimeConfig) (*StateRuntime, error)
NewStateRuntime validates the non-fallback durable runtime composition.
func (*StateRuntime) CancelSession ¶
func (runtime *StateRuntime) CancelSession(ctx context.Context, identity Identity, request agentruntime.CancelSessionRequest) (agentruntime.Session, error)
CancelSession durably marks a drained open or closing Session cancelled.
func (*StateRuntime) CancelTurn ¶
func (runtime *StateRuntime) CancelTurn(ctx context.Context, identity Identity, request agentruntime.CancelTurnRequest) (agentruntime.Turn, error)
CancelTurn atomically records a caller-authorized terminal cancellation.
func (*StateRuntime) CloseSession ¶
func (runtime *StateRuntime) CloseSession(ctx context.Context, identity Identity, request agentruntime.CloseSessionRequest) (agentruntime.Session, error)
CloseSession durably rejects future Input while allowing accepted work to drain.
func (*StateRuntime) CreateAgent ¶
func (runtime *StateRuntime) CreateAgent(ctx context.Context, identity Identity, request agentruntime.CreateAgentRequest) (agentruntime.AgentSpecification, error)
CreateAgent stages the immutable specification body before atomically registering its metadata revision.
func (*StateRuntime) CreatePolicy ¶
func (runtime *StateRuntime) CreatePolicy(ctx context.Context, identity Identity, request agentruntime.CreatePolicyRequest) (agentruntime.Policy, error)
CreatePolicy creates the first immutable revision of a named tenant policy.
func (*StateRuntime) CreateSession ¶
func (runtime *StateRuntime) CreateSession(ctx context.Context, identity Identity, request agentruntime.CreateSessionRequest) (agentruntime.Session, error)
CreateSession pins a principal-owned Session to one existing immutable revision.
func (*StateRuntime) DecideApproval ¶
func (runtime *StateRuntime) DecideApproval(ctx context.Context, identity Identity, request agentruntime.DecideApprovalRequest) (agentruntime.Approval, error)
DecideApproval atomically records one owner decision. A successful approval creates an internal bounded grant; the public result never carries it.
func (*StateRuntime) Events ¶
func (runtime *StateRuntime) Events(ctx context.Context, identity Identity, sessionID agentruntime.SessionID, after agentruntime.Cursor, limit int) (agentruntime.EventPage, error)
Events reads a bounded cursor-resumable page of principal-scoped Product events.
func (*StateRuntime) GetAgentRevision ¶
func (runtime *StateRuntime) GetAgentRevision(ctx context.Context, identity Identity, agentID agentruntime.AgentID, revisionID agentruntime.AgentRevisionID) (agentruntime.AgentSpecification, error)
GetAgentRevision reads one immutable Agent revision through the state-authorized content reader.
func (*StateRuntime) GetPolicy ¶
func (runtime *StateRuntime) GetPolicy(ctx context.Context, identity Identity, name string, revision uint64) (agentruntime.Policy, error)
GetPolicy reads one immutable policy revision through the administrator surface.
func (*StateRuntime) IdempotencyStatus ¶
func (runtime *StateRuntime) IdempotencyStatus(ctx context.Context, identity Identity, key string) (agentruntime.IdempotencyStatus, error)
IdempotencyStatus safely returns a retained receipt for the caller's exact durable scope. It is an observation only: no command is compiled or replayed.
func (*StateRuntime) InspectApproval ¶
func (runtime *StateRuntime) InspectApproval(ctx context.Context, identity Identity, approvalID agentruntime.ApprovalID) (agentruntime.Approval, error)
InspectApproval returns the caller-owned projection of one approval without exposing the tool action, policy digest, or capability metadata.
func (*StateRuntime) InspectSession ¶
func (runtime *StateRuntime) InspectSession(ctx context.Context, identity Identity, sessionID agentruntime.SessionID) (agentruntime.SessionView, error)
InspectSession returns the bounded principal-scoped public projection.
func (*StateRuntime) InspectToolCalls ¶
func (runtime *StateRuntime) InspectToolCalls(ctx context.Context, identity Identity, sessionID agentruntime.SessionID, turnID agentruntime.TurnID) (agentruntime.ToolCallPage, error)
InspectToolCalls returns bounded safe projections for one principal-owned Turn.
func (*StateRuntime) InspectTurn ¶
func (runtime *StateRuntime) InspectTurn(ctx context.Context, identity Identity, sessionID agentruntime.SessionID, turnID agentruntime.TurnID) (agentruntime.Turn, error)
InspectTurn returns one exact principal-owned Turn.
func (*StateRuntime) OpenArtifact ¶
func (runtime *StateRuntime) OpenArtifact(ctx context.Context, identity Identity, artifactID agentruntime.ArtifactID) (runtimecontent.ArtifactStream, error)
OpenArtifact opens an authorized bounded Artifact transfer without exposing a storage locator. The existing ReadArtifact method remains for compatibility.
func (*StateRuntime) ReadArtifact ¶
func (runtime *StateRuntime) ReadArtifact(ctx context.Context, identity Identity, artifactID agentruntime.ArtifactID) (agentruntime.ArtifactDownload, error)
ReadArtifact returns one principal-authorized immutable artifact through the state-authorized runtime-content reader. Blob storage is never addressed by a public ID alone.
func (*StateRuntime) ReviseAgent ¶
func (runtime *StateRuntime) ReviseAgent(ctx context.Context, identity Identity, request agentruntime.ReviseAgentRequest) (agentruntime.AgentSpecification, error)
ReviseAgent stages a replacement immutable body and records the next revision under optimistic concurrency.
func (*StateRuntime) RevisePolicy ¶
func (runtime *StateRuntime) RevisePolicy(ctx context.Context, identity Identity, request agentruntime.RevisePolicyRequest) (agentruntime.Policy, error)
RevisePolicy creates the next immutable revision of a named tenant policy.
func (*StateRuntime) SendInput ¶
func (runtime *StateRuntime) SendInput(ctx context.Context, identity Identity, request agentruntime.SendInputRequest) (agentruntime.SendInputResult, error)
SendInput stages its immutable envelope and atomically admits one Input and Turn.
type StateRuntimeConfig ¶
type StateRuntimeConfig struct {
Content *runtimecontent.Store
Compiler *runtimestate.Compiler
Planner *runtimestate.RuntimeStatePlanner
Store runtimestate.RuntimeStateStore
// ModelProfiles is the explicit allow-list for public Agent specifications.
ModelProfiles []string
}
StateRuntimeConfig supplies the complete metadata/content authority required by the state-backed public runtime.