config

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 14 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 config handles loading and parsing langgraph.json.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindLangGraphJSON

func FindLangGraphJSON(explicit string) []string

FindLangGraphJSON searches for langgraph.json in common locations. Priority: explicit path > CWD > examples/*/langgraph.json

If explicit is a directory, every *.json file in that directory is returned (sorted) so one control plane can bootstrap many agent configs — each file may declare its own runner_kind for multi-venv fleets (one runner process per file).

func LoadConnectorConfigs

func LoadConnectorConfigs(entries map[string]ConnectorEntry, configDir string) (map[string]connector.ConnectorConfig, error)

LoadConnectorConfigs resolves ConnectorEntry items into ConnectorConfig map. configDir is the directory containing langgraph.json (used to resolve config_ref paths).

func ParsePayloadShrink

func ParsePayloadShrink(e *PayloadShrinkEntry) (payloadshrink.Settings, error)

ParsePayloadShrink turns a first-file payload_shrink section into runtime settings. Nil entry is disabled with defaults filled (so retrieve still has numbers if a later toggle is added). Invalid numbers fail; cmd/serve exits on that error.

Types

type A2AEntry

type A2AEntry struct {
	// MaxDepth caps how many delegation hops a chain may have (a
	// top-level run is depth 0; each POST /internal/a2a/runs call
	// increments it by one from its parent). Defaults to 10 when unset
	// or <= 0 -- generous enough for real multi-agent workflows,
	// small enough that a cyclic delegation bug fails fast instead of
	// silently consuming resources.
	MaxDepth int `json:"max_depth,omitempty"`
	// MaxBreadth caps how many direct children a single parent run may
	// create via POST /internal/a2a/runs. Defaults to 20 when unset or
	// <= 0 -- enough for fan-out workers, tight enough that a buggy
	// coordinator cannot fork-bomb the queue in one hop.
	MaxBreadth int `json:"max_breadth,omitempty"`
}

A2AEntry is the "a2a" section of langgraph.json, for Agent-to-Agent (A2A) delegation where an agent calls another agent via the same Agent Protocol API. Knobs every deployment needs to consider before a runaway or cyclic A->B->A (or A fans out to N children) delegation loop silently consumes resources.

type ActionExportEntry added in v0.7.0

type ActionExportEntry struct {
	Name                  string `json:"name"`
	URL                   string `json:"url"`
	SecretRef             string `json:"secret_ref,omitempty"`
	AllowInsecureLoopback bool   `json:"allow_insecure_loopback,omitempty"`
	MaxAttempts           int    `json:"max_attempts,omitempty"`
}

ActionExportEntry configures one durable action metadata destination.

type AdmissionLimitRule

type AdmissionLimitRule struct {
	// MaxConcurrent caps pending+running runs (SQL COUNT).
	MaxConcurrent int `json:"max_concurrent,omitempty"`
	// MaxDaily caps runs with created_at >= start of current UTC day.
	MaxDaily int `json:"max_daily,omitempty"`
}

AdmissionLimitRule is one occupancy/quota ceiling.

type AdmissionLimitsEntry

type AdmissionLimitsEntry struct {
	PerTenant *AdmissionLimitRule `json:"per_tenant,omitempty"`
	PerAgent  *AdmissionLimitRule `json:"per_agent,omitempty"`
}

AdmissionLimitsEntry is the "admission_limits" section of langgraph.json. Any subset of dimensions may be set; unset or <= 0 values are unlimited.

type AgentAliasEntry

type AgentAliasEntry struct {
	// Targets maps a real agent_id to its relative weight. Weights
	// don't need to sum to 100 -- they're normalized against their own
	// sum (so {"a": 1, "b": 1} and {"a": 50, "b": 50} both mean a 50/50
	// split), matching how most weighted-routing configs work rather
	// than requiring the operator to do the arithmetic themselves.
	Targets map[string]int `json:"targets"`
}

AgentAliasEntry is one entry in langgraph.json's "agent_aliases" section, part of full agent versioning's A/B deployment routing. A client-facing name (the map key in AgentAliases) that probabilistically resolves to one of several REAL registered agent_ids at run-creation time -- e.g. rolling out a new graph version to 10% of traffic while 90% still gets the stable one, both deployed as ordinary, independently-registered agents.

type AuthEntry

type AuthEntry struct {
	AllowInsecureLoopback bool   `json:"allow_insecure_loopback,omitempty"`
	StrictIdentity        bool   `json:"strict_identity,omitempty"`
	Type                  string `json:"type"` // none, api_key, jwt, webhook
	JWKSURL               string `json:"jwks_url,omitempty"`
	Issuer                string `json:"issuer,omitempty"`
	Audience              string `json:"audience,omitempty"`
	TenantClaim           string `json:"tenant_claim,omitempty"` // JWT only; default "tenant_id"
	// ExtraClaims/ForwardToken/RawTokenField are JWT-only -- see
	// auth.JWTConfig's doc comments for the full rationale (Factory
	// Graph runtime.user needing more than identity/permissions/
	// tenant_id, e.g. a raw bearer token for downstream token exchange).
	ExtraClaims        []string                    `json:"extra_claims,omitempty"`
	ForwardToken       bool                        `json:"forward_token,omitempty"`
	RawTokenField      string                      `json:"raw_token_field,omitempty"`
	ClaimAliases       map[string]string           `json:"claim_aliases,omitempty"`
	ForwardHeaders     map[string]string           `json:"forward_headers,omitempty"`
	ScopeAsPermissions bool                        `json:"scope_as_permissions,omitempty"`
	Keys               map[string]auth.APIKeyEntry `json:"keys,omitempty"`
	WebhookURL         string                      `json:"url,omitempty"`
	WebhookTimeout     int                         `json:"timeout_ms,omitempty"`
	WebhookCacheTTL    int                         `json:"cache_ttl_seconds,omitempty"`
	// StrictPermissions fail-closes authorization when a credential
	// authenticates with an empty app-level permissions list (nil, [],
	// or only foreign IdP scopes that filterAppPermissions drops).
	// Pointer so JSON can distinguish unset vs explicit false:
	//   unset + Type api_key/jwt/webhook → default true (fail closed)
	//   explicit false → keep empty=unrestricted for local/dev
	//   explicit true → fail closed
	// See EffectiveStrictPermissions.
	StrictPermissions *bool `json:"strict_permissions,omitempty"`
	// AdminKeys defines an independent credential set accepted ONLY for
	// /admin-api/*, regardless of Type above (map: key string -> a
	// display name for it, shown nowhere but useful in audit logging).
	// Every key implicitly grants "admin" -- there's no reason to hold
	// one otherwise. Orthogonal to the primary provider so a deployment
	// using short-lived SSO tokens (Type: "jwt") for real end users
	// doesn't force an operator to keep re-authenticating just to view
	// the dashboard; a normal SSO token that itself carries "admin"
	// still works too (see auth.Middleware's doc comment).
	AdminKeys map[string]string `json:"admin_keys,omitempty"`
}

AuthEntry is the "auth" section of langgraph.json.

func (*AuthEntry) EffectiveStrictPermissions

func (a *AuthEntry) EffectiveStrictPermissions() bool

EffectiveStrictPermissions returns whether empty app-level permissions should deny. Explicit JSON true/false wins; when the field is omitted, api_key/jwt/webhook auth defaults to fail-closed so production SSO cannot accidentally grant unrestricted access via an empty claim set.

type CacheEntry

type CacheEntry struct {
	TTLSeconds int `json:"ttl_seconds"`
}

CacheEntry configures whole-run result caching for one agent.

type ConnectorEntry

type ConnectorEntry struct {
	ConfigRef      string                          `json:"config_ref,omitempty"`
	Auth           *connector.AuthConfig           `json:"auth,omitempty"`
	MCP            *connector.MCPConfig            `json:"mcp,omitempty"`
	Errors         map[string]string               `json:"errors,omitempty"`
	Tools          *connector.ToolFilter           `json:"tools,omitempty"`
	CircuitBreaker *connector.CircuitBreakerConfig `json:"circuit_breaker,omitempty"`
}

ConnectorEntry is a connector definition in langgraph.json. Either inline config or a config_ref to an external YAML file.

type CorsEntry

type CorsEntry struct {
	AllowOrigins []string `json:"allow_origins"`
}

CorsEntry is the "cors" section of langgraph.json ({"allow_origins": [...]}) -- a plain browser/HTTP standard concern, unrelated to any specific server implementation. Kept as a simple, familiar shape so migrating a browser-based frontend's CORS config from another LangGraph SDK-compatible server costs nothing.

type CredentialBindingEntry added in v0.7.0

type CredentialBindingEntry struct {
	ID                    string `json:"id"`
	Address               string `json:"address"`
	Namespace             string `json:"namespace,omitempty"`
	TokenFile             string `json:"token_file"`
	Mount                 string `json:"mount"`
	Role                  string `json:"role"`
	ConsumerID            string `json:"consumer_id"`
	MaxTTLSeconds         int    `json:"max_ttl_seconds"`
	RenewSeconds          int    `json:"renew_seconds"`
	Retired               bool   `json:"retired,omitempty"`
	AllowInsecureLoopback bool   `json:"allow_insecure_loopback,omitempty"`
}

type CredentialLeasesEntry added in v0.7.0

type CredentialLeasesEntry struct {
	KeyringFile string                   `json:"keyring_file"`
	Bindings    []CredentialBindingEntry `json:"bindings"`
}

CredentialLeasesEntry registers external issuers, never credential values.

type CronEntry

type CronEntry struct {
	AgentID    string                 `json:"agent_id"`
	Expression string                 `json:"expression"`         // standard 5-field cron expression
	Timezone   string                 `json:"timezone,omitempty"` // IANA name; default UTC
	Input      map[string]interface{} `json:"input,omitempty"`
	Config     map[string]interface{} `json:"config,omitempty"`
	Enabled    *bool                  `json:"enabled,omitempty"` // nil defaults to true
}

CronEntry is one entry in langgraph.json's "cron" section.

type CustomRoutesEntry

type CustomRoutesEntry struct {
	URL string `json:"url"`
	// Mount is the external URL prefix (default "/custom"). Use a
	// product-specific prefix (e.g. "/sales-assistant") when the
	// frontend already calls bare product paths and you don't want a
	// /custom shim. Must not collide with Agent Protocol reserved paths.
	Mount string `json:"mount,omitempty"`
}

CustomRoutesEntry configures the "Custom routes" platform extension: user-defined HTTP endpoints mounted at /custom/*. From the control plane's side, in-runner mode (the Python runner SDK hosts the user's ASGI app itself, see python/runkite_runner/custom_app.py) and sidecar mode (a user-run, language-agnostic process) are the exact same mechanism -- a reverse proxy to a URL. URL is where either kind of process is expected to be listening. CustomRoutesEntry mounts a product-owned HTTP app beside the Agent Protocol API. The control plane reverse-proxies Mount/* to URL and strips Mount before forwarding (see internal/customroutes).

type FinOpsAlertsEntry

type FinOpsAlertsEntry struct {
	// SoftPct is the percent of a hard daily cap at which admission emits
	// a budget_alert (default 80). Soft/hard trips always alert.
	SoftPct float64 `json:"soft_pct,omitempty"`
}

FinOpsAlertsEntry controls spend-alert soft_pct approaches (webhook delivery reuses top-level webhooks subscribed to budget_alert).

type FinOpsBudgetCap

type FinOpsBudgetCap struct {
	MaxUSDPerDay    float64 `json:"max_usd_per_day,omitempty"`
	MaxTokensPerDay int64   `json:"max_tokens_per_day,omitempty"`
	MaxRunsPerDay   int64   `json:"max_runs_per_day,omitempty"`
	Soft            bool    `json:"soft,omitempty"`
}

FinOpsBudgetCap is one daily ceiling. Zero fields are unlimited.

type FinOpsBudgetsEntry

type FinOpsBudgetsEntry struct {
	Tenants map[string]FinOpsBudgetCap `json:"tenants,omitempty"`
	Agents  map[string]FinOpsBudgetCap `json:"agents,omitempty"`
}

FinOpsBudgetsEntry holds optional tenant and agent daily caps. Agent keys are "tenant_id/agent_id".

type FinOpsEntry

type FinOpsEntry struct {
	Pricebook    map[string]FinOpsModelPrice `json:"pricebook,omitempty"`
	Budgets      *FinOpsBudgetsEntry         `json:"budgets,omitempty"`
	Alerts       *FinOpsAlertsEntry          `json:"alerts,omitempty"`
	Reservation  *FinOpsReservationEntry     `json:"reservation,omitempty"`
	Routing      *FinOpsRoutingEntry         `json:"routing,omitempty"`
	OnHardBreach string                      `json:"on_hard_breach,omitempty"`
}

FinOpsEntry is the "finops" section of langgraph.json.

type FinOpsModelPrice

type FinOpsModelPrice struct {
	InputPer1k  float64 `json:"input_per_1k"`
	OutputPer1k float64 `json:"output_per_1k"`
}

FinOpsModelPrice is USD per 1k tokens for one model id.

type FinOpsReservationAmountEntry

type FinOpsReservationAmountEntry struct {
	USDPerRun    float64 `json:"usd_per_run,omitempty"`
	TokensPerRun int64   `json:"tokens_per_run,omitempty"`
}

FinOpsReservationAmountEntry is one hold size (global fallback lives on FinOpsReservationEntry itself).

type FinOpsReservationEntry

type FinOpsReservationEntry struct {
	USDPerRun    float64 `json:"usd_per_run,omitempty"`
	TokensPerRun int64   `json:"tokens_per_run,omitempty"`
	// HoldTTL is a Go duration (e.g. "24h"). Open holds older than this
	// are deleted by a background sweeper (0 / omit = no sweeper).
	HoldTTL string `json:"hold_ttl,omitempty"`
	// Agents maps "tenant_id/agent_id" to per-agent hold overrides.
	Agents map[string]FinOpsReservationAmountEntry `json:"agents,omitempty"`
}

FinOpsReservationEntry holds optimistic per-create holds counted toward UTC-day budgets until the run terminates.

type FinOpsRoutingEntry

type FinOpsRoutingEntry struct {
	Enabled bool `json:"enabled,omitempty"`
	// SoftPct defaults to alerts.soft_pct or 80 when unset.
	SoftPct float64 `json:"soft_pct,omitempty"`
	// Aliases maps a client-facing alias (or agent_id) to ordered cheaper
	// real agent_ids tried when near budget.
	Aliases map[string][]string `json:"aliases,omitempty"`
}

FinOpsRoutingEntry rewrites agent aliases to cheaper targets when soft_pct of a hard day cap is exceeded.

type GraphEntry

type GraphEntry struct {
	GraphID string // key in the "graphs" map
	Path    string // file path portion before ":"
	Symbol  string // symbol name after ":"
}

GraphEntry is a parsed graph reference from the config.

type LangGraphConfig

type LangGraphConfig struct {
	CredentialLeases *CredentialLeasesEntry `json:"credential_leases,omitempty"`
	Graphs           map[string]string      `json:"graphs"`       // graph_id -> "path:symbol"
	Dependencies     []string               `json:"dependencies"` // relative paths
	// RunnerKind identifies which runner implementation should execute
	// every graph declared in THIS file -- the Runner Protocol is
	// language-agnostic, and a real deployment can mix runners, some
	// agents Python, some TypeScript, routed by this field. One config
	// file maps to one runner process reading it, so this is file-level,
	// not per-graph like ConnectorNeeds/LLMCache below. Defaults to
	// "python-langgraph" when omitted -- every langgraph.json written
	// before this field existed keeps working unchanged.
	RunnerKind     string                    `json:"runner_kind,omitempty"`
	ExecutionPool  string                    `json:"execution_pool,omitempty"`
	ExecutionPools map[string]execution.Pool `json:"execution_pools,omitempty"`
	Auth           *AuthEntry                `json:"auth,omitempty"`
	Connectors     map[string]ConnectorEntry `json:"connectors,omitempty"`
	// ConnectorNeeds declares, per graph_id, which registered connectors that
	// agent needs pre-warmed sessions for (RunAssignment.connector_needs).
	// Additive/optional -- absent means no pre-warm hints for that agent.
	ConnectorNeeds map[string][]string `json:"connector_needs,omitempty"`
	// AllowedTools declares, per graph_id, which in-graph tool names the
	// runner may execute (RunAssignment.allowed_tools). Key absent = no
	// in-graph allowlist (connector grants still apply). Key present with
	// an empty list = deny all in-graph tools. This is plane governance for
	// framework-native tools; it does not replace connector PolicyGrants.
	AllowedTools map[string][]string `json:"allowed_tools,omitempty"`
	// RateLimit is control-plane-wide, like Auth -- read from the first
	// discovered langgraph.json only (see initRateLimiter in cmd/serve.go),
	// same convention as Auth.
	RateLimit *RateLimitEntry `json:"rate_limit,omitempty"`
	// AdmissionLimits caps in-flight and per-UTC-day run creates
	// (occupancy/quota, not request-rate). Control-plane-wide, first-file
	// (see initAdmissionLimits in cmd/serve.go). Separate from RateLimit
	// on purpose: different semantics and SQL COUNT enforcement.
	AdmissionLimits *AdmissionLimitsEntry `json:"admission_limits,omitempty"`
	// Webhooks is control-plane-wide, same first-file convention as Auth
	// and RateLimit (see initHooks in cmd/serve.go). Observational only
	// (async); cannot reject runs. For sync deny-before-create guardrails,
	// use PreflightHooks.
	Webhooks []WebhookEntry `json:"webhooks,omitempty"`
	// PreflightHooks is control-plane-wide, same first-file convention as
	// Webhooks. Each entry is a synchronous HTTP gate consulted before a
	// run is claimed/created; deny or timeout fails closed (403).
	PreflightHooks []PreflightHookEntry `json:"preflight_hooks,omitempty"`
	// LLMCache declares, per graph_id, that agent's whole-run result cache
	// TTL, for LLM response caching. Same per-agent,
	// metadata-embedded-at-bootstrap convention as ConnectorNeeds --
	// absent means caching is off for that agent (never on by default:
	// an agent with side effects, e.g. "send_email", must never have its
	// result cached and replayed for a repeated input).
	LLMCache map[string]CacheEntry `json:"llm_cache,omitempty"`
	// CustomRoutes is control-plane-wide, same first-file convention as
	// Auth/RateLimit/Webhooks (see initCustomRoutesProxy in cmd/serve.go).
	CustomRoutes *CustomRoutesEntry `json:"custom_routes,omitempty"`
	// Cron declares scheduled runs. Keyed by schedule name (must be
	// unique across every discovered langgraph.json, unlike per-agent
	// maps -- schedules from every config file are bootstrapped
	// together, not just the first one, same as Graphs).
	Cron map[string]CronEntry `json:"cron,omitempty"`
	// VectorStore is control-plane-wide, same first-file convention as
	// Auth/RateLimit/Webhooks/CustomRoutes (see initVectorStore in
	// cmd/serve.go). Disabled entirely when absent -- never implicitly
	// enabled just because POSTGRES_DSN is set; the vector/semantic
	// store is None (disabled) by default.
	VectorStore *VectorStoreEntry `json:"vector_store,omitempty"`
	// Cors is control-plane-wide, same first-file convention as
	// Auth/RateLimit/Webhooks (see initCorsMiddleware in cmd/serve.go).
	// Absent means no CORS headers are added at all -- correct for
	// server-to-server or same-origin deployments, but a browser-based
	// frontend on a different origin (the common case: a Vite/React dev
	// server on its own port) needs this configured, or every request
	// silently fails the browser's CORS preflight before it ever reaches
	// application logic (this looks nothing like an auth or network
	// error -- the browser blocks it client-side).
	Cors *CorsEntry `json:"cors,omitempty"`
	// Retention is control-plane-wide, same first-file convention as
	// Auth/RateLimit/Webhooks (see initRetention in cmd/retention.go).
	// Absent means no automatic cleanup at all -- runs/checkpoints
	// persist forever until an explicit DELETE /threads/{id}, the
	// pre-existing behavior (real gap found reviewing the Admin UI:
	// unbounded storage growth with no way to bound it short of manual
	// deletion). Opt-in, same convention as everything else here.
	Retention *RetentionEntry `json:"retention,omitempty"`
	// Reclaim caps how many times a crashed job may be re-enqueued
	// (generation ceiling / poison-pill defense). Control-plane-wide,
	// first-file (see initReclaimMaxRetries / initReclaimMaxAge in
	// cmd/reclaim.go). Absent means default max_retries=3 and max_age=6s;
	// explicit max_retries=0 means unlimited (legacy).
	Reclaim *ReclaimEntry `json:"reclaim,omitempty"`
	// RunTimeout is control-plane-wide, same first-file convention as
	// Retention (see initRunTimeoutConfig in cmd/run_timeout.go).
	// Absent means no automatic run deadline -- a hung agent (alive but
	// stuck in an infinite tool loop) stays pending/running forever
	// unless a client cancels it. Distinct from crash reclaim (heartbeat
	// lease): reclaim covers a dead runner; this covers a live one that
	// never finishes.
	RunTimeout *RunTimeoutEntry `json:"run_timeout,omitempty"`
	// A2A is control-plane-wide, same first-file convention as
	// Auth/RateLimit/Webhooks (see initA2AConfig in cmd/serve.go).
	// Absent means the default max depth (see A2AEntry.MaxDepth)
	// applies -- A2A delegation itself (POST /internal/a2a/runs) is
	// always available, this section only tunes the depth limit.
	A2A *A2AEntry `json:"a2a,omitempty"`
	// AgentAliases is control-plane-wide, same first-file convention as
	// Auth/RateLimit/A2A (see initAgentAliases in cmd/serve.go). Absent
	// means no alias exists at all -- an agent_id that happens to match
	// a real registered agent runs it directly, same as always; a
	// client-facing name that ISN'T a real registered agent and also
	// isn't an alias 404s, same as always.
	AgentAliases map[string]AgentAliasEntry `json:"agent_aliases,omitempty"`
	// Policy is control-plane-wide, same first-file convention as
	// Auth/PreflightHooks (see initPolicy in cmd/policy.go). Absent
	// preserves V1 open connector access after runner auth + run-binding.
	// A configured section, including an empty object, enables the engine
	// with default deny for unmatched connector requests (see internal/policy).
	Policy *PolicyEntry `json:"policy,omitempty"`
	// FinOps is control-plane-wide, first-file (see initFinOps in
	// cmd/serve.go). Optional model pricebook for usage_events USD
	// estimates and optional tenant/agent daily budget caps enforced at
	// run admission (after kill + authz; break-glass does not bypass
	// hard budgets).
	FinOps *FinOpsEntry `json:"finops,omitempty"`
	// PayloadShrink is control-plane-wide, first-file (see
	// initPayloadShrink in cmd/payload_shrink.go). Caps connector MCP
	// tools/call results after a successful downstream response. Absent
	// or enabled:false is a no-op (byte-identical to a plane without
	// this section). Redis is required for a live shrink; without it
	// the original body is forwarded.
	PayloadShrink *PayloadShrinkEntry `json:"payload_shrink,omitempty"`
}

LangGraphConfig represents a parsed langgraph.json file.

func LoadLangGraphJSON

func LoadLangGraphJSON(path string) (*LangGraphConfig, error)

LoadLangGraphJSON reads and parses a langgraph.json file.

func (*LangGraphConfig) ParseGraphEntries

func (c *LangGraphConfig) ParseGraphEntries() ([]GraphEntry, error)

ParseGraphEntries extracts graph entries from the config.

type PayloadShrinkEntry

type PayloadShrinkEntry struct {
	Enabled       bool   `json:"enabled"`
	MaxBytes      *int   `json:"max_bytes,omitempty"`
	PreviewBytes  *int   `json:"preview_bytes,omitempty"`
	CacheTTL      string `json:"cache_ttl,omitempty"`
	MaxStoreBytes *int   `json:"max_store_bytes,omitempty"`
}

PayloadShrinkEntry is the "payload_shrink" section of langgraph.json. Pointer fields distinguish omit (use default) from an explicit 0 (preview_bytes 0 is valid: stub notice only).

type PolicyApprovalEntry added in v0.7.0

type PolicyApprovalEntry struct {
	RequiredApprovals int  `json:"required_approvals,omitempty"`
	ExcludeRequester  bool `json:"exclude_requester,omitempty"`
}

PolicyApprovalEntry applies only to operations already held for review.

type PolicyEntry

type PolicyEntry struct {
	// DefaultEffect when no grant matches: "deny" (default) or "allow".
	DefaultEffect string `json:"default_effect,omitempty"`
	// FailClosed controls webhook timeout/error behavior (default true).
	FailClosed *bool `json:"fail_closed,omitempty"`
	// CacheTTLMS is short-TTL decision cache for webhook backends (0 = off).
	CacheTTLMS int `json:"cache_ttl_ms,omitempty"`
	// Audit enables durable audit_events writes on Postgres, MySQL and SQLite.
	// Default true when policy is configured.
	Audit *bool `json:"audit,omitempty"`
	// AuditRequired blocks policy-authorized execution when its durable audit
	// write fails. Requires audit enabled and a supported durable audit store.
	AuditRequired bool `json:"audit_required,omitempty"`
	// ActionEvidence records managed MCP tool-call attempts before dispatch.
	// Requires required audit and a SQL protected-action store.
	ActionEvidence bool                 `json:"action_evidence,omitempty"`
	Approvals      *PolicyApprovalEntry `json:"approvals,omitempty"`
	ActionExport   *ActionExportEntry   `json:"action_export,omitempty"`
	// RunEvents emits method "tool_auth" RunEvents on connector policy
	// denials (session + tools/call). Default true when policy is configured.
	RunEvents *bool `json:"run_events,omitempty"`
	// Grants are in-process connector grants (tenant + agent + connector).
	Grants []PolicyGrantEntry `json:"grants,omitempty"`
	// MandatoryHITL forces matching tool.call allows to pending (Admin
	// approve → one-shot retry). Config-only; hard deny still wins.
	MandatoryHITL []PolicyMandatoryHITLEntry `json:"mandatory_hitl,omitempty"`
	// Predicates deny or pending a connector tools/call from argument
	// values (config-only; never allow). Evaluated after grants, before
	// the sync webhook.
	Predicates []PolicyPredicateEntry `json:"predicates,omitempty"`
	// Webhook is an optional sync PolicyProvider (WebhookGate-shaped).
	Webhook *PolicyWebhookEntry `json:"webhook,omitempty"`
	// SIEM is an optional async export sink for policy_decision events
	// (hooks.Dispatcher / WebhookSink — not the sync decide webhook).
	SIEM *PolicySIEMEntry `json:"siem,omitempty"`
}

PolicyEntry is the "policy" section of langgraph.json.

type PolicyGrantEntry

type PolicyGrantEntry struct {
	ID        string            `json:"id,omitempty"`
	TenantID  string            `json:"tenant_id"`
	AgentID   string            `json:"agent_id"`
	Connector string            `json:"connector"`
	Tools     *PolicyToolFilter `json:"tools,omitempty"`
}

PolicyGrantEntry is one static connector grant.

type PolicyMandatoryHITLEntry

type PolicyMandatoryHITLEntry struct {
	ID        string   `json:"id,omitempty"`
	TenantID  string   `json:"tenant_id"`
	AgentID   string   `json:"agent_id,omitempty"`
	Connector string   `json:"connector"`
	Tools     []string `json:"tools,omitempty"`
}

PolicyMandatoryHITLEntry forces tool.call to pending when Decide would allow. Empty agent_id = whole tenant; empty tools = every tool on the connector.

type PolicyPredicateEntry

type PolicyPredicateEntry struct {
	ID         string               `json:"id,omitempty"`
	TenantID   string               `json:"tenant_id"`
	AgentID    string               `json:"agent_id,omitempty"`
	Connector  string               `json:"connector"`
	Tool       string               `json:"tool,omitempty"`
	When       *PolicyPredicateWhen `json:"when,omitempty"`
	Effect     string               `json:"effect"`
	Reason     string               `json:"reason,omitempty"`
	ReasonCode string               `json:"reason_code,omitempty"`
}

PolicyPredicateEntry is one argument check on connector tools/call. Empty agent_id = whole tenant; empty tool = every tool on the connector.

type PolicyPredicateWhen

type PolicyPredicateWhen struct {
	Path  string `json:"path"`
	Op    string `json:"op"`
	Value any    `json:"value,omitempty"`
}

PolicyPredicateWhen is the argument matcher for a predicate.

func (*PolicyPredicateWhen) UnmarshalJSON

func (p *PolicyPredicateWhen) UnmarshalJSON(data []byte) error

UnmarshalJSON keeps only predicate values lossless. Typed configuration and unrelated control metadata retain their established decoding behavior.

type PolicySIEMEntry

type PolicySIEMEntry struct {
	URL    string `json:"url"`
	Secret string `json:"secret,omitempty"`
}

PolicySIEMEntry is an async HTTP sink for policy_decision events. Delivery uses the same HMAC / retry / dead-letter path as top-level webhooks; it never blocks Decide.

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 PolicyWebhookEntry

type PolicyWebhookEntry struct {
	URL       string `json:"url"`
	Revision  string `json:"revision,omitempty"`
	Secret    string `json:"secret,omitempty"`
	TimeoutMS int    `json:"timeout_ms,omitempty"`
}

PolicyWebhookEntry is the sync policy webhook endpoint.

type PreflightHookEntry

type PreflightHookEntry struct {
	URL       string `json:"url"`
	Secret    string `json:"secret,omitempty"`     // HMAC-SHA256; same X-Runkite-Signature as webhooks
	TimeoutMS int    `json:"timeout_ms,omitempty"` // per-request timeout; default 2000
}

PreflightHookEntry is one entry in langgraph.json's "preflight_hooks" array — a sync HTTP gate that can allow or deny run creation.

type RateLimitEntry

type RateLimitEntry struct {
	// Backend selects the store: "memory" (process-local token buckets),
	// "redis" (shared via REDIS_URL across replicas), or omit for auto
	// (redis when REDIS_URL is set, otherwise memory). See
	// internal/ratelimit and initRateLimiter in cmd/serve.go.
	Backend   string         `json:"backend,omitempty"`
	Global    *RateLimitRule `json:"global,omitempty"`
	PerUser   *RateLimitRule `json:"per_user,omitempty"`
	PerAgent  *RateLimitRule `json:"per_agent,omitempty"`
	PerTenant *RateLimitRule `json:"per_tenant,omitempty"` // wired in internal/ratelimit.AllowTenant
}

RateLimitEntry is the "rate_limit" section of langgraph.json. Any subset of dimensions may be set; the rest are unlimited.

type RateLimitRule

type RateLimitRule struct {
	RPS   float64 `json:"rps"`
	Burst int     `json:"burst"`
}

RateLimitRule configures one token bucket.

type ReclaimEntry

type ReclaimEntry struct {
	// MaxRetries caps how many generations a job may reach via reclaim
	// before it is permanently failed. When the next reclaim would bump
	// generation above this value, the job is removed from inflight and
	// marked error instead of re-enqueued. Default 3 when the reclaim
	// section (or this field) is absent. Explicit 0 means unlimited
	// (pre-ceiling behavior). Overridable by RUNKITE_RECLAIM_MAX_RETRIES.
	MaxRetries *int `json:"max_retries,omitempty"`
	// MaxAge is how long an in-flight job may go without a successful
	// Heartbeat/Renew before ReclaimStale re-enqueues it. Go duration
	// string (e.g. "6s"). Default 6s when absent. Sized for ~2s runner
	// heartbeat cadence and the 2s reclaim ticker -- lower values risk
	// false reclaims; higher values slow crash recovery. Overridable by
	// RUNKITE_RECLAIM_MAX_AGE.
	MaxAge string `json:"max_age,omitempty"`
}

ReclaimEntry is the "reclaim" section of langgraph.json -- poison-pill generation ceiling for crash-looping jobs.

type RetentionEntry

type RetentionEntry struct {
	// RunsMaxAge prunes TERMINAL runs (success/error/interrupted/timeout
	// -- never pending/running) whose updated_at is older than this. Go
	// duration string (e.g. "720h" for 30 days). Absent/empty disables
	// run pruning.
	RunsMaxAge string `json:"runs_max_age,omitempty"`
	// CheckpointsKeepLast keeps only this many most recent checkpoints
	// per thread (never touches a thread's own current-state snapshot,
	// only its history). Absent/zero/negative disables checkpoint
	// pruning -- there is deliberately no way to write a config that
	// means "prune everything."
	CheckpointsKeepLast int `json:"checkpoints_keep_last,omitempty"`
	// CronClaimsMaxAge prunes cron_claims rows (README's "Cron's claim
	// table has no retention sweep" gap) with fire_time older than this.
	// Same Go duration string format as RunsMaxAge; independently
	// optional -- a deployment with no cron schedules configured never
	// needs this.
	CronClaimsMaxAge string `json:"cron_claims_max_age,omitempty"`
	// TerminalHookClaimsMaxAge prunes terminal_hook_claims rows (the
	// multi-replica terminal-webhook exactly-once table) with claimed_at
	// older than this. Same Go duration string format as RunsMaxAge;
	// independently optional -- a deployment with no webhooks configured
	// never writes this table (finishRun gates on HasSinks).
	TerminalHookClaimsMaxAge string `json:"terminal_hook_claims_max_age,omitempty"`
	// WebhookDeadLettersMaxAge prunes webhook_dead_letters rows whose
	// failed_at is older than this. Same Go duration string format as
	// RunsMaxAge; independently optional.
	WebhookDeadLettersMaxAge string `json:"webhook_dead_letters_max_age,omitempty"`
	// ConnectorActionsMaxAge independently prunes resolved connector action
	// evidence. Unconfirmed dispatch and unknown outcomes are retained.
	ConnectorActionsMaxAge string `json:"connector_actions_max_age,omitempty"`
	// IntervalMinutes controls how often the background prune loop
	// runs. Defaults to 60 (once per hour) if any field above is set
	// but this is omitted.
	IntervalMinutes int `json:"interval_minutes,omitempty"`
}

RetentionEntry is the "retention" section of langgraph.json.

type RunTimeoutEntry

type RunTimeoutEntry struct {
	// MaxDuration is how long a run may stay pending or running before
	// the control plane forces it to status "timeout". Go duration
	// string (e.g. "30m", "2h"). Required for the section to take
	// effect -- absent/empty/invalid disables the sweep entirely.
	MaxDuration string `json:"max_duration,omitempty"`
	// IntervalSeconds controls how often the background sweep looks
	// for overdue runs. Defaults to 15 if omitted or <= 0.
	IntervalSeconds int `json:"interval_seconds,omitempty"`
}

RunTimeoutEntry is the "run_timeout" section of langgraph.json.

type VectorStoreEntry

type VectorStoreEntry struct {
	Type string `json:"type"` // "pgvector" | "qdrant" | "weaviate" | "pinecone"
	// Dimensions fixes the embedding vector's width (pgvector's
	// vector(N) column / Qdrant's collection vector size / Pinecone's
	// index dimension are all fixed-dimension; Weaviate has no such
	// native constraint, so that package enforces it itself instead --
	// see internal/vectorstore/weaviate's own doc comment). Defaults to
	// 1536 (a common text-embedding width) when omitted
	// -- every item upserted must supply exactly this many floats.
	Dimensions int `json:"dimensions,omitempty"`
	// URL is Qdrant's, Weaviate's, or Pinecone's REST base URL (e.g.
	// "http://localhost:6333" / "http://localhost:8080" /
	// "https://api.pinecone.io"), read from QDRANT_URL / WEAVIATE_URL /
	// PINECONE_URL if unset here -- same env-var-first, config-second
	// convention as POSTGRES_DSN for pgvector. Ignored for type=pgvector.
	// For type=pinecone specifically, defaults to Pinecone's own fixed
	// control-plane host (https://api.pinecone.io) if left entirely
	// unset -- only override this to point at a self-hosted Pinecone
	// Local instance for development/testing.
	URL string `json:"url,omitempty"`
	// Collection names the Qdrant collection every tenant/namespace
	// shares (see internal/vectorstore/qdrant's package doc for why one
	// shared collection, not one per tenant/namespace). Defaults to
	// "vector_items". Ignored for type=pgvector/weaviate/pinecone.
	Collection string `json:"collection,omitempty"`
	// Class names the Weaviate class every tenant/namespace shares --
	// Weaviate's own naming rule (must start with an uppercase letter)
	// applies. Defaults to "VectorItems". Ignored for
	// type=pgvector/qdrant/pinecone.
	Class string `json:"class,omitempty"`
	// Index names the Pinecone index every tenant/namespace shares --
	// Pinecone's own naming rule (lowercase alphanumeric/hyphens only)
	// applies. Defaults to "vector-items". Ignored for
	// type=pgvector/qdrant/weaviate.
	Index string `json:"index,omitempty"`
	// APIKey authenticates against a real Pinecone account, read from
	// PINECONE_API_KEY if unset here -- never write a real key directly
	// into langgraph.json, same secrets-via-env convention as
	// RUNNER_TOKEN/POSTGRES_DSN elsewhere. Ignored (and unnecessary) for
	// Pinecone Local, which doesn't authenticate requests at all.
	// Ignored for every other type.
	APIKey string `json:"api_key,omitempty"`
	// Cloud/Region place a real Pinecone serverless index at creation
	// time (e.g. "aws"/"us-east-1", Pinecone's own documented example
	// values, which is also this package's default when both are left
	// empty). Meaningless for Pinecone Local, which accepts and ignores
	// any value here. Ignored for every other type.
	Cloud  string `json:"cloud,omitempty"`
	Region string `json:"region,omitempty"`
}

VectorStoreEntry is the "vector_store" section of langgraph.json, the vector/semantic store config. "pgvector" (Tier 1, SQL-based), "qdrant", "weaviate", and "pinecone" (the non-SQL exemplars, same role Mongo plays for state.Store) are all implemented now -- every backend named in the original plan is built.

type WebhookEntry

type WebhookEntry struct {
	URL    string   `json:"url"`
	Secret string   `json:"secret,omitempty"` // HMAC-SHA256 signing secret, sent as X-Runkite-Signature
	Events []string `json:"events,omitempty"` // event type names (run_start, run_complete, tool_call, error, interrupt, policy_decision, budget_alert); empty means all
}

WebhookEntry is one entry in langgraph.json's "webhooks" array — async observational delivery on lifecycle events, with retry and dead-letter (see internal/hooks.WebhookSink).

Jump to

Keyboard shortcuts

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