Asking for a credential
When an agent needs a credential the project doesn’t have, it can ask the person the machine works for, instead of failing or sending them a message. The person sees the request in the portal, and on their phone in the AgentSpaces app. They paste the value there, and it is saved as their personal credential; in the portal they can make it the project’s (every machine in it uses it) or transferable to another member (a service account) afterwards; see the three kinds.

space-env credential request GITHUB_TOKEN --label "GitHub token" --reason "Push the fix branch to github.com/acme/api" --host api.github.com --auth-url https://github.com/settings/tokens --auth-url-label "Create a GitHub token" --wait
space-env credential request DB_PASSWORD --label "Staging database password" --reason "Run the migrations on staging" --wait 600The first asks for a token the platform puts into requests to api.github.com (send
Authorization: Bearer asp_env_GITHUB_TOKEN; the token itself never enters the machine). The
second asks for a value the machine reads with space-env credential get DB_PASSWORD. --wait blocks
until the person answers.
space-env secret is the older name of space-env credential, and run --secrets of
run --credentials; both keep working.
Tell the person how to get the credential with --instructions, Markdown from a file or
from stdin:
space-env credential request GITHUB_TOKEN --label "GitHub token" --reason "Push the fix branch" --host api.github.com --instructions - <<'EOF'
Create a fine-grained token for **acme/api** with *Contents: read and write*, valid for 30 days, and paste it.
EOFWhere the value goes
| Request | Stored as | Used by the machine |
|---|---|---|
| plain | credential NAME, readable in the machine | space-env credential get NAME, space-env run --credentials NAME |
--host HOST | credential NAME, bound to HOST in --header (default authorization) | the placeholder asp_env_NAME in that header; the proxy swaps it |
--kind K | an agent account (MISTRAL_API_KEY, ANTHROPIC_API_KEY, ...), bound to its provider | the agent, through the model gateway |
--one-time | nothing: the value goes only to the waiting --wait caller, once | stdout of space-env credential request --wait |
Whether the credential belongs to the project or to the person is their choice. A personal one is used only by the machines that run on their behalf, and on those it wins over the project’s credential of the same name.
A --host credential works from every machine that uses it: the project’s machines for a
project credential, the person’s machines for a personal one. The platform reads those
machines’ HTTPS to the host (with its own certificate, which the machines trust) to put the
value in; a program there that doesn’t trust the platform’s certificate (a CI job in a
container) can’t reach that host. Machines that don’t use the credential reach the host
directly, untouched.
Options
| Option | |
|---|---|
--label TEXT | What it is in words, the request’s title (at most 60 characters): “GitHub token”. Without one, an agent account’s kind name, else NAME. |
--reason TEXT | What it is for, in one line (at most 500 characters). |
--instructions FILE or - | Markdown, at most 8 KiB: what the person must do to get it. Shown as text: no HTML, no images, links with their full address. |
--auth-url URL | https only: the page where they sign in or create the credential. |
--auth-url-label TEXT | The button’s text, at most 40 characters (default “Open sign-in page”). |
--logo-url URL | https: the service’s logo. The portal fetches it once (PNG, JPEG or WebP, at most 256 KiB) and shows its own copy. |
--kind K | An agent account kind: mistral_api_key, anthropic_api_key, openai_api_key, claude_subscription, chatgpt_subscription. NAME must be one of the kind’s names. |
--one-time | A sign-in code a waiting login exchanges once: never stored. Needs --wait. |
--host HOST | The API host the credential is for. |
--header HEADER | With --host: the header it goes in (default authorization). |
--wait [SECS] | Block until the request is filled or dismissed, for ever or up to SECS. |
--wait exits 0 when the request is filled, 4 when it was dismissed, cancelled or expired, and 5 when
SECS ran out with the request still open. Asking again for the same NAME while a request is
open finds that request, so space-env credential request NAME --reason ... --wait later picks up
the wait where you left it. A machine has at most 10 open requests; each expires after 7 days.
When a request is filled or dismissed, the machine also gets an info message (qos notify).
Cancelling a request
When the credential is no longer needed (you found it elsewhere, the task changed or was dropped), take the request back, saying why:
space-env credential cancel GITHUB_TOKEN --reason "The fix was pushed over SSH instead"Name the request by its credential’s NAME (the machine’s open request for it) or by the id
credential request printed. It leaves the person’s open requests in the portal, the app
and the canvas; the portal lists it under Answered as cancelled, with your reason. A
waiting --wait ends with exit 4. The reason is one line of at most 500 characters, written
for the person like the request’s. A machine cancels only its own requests, and an agent on
a hub only its own; a request that is closed already can’t be cancelled.
Replacing a value that was filled wrong
When a credential the machine asked for turns out wrong (the service refuses it, or the
person pasted two values into each other’s places), ask for a new value with --replace,
saying in the reason what is wrong:
space-env credential request S3_ACCESS_KEY --replace --reason "Refused with 403: it looks swapped with S3_SECRET_KEY" --wait
space-env credential request S3_SECRET_KEY --replace --reason "Refused with 403: it looks swapped with S3_ACCESS_KEY" --waitThe person gets a request to replace the value. What they paste goes into the same
credential, which stays as the person has it now: the same owner (theirs or the project’s),
and the hosts and readability they gave it, also when they changed those since it was
filled. The machine never sees the old or the new value, and can’t change where the
credential goes: --replace takes no --host, --header, --kind or --one-time. A machine can ask to replace only a
credential it asked for itself (an agent on a hub, only its own) that was filled and is
still stored; any other credential is changed by the person on the project’s
Credentials page.
Who is asked
The person asked is the user the machine runs on behalf of (space-env whoami, on_behalf_of): a
request can’t pick another. A machine that runs on behalf of nobody can’t ask; add the credential
in the portal instead.
An agent that needs to sign in asks its own owner: a request from the machine that runs the agent is the agent’s, and the person sees it on the canvas, floating beside the agent, with Fill in and Dismiss. Every request that arrives while the canvas is open also shows there as a toast.
Write the label, the reason and the instructions impersonally, for someone reading them on
a phone: short, concrete, with the exact page to go to. “GitHub token”, “Push the fix
branch to github.com/acme/api”, “Create a token with the scope repo and paste it”; not “I
need to push ...” or “Please create ...”.