models

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package models defines the data types for the Agent Protocol spec. Types match the schemas in spec/openapi.json (Agent Protocol v0.1.6 plus Runkite extensions). Admin and runner-only shapes live in spec/openapi-admin.json and spec/openapi-internal.json.

Index

Constants

View Source
const (
	PendingStatusPending  = "pending"
	PendingStatusApproved = "approved"
	PendingStatusDenied   = "denied"
	PendingStatusConsumed = "consumed"

	// PendingReasonExpired is set when an embedded-governance row passes
	// its expires_at while still pending. Connector HITL rows leave
	// expires_at empty and are not swept.
	PendingReasonExpired = "pending_expired"
)

Pending action statuses for connector HITL.

View Source
const FinOpsOverlayID = "default"

FinOpsOverlayID is the singleton overlay row id. One live overlay document per control plane (file finops remains the bootstrap baseline).

View Source
const MaxOpaqueCheckpointBytes = 16 << 20 // 16 MiB

MaxOpaqueCheckpointBytes caps a single proxy PUT. Frameworks that need larger state should use POSTGRES_DSN (direct DB checkpointer) instead.

View Source
const UsageSourceTerminalOutput = "terminal_output"

UsageSourceTerminalOutput is written when a run reaches a terminal status with Output containing a conventional usage object.

Variables

This section is empty.

Functions

func MarshalPendingArgs

func MarshalPendingArgs(m map[string]any) []byte

MarshalPendingArgs is the JSON stored on pending_actions.args (display map).

func PendingActionKey

func PendingActionKey(a *PendingAction) string

PendingActionKey is an unambiguous, fixed-size key for an open approval. Embedded decisions and connector capabilities occupy different namespaces.

func RunIsSimulation

func RunIsSimulation(meta map[string]interface{}) bool

RunIsSimulation reports whether a run was tagged as fixture replay. The control plane writes JSON boolean true. String "true"/"1"/"yes" is accepted so Admin badges and A2A inherit still work if a row was written by hand. Missing or any other value is not a simulation.

func UnmarshalPendingArgs

func UnmarshalPendingArgs(b []byte) map[string]any

UnmarshalPendingArgs reads pending_actions.args.

Types

type Agent

type Agent struct {
	// TenantID is populated on read (see models.Run's TenantID for the
	// same convention) so cross-tenant callers -- the Admin API's system
	// context -- can tell which tenant owns each row. Hidden from the
	// public Agent Protocol response shape.
	TenantID     string                 `json:"-"`
	AgentID      string                 `json:"agent_id"`
	Name         string                 `json:"name"`
	Description  string                 `json:"description,omitempty"`
	Metadata     map[string]interface{} `json:"metadata,omitempty"`
	Capabilities map[string]interface{} `json:"capabilities"`
	// Version is basic version tracking: incremented on update, with the
	// latest version served by default. Starts at 1, increments only
	// when name/description/metadata/capabilities
	// actually change on an UpsertAgent call -- not on every bootstrap/
	// restart with an unchanged langgraph.json. Full version history
	// browsing, rollback, and A/B deployment are post-launch scope.
	Version int `json:"version"`
}

Agent represents a registered agent (graph) in the control plane.

type AgentSchema

type AgentSchema struct {
	AgentID      string                 `json:"agent_id"`
	InputSchema  map[string]interface{} `json:"input_schema"`
	OutputSchema map[string]interface{} `json:"output_schema"`
	StateSchema  map[string]interface{} `json:"state_schema,omitempty"`
	ConfigSchema map[string]interface{} `json:"config_schema,omitempty"`
}

AgentSchema contains the input/output/state/config schemas for an agent.

type AgentSearchRequest

