Reference
Runtime calls
Make provider requests under an exception, send files, and resolve identity with a runtime API key.
sdk-passthrough makes one-off runtime calls with a runtime API key: calling a provider under a credential-release exception, sending a file through Alter, and checking which identity the backend resolves for a key.
alter sdk-passthrough request <grant-id> --url <url> [--method ...] [--body ...] [--header ...] [--api-key <key>]alter sdk-passthrough upload <grant-id> --url <url> --file <path> [--method ...] [--header ...] [--api-key <key>]alter sdk-passthrough deliver-upload <approval-id> --file <path> [--timeout <seconds>] [--api-key <key>]alter sdk-passthrough resolve-identity [--user-token <jwt>] [--app-user-id <uuid>] [--include-profile] [--agent-only] [--api-key <key>]request
Section titled “request”Makes one provider call with a released credential, so it needs a scoped, expiring credential-release exception. It works with any provider, for example AWS from a private VPC where a proxy cannot be used. Without an exception the command prints non_proxy_disabled with the recovery steps and exits 1. Flags and output are in the non-proxy reference.
upload
Section titled “upload”Sends a file to a provider through Alter, without Alter holding it. The file’s size and SHA-256 are declared first, every policy runs on that declaration, and then the file is sent once. A send is never retried. Requires a key with the proxy:execute scope.
| Flag | Required | Description |
|---|---|---|
--url <url> | yes | The full provider URL. |
--file <path> | yes | The file to send. |
--method <method> | no | POST, PUT or PATCH (default PUT). |
--header <kv> | no | Extra header in Name: value form. Repeatable. |
--api-key <key> | no | Runtime API key, if not using ALTER_API_KEY. |
The provider’s body goes to stdout, and its status line to stderr. A provider status of 400 or above exits non-zero, with the body still on stdout. When the call needs approval, nothing is sent: stdout is one JSON object whose approval_id field names the approval, and status is pending. Pass approval_id to deliver-upload.
APPROVAL_ID=$(alter sdk-passthrough upload <grant-id> \ --url https://uploads.example.com/files/report.pdf \ --file report.pdf | jq -r .approval_id)deliver-upload
Section titled “deliver-upload”Waits for an upload’s approval, then sends the approved file. Only the key that requested the approval can deliver it, and a file that differs from the approved size and SHA-256 is refused with the approval left open.
| Flag | Required | Description |
|---|---|---|
--file <path> | yes | The same file upload declared. |
--timeout <seconds> | no | Seconds to wait for the decision, and then for the result (default 300). |
--api-key <key> | no | Runtime API key, if not using ALTER_API_KEY. |
A refused upload, or a provider status of 400 or above, exits non-zero. A refusal names its proxy_upload_* code on stderr.
resolve-identity
Section titled “resolve-identity”Resolve the canonical identity context for the runtime key (the SDK’s resolveIdentity() — requires the identity:resolve scope on the key). Prints the identity JSON plus, when the key’s identity is eligible, the derived private memory partition (memory_scope), so an operator can verify exactly which app / agent / end-user identity the backend resolves and which partition the SDK’s ScopedMemoryStore would enforce for it. The partition is diagnostic metadata, never a credential.
| Flag | Required | Description |
|---|---|---|
--user-token <jwt> | no | End-user IDP JWT to resolve. Validated against the application’s configured identity provider. Because this value is on argv, the CLI warns that it may appear in shell history/process listings; prefer an environment variable or file-backed command substitution. |
--app-user-id <uuid> | no | Agent-only consent-edge shortcut: resolve this end user without a token. Requires a key bound to a managed agent that holds a delegation from that user — keys minted on the agent-keys surface currently use the legacy alter_key_… prefix; alter_ak_… keys are accepted too. The backend authorizes on the key’s agent binding, not its prefix; the CLI only rejects definitively non-agent prefixes (alter_rk_…, alter_dk_…, alter_pk_…) locally. |
--agent-only | no | Derive the headless application + agent partition for a verified agent key with no represented user. Off by default; without it an active represented user is required. The flag can never drop a user from an identity that represents one (memory_user_cannot_be_dropped). |
--include-profile | no | Opt into PII (email + display name) on the response. Off by default. |
--api-key <key> | no | Runtime API key, if not using ALTER_API_KEY. The CLI validates the complete key format locally and rejects a PAT. |
With neither --user-token nor --app-user-id, the call is headless and resolves the key’s own identity — the application, plus the agent identity when the key is bound to a managed agent.
The JSON document also carries a rate_limit object — limit, remaining and reset_at — reporting Alter’s own remaining budget for the key after this call, so a script can throttle itself before it is throttled. It is null when the backend reported no budget: unknown, never unlimited. See Errors for the header contract behind it.
There is deliberately no assert-identity counterpart: assertion-minting produces a signed credential-shaped token whose only consumers are programmatic verifiers, so it ships on the SDKs only.
# An agent-BOUND key (minted on the agent-keys surface).export ALTER_API_KEY="alter_key_..."
# Which identity does this key resolve for this user's JWT?alter sdk-passthrough resolve-identity --user-token "$USER_JWT" | jq .
# Consent-edge shortcut (agent key + a delegation from this user)alter sdk-passthrough resolve-identity --app-user-id 22222222-2222-2222-2222-222222222222 | jq .memory_scope
# Headless agent: the explicit application + agent partitionalter sdk-passthrough resolve-identity --agent-only | jq .memory_scopePrivate memory scope
Section titled “Private memory scope”Two fields describe the partition, and ineligible identities still print successfully for inspection:
| Field | Shape | Meaning |
|---|---|---|
memory_scope | object or null | The SDK’s MemoryScope as JSON: the versioned v2 namespace array, the slash-joined partition_key, and the user_key / agent_key / app_key correlation labels. null when no private partition can be derived for this identity. |
memory_scope_error | { "code": ..., "message": ... } or null | Why no partition was derived. code is the SDK’s stable MemoryIsolationError.code (for example memory_agent_required for an application-only key, or memory_user_required for a headless agent key without --agent-only); scripts branch on code, never on message. null when memory_scope is set. |
# A script branches on the stable code, never on the message text.alter sdk-passthrough resolve-identity --output json \ | jq -r '.memory_scope_error.code // "ok"'These keys are metadata, not credentials; never accept this JSON as remote identity proof, and never derive ownership from conversation, task or run labels. The full code table is in Errors; the enforcement model is in memory enforcement and migration.