api

package
v1.4.0 Latest Latest
Warning

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

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

Documentation

Overview

The agent version endpoints: publication and observation of an immutable publication.

The audit endpoints: the hash-chained ledger, its verification and the signed export archive.

Package api implements the operator-facing Control API: the HTTP contract for tasks, agent versions, tools, approvals, memories, audit, quotas and the runtime health endpoints.

This file holds the assembly of the API: the store interfaces the handler depends on, the options that wire them, the route table, and the helpers every resource shares. The resources themselves live in one file each.

The operational endpoints: metrics and the health, readiness and version probes.

The memory endpoints: write, read, search and tombstone of a tenant memory record.

The tenant quota endpoints: the consumption ceiling of a tenant and its window usage.

The task endpoints: submission, observation, cancellation and the server-sent event stream of a task.

The tool endpoints: the granted tool list and the human approval decisions on a tool call.

Workflow orchestration endpoints of the Control API: publish a workflow run, inspect it with its steps, record the durable cancellation intent, and decide parked human-approval steps.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(taskStore TaskStore, agentVersions AgentVersionStore, approvals ApprovalStore, memories MemoryAPI, options ...Option) http.Handler

Types

type AgentVersionStore

type AgentVersionStore interface {
	CreateAgentVersion(context.Context, store.CreateAgentVersionInput) (store.CreateAgentVersionResult, error)
	GetAgentVersion(context.Context, string, uuid.UUID) (store.AgentVersion, error)
}

type ApprovalStore

type ApprovalStore interface {
	ListToolDescriptors(context.Context, string) ([]store.ToolDescriptor, error)
	GetToolApproval(context.Context, string, uuid.UUID) (store.ToolApproval, error)
	DecideToolApproval(context.Context, store.DecideToolApprovalInput) (store.ToolApproval, error)
}

ApprovalStore is the human decision surface for high-risk tool calls: capability discovery and bound approval decisions.

type AuditStore

type AuditStore interface {
	ListAudit(context.Context, store.ListAuditInput) ([]store.AuditEvent, error)
	VerifyAuditChain(context.Context, string) (store.AuditVerification, error)
	ExportAuditChain(context.Context, string) ([]store.AuditEvent, error)
}

AuditStore is the v0.4 audit ledger read surface (ADR-014).

type Handler

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

type MemoryAPI

MemoryAPI is the v0.1 Memory decision-chain surface (ADR-009): writes embed content, retrieval is tenant/sensitivity-filtered before scoring, deletion is a CAS tombstone.

type MetricsStore

type MetricsStore interface {
	AggregateMetrics(context.Context, string, time.Time) (*observability.Metrics, error)
}

MetricsStore is the §Phase-7 aggregated observability read surface.

type Option

type Option func(*Handler)

Option configures the control handler.

func WithAuditSigningKey

func WithAuditSigningKey(keyID string, key ed25519.PrivateKey) Option

WithAuditSigningKey configures the key that signs exported audit archives.

func WithAuditStore

func WithAuditStore(audit AuditStore) Option

WithAuditStore installs the audit ledger read surface (ADR-014); without it the audit endpoints are disabled.

func WithMaxSSESubscribers

func WithMaxSSESubscribers(limit int) Option

WithMaxSSESubscribers bounds concurrent task event streams (O5).

func WithMetricsStore

func WithMetricsStore(metrics MetricsStore) Option

WithMetricsStore installs the §Phase-7 aggregated observability surface; without it the metrics endpoint answers 404.

func WithNamespaceStore

func WithNamespaceStore(store namespace.Store) Option

WithNamespaceStore installs the namespace store; without it namespace endpoints answer 404.

func WithPackageAdmission

func WithPackageAdmission(registry *agentpkg.Registry) Option

WithPackageAdmission installs the signed Agent Package publish gate (ADR-010): publications without a package verified against the trusted key registry are rejected.

func WithReadiness

func WithReadiness(probe func(context.Context) error) Option

WithReadiness installs the dependency probe used by /readyz. Liveness is process-only; readiness must fail during database outages and rolling migration windows so load balancers stop routing new work.

func WithRequestTimeouts

func WithRequestTimeouts(readTimeout, writeTimeout time.Duration) Option

WithRequestTimeouts overrides the per-route read and write budgets (N9); non-positive values disable the bound for that class.

func WithRuntimePoolOperatorStore

func WithRuntimePoolOperatorStore(runtimePools RuntimePoolOperatorStore) Option

func WithSupervisor

func WithSupervisor(sup *supervisor.Supervisor, store supervisor.Store) Option

WithSupervisor installs the Agent Service supervisor and store; without it the service endpoints answer 404.

func WithTenantQuotaStore

func WithTenantQuotaStore(quotas TenantQuotaStore) Option

WithTenantQuotaStore installs the tenant aggregate consumption quota surface (v0.6); without it the quota endpoints are disabled.

func WithWorkflowStore

func WithWorkflowStore(workflows WorkflowStore) Option

WithWorkflowStore installs the v1.2 workflow orchestration surface; without it the workflow endpoints are disabled.

type RuntimePoolOperatorStore

type RuntimePoolOperatorStore interface {
	UpdateRuntimePoolStatus(context.Context, store.UpdateRuntimePoolStatusInput) (store.RuntimePoolState, error)
}

type TaskStore

type TaskStore interface {
	CreateTask(context.Context, store.CreateTaskInput) (store.CreateTaskResult, error)
	GetTask(context.Context, string, uuid.UUID) (store.Task, error)
	RequestTaskCancellation(context.Context, string, uuid.UUID, int64) (store.Task, error)
	GetTaskBudget(context.Context, string, uuid.UUID) (store.TaskBudgetStatus, error)
}

type TenantQuotaStore

type TenantQuotaStore interface {
	SetTenantQuota(context.Context, store.SetTenantQuotaInput) (store.TenantQuota, error)
	GetTenantQuota(context.Context, string) (store.TenantQuota, error)
	DeleteTenantQuota(context.Context, string) error
	GetTenantQuotaUsage(context.Context, string, time.Time) (store.TenantWindowUsage, error)
}

TenantQuotaStore is the v0.6 tenant aggregate consumption quota surface. The endpoints always operate on the authenticated principal's own tenant, so no cross-tenant identifier ever appears in a quota URL.

type WorkflowStore

type WorkflowStore interface {
	CreateWorkflow(context.Context, store.CreateWorkflowInput) (store.CreateWorkflowResult, error)
	GetWorkflow(context.Context, string, uuid.UUID) (store.Workflow, error)
	ListWorkflowSteps(context.Context, string, uuid.UUID) ([]store.WorkflowStep, error)
	RequestWorkflowCancellation(context.Context, string, uuid.UUID, int64) (store.Workflow, error)
	DecideWorkflowStepApproval(context.Context, store.DecideWorkflowStepApprovalInput) (store.WorkflowStep, error)
}

WorkflowStore is the durable orchestration surface the workflow endpoints expose. The kernel store satisfies it.

Jump to

Keyboard shortcuts

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