type AgentSearchRequest struct {
	Name     string                 `json:"name,omitempty"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
	Limit    int                    `json:"limit,omitempty"`
	Offset   int                    `json:"offset,omitempty"`
	// Cursor is an opaque keyset token (Admin lists). When set, Offset is
	// ignored. Client Protocol search never sets this.
	Cursor string `json:"cursor,omitempty"`
}

AgentSearchRequest is the body for POST /agents/search.

type AgentVersion

type AgentVersion struct {
	TenantID     string                 `json:"-"`
	AgentID      string                 `json:"agent_id"`
	Version      int                    `json:"version"`
	Name         string                 `json:"name"`
	Description  string                 `json:"description,omitempty"`
	Metadata     map[string]interface{} `json:"metadata,omitempty"`
	Capabilities map[string]interface{} `json:"capabilities"`
	CreatedAt    time.Time              `json:"created_at"`
}

AgentVersion is one immutable, historical snapshot of an agent's definition, supporting full agent versioning: version history browsing and rollback to arbitrary past versions. Written once, at the moment UpsertAgent bumps Agent.Version -- never updated afterward, which is what makes it a reliable history rather than another mutable copy of the current row. A rollback (see RollbackAgentVersion) doesn't delete or rewrite any AgentVersion row -- it re-applies an old snapshot's content via a normal UpsertAgent call, which itself creates a NEW version whose CONTENT matches the old one. This keeps the version history strictly linear and append-only (like `git revert`, not `git reset`) -- "we rolled back to v2's content" is itself a visible, auditable event (v6 exists and says so), not something that erases v3/v4/v5 from history.

type AuditEvent

type AuditEvent struct {
	ID           string                 `json:"id"`
	TS           time.Time              `json:"ts"`
	TenantID     string                 `json:"tenant_id"`
	Actor        string                 `json:"actor,omitempty"`
	Action       string                 `json:"action"`
	ResourceType string                 `json:"resource_type,omitempty"`
	ResourceID   string                 `json:"resource_id,omitempty"`
	Decision     string                 `json:"decision"`
	ReasonCode   string                 `json:"reason_code,omitempty"`
	RuleID       string                 `json:"rule_id,omitempty"`
	LatencyMs    int                    `json:"latency_ms,omitempty"`
	RunID        string                 `json:"run_id,omitempty"`
	Generation   int64                  `json:"generation,omitempty"`
	AgentID      string                 `json:"agent_id,omitempty"`
	Connector    string                 `json:"connector,omitempty"`
	Tool         string                 `json:"tool,omitempty"`
	Attrs        map[string]interface{} `json:"attrs,omitempty"`
	TraceID      string                 `json:"trace_id,omitempty"`
}

AuditEvent is one durable policy (or security) decision row. Phase 1 writes policy decisions; Phase 2 adds Admin search (UI later).

type AuditSearchRequest

type AuditSearchRequest struct {
	TenantID   string     `json:"tenant_id,omitempty"`
	Decision   string     `json:"decision,omitempty"` // allow | deny | pending
	Action     string     `json:"action,omitempty"`   // e.g. tool.call, connector.session
	ReasonCode string     `json:"reason_code,omitempty"`
	RunID      string     `json:"run_id,omitempty"`
	AgentID    string     `json:"agent_id,omitempty"`
	Connector  string     `json:"connector,omitempty"`
	Tool       string     `json:"tool,omitempty"`
	Since      *time.Time `json:"since,omitempty"` // inclusive lower bound on ts
	Until      *time.Time `json:"until,omitempty"` // exclusive upper bound on ts
	Limit      int        `json:"limit,omitempty"`
	Offset     int        `json:"offset,omitempty"`
	Cursor     string     `json:"cursor,omitempty"` // keyset on (ts, id); ignores Offset
}

AuditSearchRequest filters Admin audit list pages (GET /admin-api/audit-events). SQL backends only (not Mongo).

type BreakGlassSearchRequest

type BreakGlassSearchRequest struct {
	TenantID string `json:"tenant_id,omitempty"`
	AgentID  string `json:"agent_id,omitempty"`
	Limit    int    `json:"limit,omitempty"`
	Offset   int    `json:"offset,omitempty"`
	Cursor   string `json:"cursor,omitempty"`
}

BreakGlassSearchRequest filters Admin break-glass list pages.

type BreakGlassWindow

type BreakGlassWindow struct {
	ID        string    `json:"id"`
	TenantID  string    `json:"tenant_id"`
	AgentID   string    `json:"agent_id,omitempty"` // empty = whole tenant
	Reason    string    `json:"reason"`
	CreatedBy string    `json:"created_by,omitempty"`
	StartsAt  time.Time `json:"starts_at"`
	ExpiresAt time.Time `json:"expires_at"`
	CreatedAt time.Time `json:"created_at,omitempty"`
	UpdatedAt time.Time `json:"updated_at,omitempty"`
}

BreakGlassWindow is a time-bounded policy bypass for a tenant (or tenant+agent). While active it short-circuits policy Decide for run.create / connector.session / tool.call — it does not override kill, agent authz, or admission_limits.

type CachedRunResult

type CachedRunResult struct {
	CacheKey  string                 `json:"cache_key"`
	AgentID   string                 `json:"agent_id"`
	Output    map[string]interface{} `json:"output"`
	CreatedAt time.Time              `json:"created_at"`
	ExpiresAt time.Time              `json:"expires_at"`
}

CachedRunResult is a memoized run output, part of the LLM response caching layer: a configurable per-agent TTL with the cache key derived from a hash of the input. Keyed by a hash of (agent_id, input, config) computed in createRun -- the control plane caches whole-run results, not individual LLM calls (it never sees inside a runner's execution to do the latter without becoming framework-aware).

type CronSchedule

type CronSchedule struct {
	// TenantID is populated on read (state.Store) so callers that need to
	// act across every tenant (the scheduler loop, via a system context)
	// know which tenant each schedule belongs to. Not settable by config
	// bootstrap -- always DefaultTenant for schedules loaded from
	// langgraph.json (see cmd/cron.go's bootstrapCronSchedules).
	TenantID   string          `json:"tenant_id,omitempty"`
	Name       string          `json:"name"`
	AgentID    string          `json:"agent_id"`
	Expression string          `json:"expression"` // standard 5-field cron expression
	Timezone   string          `json:"timezone"`   // IANA name, e.g. "America/New_York"; empty means UTC
	Input      json.RawMessage `json:"input,omitempty"`
	Config     json.RawMessage `json:"config,omitempty"`
	Enabled    bool            `json:"enabled"`
	CreatedAt  time.Time       `json:"created_at"`
	UpdatedAt  time.Time       `json:"updated_at"`
}

CronSchedule is one cron-scheduled run definition: cron-expression scheduling with multi-instance-safe claiming (a Postgres claim window) and timezone support.

type ErrorResponse

type ErrorResponse struct {
	Code    string                 `json:"code,omitempty"`
	Message string                 `json:"message"`
	Details map[string]interface{} `json:"metadata,omitempty"`
}

ErrorResponse is the standard error response format.

type EventStreamRequest

type EventStreamRequest struct {
	Channels   []string   `json:"channels"`
	Namespaces [][]string `json:"namespaces,omitempty"`
	Depth      *int       `json:"depth,omitempty"`
	Since      *int64     `json:"since,omitempty"`
}

EventStreamRequest is the body for POST /threads/{id}/stream (SSE).

type FinOpsOverlay

type FinOpsOverlay struct {
	ID        string          `json:"id"`
	Payload   json.RawMessage `json:"payload"`
	UpdatedAt time.Time       `json:"updated_at"`
	UpdatedBy string          `json:"updated_by,omitempty"`
}

FinOpsOverlay is the durable Admin-editable FinOps patch stored in SQL. Payload is a partial finops.Config JSON (pricebook/budgets/alerts/ reservation/routing/on_hard_breach). Overlay map keys win over the file baseline; clearing the row restores file-only effective config.

type KillSwitch

type KillSwitch struct {
	ID        string    `json:"id"`
	TenantID  string    `json:"tenant_id"`
	AgentID   string    `json:"agent_id,omitempty"` // empty = whole tenant
	PauseOnly bool      `json:"pause_only"`
	Reason    string    `json:"reason,omitempty"`
	CreatedBy string    `json:"created_by,omitempty"`
	CreatedAt time.Time `json:"created_at,omitempty"`
	UpdatedAt time.Time `json:"updated_at,omitempty"`
}

KillSwitch refuses new run creates for a tenant (agent_id empty) or a single agent. When PauseOnly is false, activating also cancels non-terminal runs in scope (blast-radius drain).

type KillSwitchSearchRequest

type KillSwitchSearchRequest struct {
	TenantID string `json:"tenant_id,omitempty"`
	AgentID  string `json:"agent_id,omitempty"`
	Limit    int    `json:"limit,omitempty"`
	Offset   int    `json:"offset,omitempty"`
	Cursor   string `json:"cursor,omitempty"`
}

KillSwitchSearchRequest filters Admin kill-switch list pages.

type MandatoryHITLRule

type MandatoryHITLRule struct {
	ID        string    `json:"id"`
	TenantID  string    `json:"tenant_id"`
	AgentID   string    `json:"agent_id,omitempty"` // empty = whole tenant
	Connector string    `json:"connector"`
	Tools     []string  `json:"tools,omitempty"` // empty = all tools
	CreatedAt time.Time `json:"created_at,omitempty"`
	UpdatedAt time.Time `json:"updated_at,omitempty"`
}

MandatoryHITLRule forces human approval for matching connector/tool calls. Empty AgentID means the whole tenant; empty Tools means all tools on the connector.

type MandatoryHITLSearchRequest

type MandatoryHITLSearchRequest struct {
	TenantID  string `json:"tenant_id,omitempty"`
	AgentID   string `json:"agent_id,omitempty"`
	Connector string `json:"connector,omitempty"`
	Limit     int    `json:"limit,omitempty"`
	Offset    int    `json:"offset,omitempty"`
	Cursor    string `json:"cursor,omitempty"` // keyset on (tenant_id, id)
}

MandatoryHITLSearchRequest filters Admin mandatory-HITL list pages.

type OpaqueCheckpoint

type OpaqueCheckpoint struct {
	ThreadID     string `json:"thread_id"`
	CheckpointID string `json:"checkpoint_id"`
	Framework    string `json:"framework,omitempty"`
	Data         []byte `json:"data"`
	// Version is a monotonic CAS token (ETag). Starts at 1; every successful
	// PUT bumps it. Proxy writers send If-Match to avoid silent lost updates
	// across processes/replicas.
	Version   int64     `json:"version"`
	CreatedAt time.Time `json:"created_at"`
}

OpaqueCheckpoint is a framework-owned blob stored by the control plane for proxy-mode checkpointers. The CP never parses Data.

type OpaqueCheckpointMeta

type OpaqueCheckpointMeta struct {
	CheckpointID string    `json:"checkpoint_id"`
	Framework    string    `json:"framework,omitempty"`
	SizeBytes    int       `json:"size_bytes"`
	Version      int64     `json:"version"`
	CreatedAt    time.Time `json:"created_at"`
}

OpaqueCheckpointMeta is list-response metadata (no blob body).

type PendingAction

type PendingAction struct {
	ID         string         `json:"id"`
	RunID      string         `json:"run_id"`
	Generation int64          `json:"generation"`
	TenantID   string         `json:"tenant_id"`
	AgentID    string         `json:"agent_id"`
	Connector  string         `json:"connector"`
	Tool       string         `json:"tool"`
	RuleID     string         `json:"rule_id,omitempty"`
	Reason     string         `json:"reason,omitempty"`
	ReasonCode string         `json:"reason_code,omitempty"`
	Status     string         `json:"status"`
	ArgsDigest string         `json:"args_digest,omitempty"`
	Args       map[string]any `json:"args,omitempty"`
	DecidedBy  string         `json:"decided_by,omitempty"`
	CreatedAt  time.Time      `json:"created_at"`
	UpdatedAt  time.Time      `json:"updated_at"`
	// ExpiresAt is set only for embedded-governance rows. Nil means the
	// row waits until an operator decides, which is connector HITL.
	ExpiresAt *time.Time `json:"expires_at,omitempty"`
}

PendingAction is one connector tool call waiting on operator approval.

type PendingActionSearchRequest

type PendingActionSearchRequest struct {
	TenantID  string `json:"tenant_id,omitempty"`
	Status    string `json:"status,omitempty"`
	RunID     string `json:"run_id,omitempty"`
	Connector string `json:"connector,omitempty"`
	Limit     int    `json:"limit,omitempty"`
	Offset    int    `json:"offset,omitempty"`
	Cursor    string `json:"cursor,omitempty"`
}

PendingActionSearchRequest filters Admin pending-action lists.

type PolicyGrant

type PolicyGrant struct {
	ID        string            `json:"id"`
	TenantID  string            `json:"tenant_id"`
	AgentID   string            `json:"agent_id"`
	Connector string            `json:"connector"`
	Tools     *PolicyToolFilter `json:"tools,omitempty"`
	CreatedAt time.Time         `json:"created_at,omitempty"`
	UpdatedAt time.Time         `json:"updated_at,omitempty"`
}

PolicyGrant is one durable connector grant row (Admin CRUD / SQL). Deployment defaults still live in langgraph.json; DB rows overlay them.

type PolicyGrantSearchRequest

type PolicyGrantSearchRequest struct {
	TenantID  string `json:"tenant_id,omitempty"`
	AgentID   string `json:"agent_id,omitempty"`
	Connector string `json:"connector,omitempty"`
	Limit     int    `json:"limit,omitempty"`
	Offset    int    `json:"offset,omitempty"`
	Cursor    string `json:"cursor,omitempty"` // keyset on (tenant_id, id)
}

PolicyGrantSearchRequest filters Admin grant list pages.

type PolicyToolFilter

type PolicyToolFilter struct {
	Allow []string `json:"allow,omitempty"`
	Deny  []string `json:"deny,omitempty"`
}

PolicyToolFilter is allow/deny for tools within a grant.

type RegistryEntry

type RegistryEntry struct {
	// TenantID is populated on read, same convention as models.Agent --
	// a registry is private to the tenant that published it ("an
	// internal/private registry for one's own agents", not a shared
	// public catalog across tenants).
	TenantID    string                 `json:"-"`
	Name        string                 `json:"name"` // unique slug within a tenant, e.g. "sales-qualifier"
	DisplayName string                 `json:"display_name,omitempty"`
	Description string                 `json:"description,omitempty"`
	Author      string                 `json:"author,omitempty"`
	Tags        []string               `json:"tags,omitempty"`
	SourceType  string                 `json:"source_type"` // "git" | "url" | "inline"
	SourceRef   string                 `json:"source_ref"`  // git URL+ref, a URL, or an inline langgraph.json snippet
	Metadata    map[string]interface{} `json:"metadata,omitempty"`
	// Version follows the exact same convention as models.Agent.Version:
	// starts at 1, increments only when the entry's actual content
	// changes on a republish, and every bump writes an immutable
	// snapshot to its own version history -- same append-only,
	// git-revert-not-git-reset model as agent versioning.
	Version   int       `json:"version"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

RegistryEntry is a published, discoverable agent DEFINITION for the agent marketplace / registry: publish, discover, and deploy agent definitions. Deliberately a metadata catalog record, not executable code the control plane runs directly -- "minimal viable registry" scope: publish/list/discover/version-history via API + Admin UI, no security review workflow, no automatic clone-and-execute "deploy" pipeline (running arbitrary fetched code is a different, much bigger trust and sandboxing problem than a catalog is). SourceRef is where a human (or their own tooling) goes to actually deploy it -- a git repo, a URL, or an inline langgraph.json snippet -- exactly like a package registry's listing page, not the package manager's install step.

type RegistryEntryVersion

type RegistryEntryVersion struct {
	TenantID    string                 `json:"-"`
	Name        string                 `json:"name"`
	Version     int                    `json:"version"`
	DisplayName string                 `json:"display_name,omitempty"`
	Description string                 `json:"description,omitempty"`
	Author      string                 `json:"author,omitempty"`
	Tags        []string               `json:"tags,omitempty"`
	SourceType  string                 `json:"source_type"`
	SourceRef   string                 `json:"source_ref"`
	Metadata    map[string]interface{} `json:"metadata,omitempty"`
	CreatedAt   time.Time              `json:"created_at"`
}

RegistryEntryVersion is one immutable, historical snapshot of a registry entry's content -- same role AgentVersion plays for Agent, see its doc comment for the full append-only rationale.

type RegistrySearchRequest

type RegistrySearchRequest struct {
	Name   string   `json:"name,omitempty"`   // substring match, case-insensitive
	Tags   []string `json:"tags,omitempty"`   // entry must have ALL listed tags
	Author string   `json:"author,omitempty"` // exact match
	Limit  int      `json:"limit,omitempty"`
	Offset int      `json:"offset,omitempty"`
	// Cursor is an opaque keyset token (Admin lists). When set, Offset is
	// ignored. Client Protocol search never sets this.
	Cursor string `json:"cursor,omitempty"`
}

RegistrySearchRequest is the body for POST /registry/search.

type Run

type Run struct {
	// TenantID is populated on read so internal, non-HTTP callers (the
	// gRPC bridge's StatusCallback, driven by a runID with no
	// authenticated request context to derive a tenant from) can
	// discover which tenant a run belongs to and re-derive a correctly
	// scoped context for subsequent writes. Not part of the public
	// Agent Protocol response shape.
	TenantID    string                 `json:"-"`
	RunID       string                 `json:"run_id"`
	ThreadID    string                 `json:"thread_id,omitempty"`
	AgentID     string                 `json:"agent_id,omitempty"`
	AssistantID string                 `json:"assistant_id,omitempty"` // SDK compat: mirrors AgentID
	Status      RunStatus              `json:"status"`
	CreatedAt   time.Time              `json:"created_at"`
	UpdatedAt   time.Time              `json:"updated_at"`
	Metadata    map[string]interface{} `json:"metadata"`
	Input       json.RawMessage        `json:"input,omitempty"`
	Config      json.RawMessage        `json:"config,omitempty"`
	Output      json.RawMessage        `json:"output,omitempty"`
	Error       string                 `json:"error,omitempty"`
	// ParentRunID, RootRunID, Depth support Agent-to-Agent (A2A)
	// delegation, where an agent calls another agent via the same Agent
	// Protocol API. ParentRunID is nil for a normal, top-level run --
	// set only when this run was created via POST /internal/a2a/runs on
	// behalf of another run. RootRunID is the top of the chain (a run's
	// own RunID if it has no parent, otherwise copied from the parent),
	// letting a caller find every run in a delegation tree with one
	// query (WHERE root_run_id = ?) instead of walking parent pointers.
	// Depth is 0 for a top-level run, parent.Depth+1 for a delegated
	// one -- enforced against a2a.max_depth at creation time to prevent
	// runaway/cyclic delegation chains. Direct children per parent are
	// capped separately by a2a.max_breadth.
	ParentRunID *string `json:"parent_run_id,omitempty"`
	RootRunID   *string `json:"root_run_id,omitempty"`
	Depth       int     `json:"depth,omitempty"`
}

Run represents an execution of an agent.

type RunCreate

type RunCreate struct {
	// RunID lets a client supply its own run ID instead of the server
	// generating one, specifically to make run creation idempotent
	// against network retries: a client that sent a create-run request
	// but never received the response (timeout, dropped connection) can
	// safely retry with the SAME RunID -- the retry returns the run that's already there
	// instead of creating a duplicate. Empty (the common case) means
	// "generate a fresh server-side ID," unchanged from before this
	// field existed. New IDs reject '.'/'..', controls and outer whitespace.
	// Unicode and URL syntax remain supported through escaped paths and
	// encoded runner identity headers.
	RunID        string          `json:"run_id,omitempty"`
	ThreadID     string          `json:"thread_id,omitempty"`
	AgentID      string          `json:"agent_id,omitempty"`
	AssistantID  string          `json:"assistant_id,omitempty"` // SDK compat: alias for AgentID
	Input        json.RawMessage `json:"input,omitempty"`
	Config       json.RawMessage `json:"config,omitempty"`
	Metadata     json.RawMessage `json:"metadata,omitempty"`
	StreamMode   json.RawMessage `json:"stream_mode,omitempty"` // string or []string
	Webhook      string          `json:"webhook,omitempty"`
	OnCompletion string          `json:"on_completion,omitempty"` // "delete" or "keep"
	OnDisconnect string          `json:"on_disconnect,omitempty"` // "cancel" or "continue"
	IfNotExists  string          `json:"if_not_exists,omitempty"` // "create" or "reject"
	// CheckpointRef is an opaque past-checkpoint id for time-travel
	// resume. Empty/whitespace is treated as absent. LangGraph runners
	// map a non-empty value to configurable.checkpoint_id; non-LangGraph
	// runners reject it rather than ignore it. The control plane does
	// not verify the id exists before dispatch.
	CheckpointRef *string         `json:"checkpoint_ref,omitempty"`
	ResumeCommand json.RawMessage `json:"resume_command,omitempty"`
	Command       json.RawMessage `json:"command,omitempty"` // SDK compat: {"resume": ...}
	// ParentRunID is set only by the internal A2A endpoint
	// (POST /internal/a2a/runs) -- never accepted from a client-facing
	// request, so a normal caller can't forge a delegation chain or
	// bypass the depth limit by claiming an arbitrary parent.
	ParentRunID *string `json:"-"`
}

RunCreate is the body for POST /runs and POST /threads/{id}/runs.

type RunManifest

type RunManifest struct {
	SchemaVersion    int                   `json:"schema_version"`
	CapturedAt       time.Time             `json:"captured_at"`
	TenantID         string                `json:"tenant_id"`
	AgentID          string                `json:"agent_id"`
	RequestedAlias   string                `json:"requested_alias,omitempty"`
	AgentVersion     int                   `json:"agent_version,omitempty"`
	RunnerKind       string                `json:"runner_kind"`
	ConnectorNeeds   []string              `json:"connector_needs,omitempty"`
	AllowedTools     *[]string             `json:"allowed_tools,omitempty"`
	PolicyFailClosed bool                  `json:"policy_fail_closed"`
	Principal        *RunManifestPrincipal `json:"principal,omitempty"`
	ParentRunID      *string               `json:"parent_run_id,omitempty"`
	Depth            int                   `json:"depth,omitempty"`
}

RunManifest is a frozen snapshot of what a run was authorized to do at dispatch time. Stored in run metadata (run_manifest) and copied onto RunAssignment so runners, Admin, and audit can reference the same intent recorded at createRunCtx — not live-mutable config.

type RunManifestPrincipal

type RunManifestPrincipal struct {
	Identity    string   `json:"identity,omitempty"`
	Permissions []string `json:"permissions,omitempty"`
}

RunManifestPrincipal records who started the run (when auth is configured).

type RunSearchRequest

type RunSearchRequest struct {
	Metadata map[string]interface{} `json:"metadata,omitempty"`
	Status   *RunStatus             `json:"status,omitempty"`
	ThreadID string                 `json:"thread_id,omitempty"`
	AgentID  string                 `json:"agent_id,omitempty"`
	// RootRunID finds every run in an A2A delegation tree with one
	// query (see Run.RootRunID's doc comment) -- pass any run's own
	// RootRunID (or its RunID, if it IS the tree's root) to list every
	// run delegated from it, directly or transitively. Matches exactly,
	// no partial/prefix semantics.
	RootRunID string `json:"root_run_id,omitempty"`
	// ParentRunID finds direct children of one run (one hop). Used by
	// a2a.max_breadth admission; also available on POST /runs/search.
	ParentRunID string `json:"parent_run_id,omitempty"`
	Limit       int    `json:"limit,omitempty"`
	Offset      int    `json:"offset,omitempty"`
	// Cursor is an opaque keyset token (Admin lists). When set, Offset is
	// ignored. Client Protocol search never sets this.
	Cursor string `json:"cursor,omitempty"`
}

RunSearchRequest is the body for POST /runs/search.

type RunStatus

type RunStatus string

RunStatus represents the status of a run.

const (
	RunStatusPending     RunStatus = "pending"
	RunStatusRunning     RunStatus = "running" // Platform extension: not in Agent Protocol v0.1.6 spec
	RunStatusError       RunStatus = "error"
	RunStatusSuccess     RunStatus = "success"
	RunStatusTimeout     RunStatus = "timeout"
	RunStatusInterrupted RunStatus = "interrupted"
)

type RunWaitResponse

type RunWaitResponse struct {
	Run    *Run                   `json:"run"`
	Values map[string]interface{} `json:"values,omitempty"`
}

RunWaitResponse is returned by GET /runs/{id}/wait.

type StoreDeleteRequest

type StoreDeleteRequest struct {
	Namespace []string `json:"namespace,omitempty"`
	Key       string   `json:"key"`
}

StoreDeleteRequest is the body for DELETE /store/items.

type StoreItem

type StoreItem struct {
	Namespace  []string               `json:"namespace"`
	Key        string                 `json:"key"`
	Value      map[string]interface{} `json:"value"`
	CreatedAt  time.Time              `json:"created_at"`
	UpdatedAt  time.Time              `json:"updated_at"`
	TTLMinutes *float64               `json:"-"`
}

StoreItem represents an item in the key-value store.

TTLMinutes is a write-only field: it's the desired TTL to apply on a PutItem call, mirroring LangGraph BaseStore's PutOp.ttl semantics exactly -- nil means no expiration for this item (not "leave any existing TTL alone"; the caller has already resolved "not specified" vs "explicitly none" upstream, same as LangGraph's own store implementations do). It's never populated on a value returned from GetItem/SearchItems, matching the Python SDK's Item/SearchItem types, which don't expose TTL either.

type StoreListNamespacesRequest

type StoreListNamespacesRequest struct {
	Prefix   []string `json:"prefix,omitempty"`
	Suffix   []string `json:"suffix,omitempty"`
	MaxDepth *int     `json:"max_depth,omitempty"`
	Limit    int      `json:"limit,omitempty"`
	Offset   int      `json:"offset,omitempty"`
}

StoreListNamespacesRequest is the body for POST /store/namespaces.

type StorePutRequest

type StorePutRequest struct {
	Namespace  []string               `json:"namespace"`
	Key        string                 `json:"key"`
	Value      map[string]interface{} `json:"value"`
	TTLMinutes *float64               `json:"ttl_minutes,omitempty"`
}

StorePutRequest is the body for PUT /store/items.

type StoreSearchRequest

type StoreSearchRequest struct {
	NamespacePrefix []string               `json:"namespace_prefix,omitempty"`
	Filter          map[string]interface{} `json:"filter,omitempty"`
	Limit           int                    `json:"limit,omitempty"`
	Offset          int                    `json:"offset,omitempty"`
	RefreshTTL      *bool                  `json:"refresh_ttl,omitempty"`
}

StoreSearchRequest is the body for POST /store/items/search.

RefreshTTL is a *bool (not bool) so an absent field can default to true -- matching LangGraph BaseStore's own TTLConfig default (refresh_on_read=True) -- while still letting an explicit "false" opt out. A plain bool couldn't distinguish "not sent" from "sent as false" over JSON.

func (*StoreSearchRequest) RefreshTTLOrDefault

func (r *StoreSearchRequest) RefreshTTLOrDefault() bool

RefreshTTLOrDefault returns the resolved refresh_ttl behavior: the explicit value if the request set one, true otherwise.

type StoreSearchResponse

type StoreSearchResponse struct {
	Items []*StoreItem `json:"items"`
}

StoreSearchResponse is returned by POST /store/items/search.

type StreamingCommand

type StreamingCommand struct {
	ID     int                    `json:"id"`
	Method string                 `json:"method"`
	Params map[string]interface{} `json:"params,omitempty"`
}

StreamingCommand is the body for POST /threads/{id}/commands.

type StreamingCommandResponse

type StreamingCommandResponse struct {
	Type    string                 `json:"type"` // "success" or "error"
	ID      int                    `json:"id"`
	Result  map[string]interface{} `json:"result,omitempty"`  // for success
	Error   string                 `json:"error,omitempty"`   // for error
	Message string                 `json:"message,omitempty"` // for error
}

StreamingCommandResponse is the response to a streaming command.

type StreamingEvent

type StreamingEvent struct {
	Type    string                 `json:"type"` // always "event"
	EventID string                 `json:"eventId,omitempty"`
	Seq     int64                  `json:"seq,omitempty"`
	Method  string                 `json:"method"`
	Params  map[string]interface{} `json:"params"`
}

StreamingEvent is a server-to-client event in the streaming protocol.

type Thread

type Thread struct {
	// TenantID -- see Agent.TenantID's doc comment for the convention.
	TenantID  string                 `json:"-"`
	ThreadID  string                 `json:"thread_id"`
	CreatedAt time.Time              `json:"created_at"`
	UpdatedAt time.Time              `json:"updated_at"`
	Metadata  map[string]interface{} `json:"metadata"`
	Status    ThreadStatus           `json:"status"`
	Values    map[string]interface{} `json:"values,omitempty"`
	// Version is a plain increment-on-write counter for optimistic
	// concurrency on PATCH /threads -- a client that wants to detect
	// "someone else changed this since I last read it" round-trips this
	// value back as ThreadPatch.IfMatchVersion. Starts at 1 on creation,
	// +1 on every successful UpdateThread (metadata/values changes only).
	// Status transitions via SetThreadStatus/TryClaimThread/
	// ReleaseThreadIfNoOtherActive deliberately do NOT bump it -- this
	// guards metadata/values edits specifically,
	// not "any row change" -- so a client polling status alone won't see
	// spurious version bumps unrelated to what it's trying to protect.
	// Not the same "version" concept as agent versioning (models.Agent)
	// -- purely a per-thread write counter.
	Version int `json:"version"`
}

Thread represents a conversation thread.

type ThreadCheckpoint

type ThreadCheckpoint struct {
	ThreadID      string                 `json:"thread_id"`
	CheckpointNS  string                 `json:"checkpoint_ns"`
	CheckpointID  string                 `json:"checkpoint_id"`
	CheckpointMap map[string]interface{} `json:"checkpoint_map,omitempty"`
}

ThreadCheckpoint identifies a specific point in thread history.

type ThreadCreate

type ThreadCreate struct {
	ThreadID string                 `json:"thread_id,omitempty"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
	IfExists string                 `json:"if_exists,omitempty"` // "raise" or "do_nothing"
}

ThreadCreate is the body for POST /threads.

type ThreadHistoryRequest

type ThreadHistoryRequest struct {
	Limit  int                    `json:"limit,omitempty"`
	Before map[string]interface{} `json:"before,omitempty"`
}

ThreadHistoryRequest is the body for POST /threads/{id}/history.

type ThreadPatch

type ThreadPatch struct {
	Metadata map[string]interface{} `json:"metadata,omitempty"`
	Values   map[string]interface{} `json:"values,omitempty"`
	// IfMatchVersion, if set, makes this PATCH conditional (optimistic
	// concurrency, see Thread.Version's own doc comment): the
	// update only applies if the thread's CURRENT version still equals
	// this value at write time, checked atomically in the same UPDATE
	// statement (not a separate read-then-compare, which would still
	// race). A mismatch (someone else updated the thread first) returns
	// state.ErrConflict, not a silent overwrite. nil (the default,
	// unchanged from before this field existed) means "apply
	// unconditionally," preserving the original last-write-wins
	// behavior for callers that don't need this protection.
	IfMatchVersion *int `json:"if_match_version,omitempty"`
}

ThreadPatch is the body for PATCH /threads/{id}.

type ThreadSearchRequest

type ThreadSearchRequest struct {
	Metadata map[string]interface{} `json:"metadata,omitempty"`
	Values   map[string]interface{} `json:"values,omitempty"`
	Status   *ThreadStatus          `json:"status,omitempty"`
	Limit    int                    `json:"limit,omitempty"`
	Offset   int                    `json:"offset,omitempty"`
	// Cursor is an opaque keyset token (Admin lists). When set, Offset is
	// ignored. Client Protocol search never sets this.
	Cursor string `json:"cursor,omitempty"`
}

ThreadSearchRequest is the body for POST /threads/search.

type ThreadState

type ThreadState struct {
	Values           map[string]interface{} `json:"values"`
	Next             []string               `json:"next"`
	Checkpoint       ThreadCheckpoint       `json:"checkpoint"`
	Metadata         map[string]interface{} `json:"metadata"`
	CreatedAt        *string                `json:"created_at"`
	ParentCheckpoint *ThreadCheckpoint      `json:"parent_checkpoint"`
	Tasks            []interface{}          `json:"tasks"`
	Interrupts       []interface{}          `json:"interrupts"`
}

ThreadState represents a checkpoint in a thread's history.

type ThreadStatus

type ThreadStatus string

ThreadStatus represents the status of a thread.

const (
	ThreadStatusIdle        ThreadStatus = "idle"
	ThreadStatusBusy        ThreadStatus = "busy"
	ThreadStatusInterrupted ThreadStatus = "interrupted"
	ThreadStatusError       ThreadStatus = "error"
)

type ThreadUpdateStateResponse

type ThreadUpdateStateResponse struct {
	Checkpoint ThreadCheckpoint `json:"checkpoint"`
}

ThreadUpdateStateResponse is the response for POST /threads/{id}/state.

type UsageEvent

type UsageEvent struct {
	ID          string    `json:"id"`
	TS          time.Time `json:"ts"`
	TenantID    string    `json:"tenant_id"`
	RunID       string    `json:"run_id"`
	AgentID     string    `json:"agent_id,omitempty"`
	Principal   string    `json:"principal,omitempty"`
	Model       string    `json:"model,omitempty"`
	TokensIn    int64     `json:"tokens_in"`
	TokensOut   int64     `json:"tokens_out"`
	USDEstimate float64   `json:"usd_estimate"`
	Source      string    `json:"source"`
}

UsageEvent is one durable token/cost observation for a run (SQL backends). Terminal ingest writes source=terminal_output from run Output.usage.

type UsageHold

type UsageHold struct {
	RunID      string    `json:"run_id"`
	TenantID   string    `json:"tenant_id"`
	AgentID    string    `json:"agent_id,omitempty"`
	USDHold    float64   `json:"usd_hold"`
	TokensHold int64     `json:"tokens_hold"`
	CreatedAt  time.Time `json:"created_at"`
}

UsageHold is an optimistic reservation counted toward UTC-day budgets until the run terminates (SQL backends).

type UsageHoldsSummary

type UsageHoldsSummary struct {
	Count      int64   `json:"count"`
	USDHold    float64 `json:"usd_hold"`
	TokensHold int64   `json:"tokens_hold"`
}

UsageHoldsSummary is open-hold totals for Admin Spend KPIs.

type UsageSummaryRequest

type UsageSummaryRequest struct {
	TenantID string     `json:"tenant_id,omitempty"`
	AgentID  string     `json:"agent_id,omitempty"`
	From     *time.Time `json:"from,omitempty"` // inclusive lower bound on ts
	To       *time.Time `json:"to,omitempty"`   // exclusive upper bound on ts
}

UsageSummaryRequest filters Admin usage rollups (GET /admin-api/usage/summary). SQL backends only (not Mongo).

type UsageSummaryRow

type UsageSummaryRow struct {
	Day         string  `json:"day"` // YYYY-MM-DD (UTC)
	TenantID    string  `json:"tenant_id"`
	AgentID     string  `json:"agent_id"`
	TokensIn    int64   `json:"tokens_in"`
	TokensOut   int64   `json:"tokens_out"`
	USDEstimate float64 `json:"usd_estimate"`
	RunCount    int64   `json:"run_count"`
}

UsageSummaryRow is one (tenant, agent, UTC day) rollup of usage_events.

type VectorDeleteRequest

type VectorDeleteRequest struct {
	Namespace string `json:"namespace"`
	ID        string `json:"id"`
}

VectorDeleteRequest is the body for DELETE /vectors/items.

type VectorItem

type VectorItem struct {
	Namespace string                 `json:"namespace"`
	ID        string                 `json:"id"`
	Content   string                 `json:"content,omitempty"`
	Embedding []float32              `json:"embedding,omitempty"`
	Metadata  map[string]interface{} `json:"metadata,omitempty"`
	CreatedAt time.Time              `json:"created_at"`
	UpdatedAt time.Time              `json:"updated_at"`
}

VectorItem is one embedded item in the vector store. Namespace is a single flat collection name (e.g. "docs", "faq") rather than the key-value store's hierarchical segments above -- vector collections are conventionally flat (an index/collection per embedding space), and nested namespacing doesn't map naturally onto ANN search.

type VectorSearchRequest

type VectorSearchRequest struct {
	Namespace string                 `json:"namespace"`
	Embedding []float32              `json:"embedding"`
	TopK      int                    `json:"top_k,omitempty"`
	Filter    map[string]interface{} `json:"filter,omitempty"`
}

VectorSearchRequest is the body for POST /vectors/search. Filter is an exact-match filter over Metadata keys, same convention as the key-value store's StoreSearchRequest.Filter.

type VectorSearchResponse

type VectorSearchResponse struct {
	Results []*VectorSearchResult `json:"results"`
}

VectorSearchResponse is returned by POST /vectors/search.

type VectorSearchResult

type VectorSearchResult struct {
	Item  *VectorItem `json:"item"`
	Score float64     `json:"score"`
}

VectorSearchResult is one ranked hit. Score is cosine similarity in [-1, 1] (1 = identical direction), not a raw distance -- higher is always better, regardless of which distance metric the backend computes internally.

type VectorUpsertRequest

type VectorUpsertRequest struct {
	Namespace string                 `json:"namespace"`
	ID        string                 `json:"id"`
	Content   string                 `json:"content,omitempty"`
	Embedding []float32              `json:"embedding"`
	Metadata  map[string]interface{} `json:"metadata,omitempty"`
}

VectorUpsertRequest is the body for PUT /vectors/items. Upsert (not separate create/update) because re-embedding and re-indexing the same ID -- e.g. a document that changed -- is the common case, not an error.

type WebhookDeadLetter

type WebhookDeadLetter struct {
	ID        string          `json:"id"`
	TenantID  string          `json:"tenant_id"`
	URL       string          `json:"url"`
	EventType string          `json:"event_type"`
	RunID     string          `json:"run_id"`
	Payload   json.RawMessage `json:"payload"`
	Error     string          `json:"error"`
	Attempts  int             `json:"attempts"`
	FailedAt  time.Time       `json:"failed_at"`
}

WebhookDeadLetter records a webhook delivery that failed all retry attempts, part of webhook delivery's retry-and-dead-letter handling. Persisted so a failed delivery is inspectable/replayable after the fact, not just logged and lost. TenantID scopes the row so a tenant-scoped list cannot see another tenant's payloads; admin (system context) still lists across every tenant.

Jump to

Keyboard shortcuts

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