Agent Infra CLI
infra is a command-line client built on agent-infra-sdk. Infra services use
the Agent Infra Gateway. File and command operations go through Environment
Computer and Space APIs.
Install
Since 0.3.0 the CLI follows the SDK's Environment-only boundary: use infra computer,
infra space, and infra evaluate. Removed infra workspace commands are not
remapped to legacy routes.
The default Gateway is http://127.0.0.1:5200. Persist a remote Gateway once:
Resolution order is --gateway > SKY_GATEWAY_URL > saved config > local
default. Override the config path with --config or AGENT_INFRA_CONFIG.
The default path is:
- macOS:
~/Library/Application Support/agent-infra/config.json - Linux:
${XDG_CONFIG_HOME:-~/.config}/agent-infra/config.json - Windows:
%APPDATA%\agent-infra\config.json
Environment configuration remains supported:
Do not put a long-lived token directly on the command line in shared shell environments; process arguments and shell history may be visible to others. The config file stores only the Gateway URL, never credentials.
Sky credentials
Credential resolution order is --token > SKY_GATEWAY_TOKEN > a directly
readable local ~/.sky/credentials token. Inspect discovery without printing
secrets:
Modern sky login credentials use an ENCv1 encrypted store. Infra detects
that login state but deliberately does not decrypt another CLI's credential
file. In that case, issue a scoped Sky user API token and expose it as
SKY_GATEWAY_TOKEN. infra auth status reports this as
sky_login_encrypted and provides the same guidance.
Examples
# Health and discovery
# Agent Registry
# Runtime Identity lifecycle
# Agents are configurations bound to Runtime IDs; reverse lookup stays here
# Durable context; append accepts an array of ConversationRecord objects
# Langfuse-backed trace metrics (repeat --project-id to query multiple projects)
# Allocate/query Langfuse projects through the Trace admin API
# Runtime Langfuse binding (product path; not Admin)
# Environment computers, spaces, and snapshots
# Submit an E2B template or Moulin Dockerfile recipe and return immediately.
# Each poll/get performs at most one provider status query; the CLI never loops.
# list reads only the local catalog and never queries the provider.
# snapshot-build.json for an E2B template build:
# {"provider":"e2b","visibility":"private","owners":[],"builtin":false,
# "build":{"kind":"template","pipPackages":"numpy\\npandas"}}
# Deploy runtime templates and bound repositories
# Submit an UpdateMoulinAdminConfigRequest document. Leave apiKey empty to keep
# the current secret; set clearApiKey=true only when you intend to remove it.
# Initialize a runtime, agent, repo, trace binding, context, and default model
# OpenAI-compatible Model Infra JSON APIs; '-' means stdin
|
# Durable execution runs and events
Complex write requests are supplied as JSON files or standard input so the CLI
stays aligned with the SDK's contract types as those contracts evolve. JSON
field names use the contracts' camelCase wire format.
moulin-config.json contains the Moulin runtime/build URLs and non-secret
BuildJob defaults. build.httpProxy / build.httpsProxy are injected into the
Dockerfile RUN environment; they do not configure Deploy's own outbound
proxy. Deploy's process-level outbound proxy is MOULIN_PROXY_URL, which must
be set through the deployment environment and is not exposed by this Admin API.
infra deploy repo init clones the bound GitLab repository with the operator's
local Git credentials and writes a gitignored .env.local containing
RREPO_ID, REPOSITORY_URL, and optional AGENT_ID / RUNTIME_ID. Pass
--dir to choose the checkout path and --no-clone to write the env file
without cloning. JSON stdout remains the repository record; the checkout path
is printed on stderr. Tokens are never written to .env.local.
infra runtime create prints the complete CreateRuntimeIdentityResponse.
On the first successful create this includes the one-time bootstrapToken;
treat stdout as secret-bearing output and do not write it to shared logs.
After permissions are installed and the identity is active,
runtime bootstrap-credential exchanges that proof through the public Gateway
bootstrap endpoint. Its JSON output also contains a secret workload token.
infra runtime credential ensure creates or reuses a durable Recovery
Credential for an already-active Runtime Identity. The plaintext secret is
stored in the OS keychain (service agent-infra.runtime-recovery) or, with
--store file --yes, a 0600 file under ~/.agent-infra/recovery-credentials.
credential exec injects AGENT_INFRA_RECOVERY_CREDENTIAL into a child process
and never prints the secret. Do not write recovery secrets to .local.env,
shell history, or logs.
The common create path takes a mutable name directly and defaults kind to
code. The service derives a deterministic idempotency key from the normalized
creation name, so callers normally do not pass one:
infra agent create --name weather --runtime-id rti_01K... is the common Agent
path. The Registry derives an idempotency key from the normalized name unless
--idempotency-key is passed. Creation still requires at least one Runtime ID.
The --file form remains available for extra relations.
runtime_id remains stable when the name changes:
Use --idempotency-key only to control an exceptional retry scope. The
advanced --file form remains available for a complete request document:
Lifecycle commands (activate, suspend, resume, and revoke) accept a
TransitionIdentityRequest document: