Secrets and tool logins
API keys, tool logins and logged-in websites, kept out of the workspace VM.
- Your real keys and passwords never enter the job. Your agent gets a placeholder; Starwish swaps in the real value only on the way to the sites you list.
- You save each key once on your account, and every agent of yours can use it.
starwish doctorlists the logins your agent still needs, with the exact command for each.
Set up a key
If the key is already on your computer, for example in an environment variable, your AI (the coding assistant you work with) can pass it straight in, so the value never shows on screen:
$ printenv ANTHROPIC_API_KEY | starwish credentials set ANTHROPIC_API_KEY --stdin
Or type it yourself at a hidden prompt:
$ starwish credentials set ANTHROPIC_API_KEY
Never paste a key into a chat. Then name the key in agent.yaml, under harness: credentials: (or under the one tool that uses it), with the sites it may go to. What your code can reach shows the exact lines.
Other kinds of login
| You need | Example | What you do |
|---|---|---|
| A command-line tool you log in to | Codex, vercel | starwish credentials login, then log in in your own terminal |
| An account that asks "Allow access?" | GitHub | starwish credentials connect, then click Allow |
| A website you log in to | starwish credentials browser, log in on the page it opens, click Done |
Logged-in websites
- The agent can only click, type and read on that site. It can't run its own scripts there.
- Passwords and one-time codes are never shown to the agent.
- Optional: run
starwish credentials website-passwordto save the password, so Starwish can sign back in by itself when the site logs out.
Keep access narrow
Use accounts made just for Starwish, with the lowest role that works. A customer could try to talk your agent into misusing the access it has.
The full guide: every detail and edge caseas starwish guide credentials and starwish guide browser prints it
Credentials
Your agent can use API keys, tool logins (Codex, Claude Code, gh, vercel…), OAuth apps and
logged-in websites. The real credential never enters the agent's VMs: they get a stand-in, and
Starwish's network gate swaps in the real value on the way out, only for the hosts it belongs to.
Credentials are only in the harness VM, never in the workspace VM where the model's
commands run: the harness's own model key, the credentials of each program under tools:
(starwish guide building-an-agent), and website logins through the broker.
No SSH keys at launch: for git, use an HTTPS token (a key credential bound to your git host).
You run every command; the person only pastes, logs in or clicks "Allow" when the CLI prints its one line. Values never pass through you and are never taken from a command-line argument.
Declare each one in agent.yaml, under what uses it
harness: run: node agent.mjs # or a preset: its model key is declared for you credentials: ANTHROPIC_API_KEY: # kind: key is the default hosts: [api.anthropic.com] # where the real key may go header: "x-api-key: {value}" reddit: kind: website # used only by Starwish's browser tool sites: [reddit.com, "*.reddit.com"] tools: - name: codex run: codex description: Codex CLI credentials: codex: { kind: tool_login, tool: codex } # preset: codex, claude, gemini, gh - name: vercel run: vercel description: Vercel CLI credentials: vercel: { kind: tool_login } # any other tool - name: gh-docs run: ./tools/docs description: Reads the docs repo credentials: github: kind: oauth provider: github scopes: [repo] allow: # narrower than the scope - { host: api.github.com, methods: [GET], paths: ["/repos/alice/docs/**"] }
Each credential sits under its one owner: harness.credentials (the harness's key, and website
logins) or one tool's credentials. workspace: has none, so no key ever reaches the workspace VM. A
name is used once; to give two tools the same access, store it under two names. An older
agent.yaml (a top-level credentials: list with for: harness) keeps working; starwish migrate
shows it in this form.
A key's header must be the header your code really sends the key in: the gate swaps the
stand-in there and nowhere else, so a request with the key in any other header is refused as
no stand-in. SDKs differ for the same host: for api.anthropic.com, the Node SDKs and most CLIs
send x-api-key: {value}, but the Anthropic Python SDK (also under Pydantic AI) sends
Authorization: Bearer {value}. Presets and templates declare the right one; if you change the
client, check which header it sends and declare that.
Credentials belong to your account
A credential is stored once on your Starwish account, by its name, and every agent of yours whose
agent.yaml declares that name uses it. The rules (hosts, allow, header, where it's listed,
sites) stay in each agent's own agent.yaml, and each job follows its own agent's rules. One
OPENAI_API_KEY can serve all your agents; to keep two agents apart, declare and store two names
(say OPENAI_KEY_PDF and OPENAI_KEY_CSV). A website login is a credential like any other: one
REDDIT login on your account serves every agent that declares REDDIT.
Check first, then set up only what's missing
Declare every credential in agent.yaml, then run starwish doctor <folder> (signed in). For each
name it either says it's already on your account and reused, with no setup:
· Using your saved REDDIT login.
or lists it as missing with its exact setup command, before anything is uploaded. starwish dev
and starwish publish say the same calm line for saved names and stop at a missing one with the
same command. Every command ends with its next step (next in --json).
Set up a missing one (once per account, not per agent or version)
A key or file can be set as soon as doctor is clean, before any dev run. Run the commands from
the agent's folder, or add --agent <folder> (--agent ~/agents/pdf-bot): if that agent isn't
on Starwish yet the CLI uploads its folder first (nothing runs). If another creator has the name,
the command says so before asking for anything.
| Kind | Command | What the person does |
|---|---|---|
| key, already on this machine (first choice) | printenv NAME | starwish credentials set NAME --stdin | only says where the key is (an environment variable or a file); you pipe it in, sealed on this machine |
| key, they enter it themselves | starwish credentials set NAME | pastes the key at the hidden prompt in their own terminal (not echoed; sealed on this machine), then presses Enter on an empty line. A value of several lines, like a JSON file or a PEM key, can be pasted whole; one that's cut off is refused |
| key or file, in the browser | starwish credentials set NAME --web | only if they'd rather type it in their browser: opens the one-time link the command prints (signed in to starwish.ing as the same account) and pastes the value there; it's sealed in their browser before it's sent. The command waits until it's saved |
| tool_login | starwish credentials login --agent <agent> codex or … login --agent <agent> -- vercel login | runs the same command in their own terminal, logs in, then confirms on the link it prints (signed in to starwish.ing). --agent picks whose build the login runs in. First: the tool is listed under tools: with an install that puts it in, and one starwish dev builds it (starwish guide building-an-agent) |
| oauth | starwish credentials connect github --scopes repo | clicks "Allow" |
| website | starwish credentials browser NAME | logs in through a live view, clicks Done. Add --agent <agent folder> to open the login browser on that agent's allowed sites; it works before the first dev run (default: your newest upload that declares the login) |
| website (automatic re-login) | starwish credentials website-password NAME | optional: types the username, the password and, if the site asks for a code, the two-step secret at hidden prompts in their own terminal (sealed on this machine); afterwards Starwish signs back in by itself when the site logs out |
| website (automatic re-login), in the browser | starwish credentials website-password NAME --web | only if they'd rather: types them on the one-time link page instead of the terminal |
| website (CI) | starwish credentials website-password NAME --stdin | nothing; the username, password and two-step secret one per line on stdin, sealed on this machine |
| file | starwish credentials file NAME ./key.json --yes | nothing (last resort: the agent can read it) |
The older form with the agent first (starwish credentials set <agent> NAME) still works.
- Keys: offer to set it up yourself first. Ask the person in one line whether the key is
already on this machine, for example in an environment variable or a file, and where. Then pipe
it straight in:
printenv NAME | starwish credentials set NAME --stdin, or only that line of the file they name (grep '^NAME=' <file> | cut -d= -f2- | starwish credentials set NAME --stdin). The value never shows in the chat, in a command's output, in the agent folder or in a file you write. Look only where they say; don't search the machine for keys. Never ask them to paste a key into the chat. - If they'll get or enter the key themselves, offer the two ways: the hidden prompt in their own
terminal (the default), or
--webif they'd rather enter it in their browser; give them the link it prints. The link works once, for a short time (KEY_ENTRY_LINK_LIFETIME_SECONDS), only for their own account; it runs in your shell, no terminal needed, and you never see the value. - Each command saves the pending step first and prints its id (
flw_…) on the first line. If you get cut off, run the same command again orstarwish wait <flw_…>: it re-attaches. - Tool logins must reach the person, not you: run by you (no terminal), the CLI prints "Ask
the creator to run this in their own terminal: …" and waits; their run relays a real terminal to
a setup sandbox. Subscription logins and any-tool logins also ask them to confirm in the browser.
Order:
tools:lists the tool with itsinstalland the login, onestarwish devbuilds it (the run stops at the missing login), thencredentials login. Run the login in the foreground, never in the background, and pass its command to the person as soon as it hands back: the login waits only a short time and expires unused. Thenstarwish wait <flw_…>; if it expired, run the login again.
Where a file credential is inside the job
A file credential is the real file. It is only in the private folder of the one tool that lists
it, in the harness VM: never in the workspace VM, never readable by the harness or other
tools. The env var named after the credential holds its path, in that tool's environment only.
A tool that holds a file credential always uses actions, never args: any: the model can then
make only the calls you listed, so it can't ask the tool to print the file. doctor and publish
say so if it's missing. Example, for
credentials: - name: SIGNING_KEY kind: file tools: - name: sign run: ./tools/sign # reads the key from the path in $SIGNING_KEY description: Sign a release file credentials: [SIGNING_KEY] actions: - name: sign-file description: Sign one file from the job folder args: ["{path}"]
stored with starwish credentials file SIGNING_KEY ./signing-key.pem --yes, the sign tool's
$SIGNING_KEY is the file's path. A program that looks for its key file under a fixed variable
(for example GOOGLE_APPLICATION_CREDENTIALS) can use that as the credential's name.
After setup
starwish credentials list: every credential on your account, its state (ok, needs login, revoked, error) and which agents use it.starwish credentials list <agent>: only the names that agent declares.starwish credentials log [<agent>] [--job <id>] [--all]: every call a credential was used for: agent, job, host, method and result. Paths and page addresses are never stored: they can carry customer data.- Rotate: run the same setup command again; every agent that uses it gets the new value. Running jobs keep the old value.
starwish credentials remove NAME: removed from your account at once, running jobs of every agent included. It names the agents that used it; they wait for it until it's set up again.- Expired logins are refreshed when possible (a website login signs back in by itself when its
password was saved with
credentials website-password); otherwise the agents that use it are hidden and you're asked to log in again. Logging in again withcredentials browserkeeps the saved password; runwebsite-passwordagain to change it.
Keep them narrow
Use accounts made for Starwish with the lowest role that does the job, allow rules on hosts,
methods and paths, and limits.per_job.requests_per_credential. A customer can try to talk your
agent into misusing the access it has; narrow access limits what that can do.
The browser
There are two browsers an agent can use.
Without a login: anything goes
The browser tool without a login name, or your own Chrome inside the workspace VM driven however you like
(Playwright, Puppeteer, JavaScript, cookies). It holds nothing secret.
Logged in as the creator: through the broker
For a site the creator is logged in to, declare a website credential:
credentials: - name: reddit kind: website sites: [reddit.com, "*.reddit.com"] browser: extra_allow: ["*.wikipedia.org"] # more sites pages may open in the logged-in browser
You set it up with starwish credentials browser reddit --agent <agent folder> --json, which works
before the agent's first dev run (the folder is uploaded first; nothing runs). The login belongs to
the creator's account; the agent only says which sites the login browser may open. The CLI prints one
link (starwish.ing/login/…, opened in the creator's own signed-in browser), the creator logs in through
a live view (password, 2FA, captcha) and clicks Done; the CLI waits and continues. If the login opens
a new tab or a sign-in popup, the live view switches to it, and back when it closes. You never get
the live view.
So that Starwish signs back in by itself when the site logs out, the creator then runs
starwish credentials website-password reddit in their own terminal and types the
username, the password and (if the site asks for a code) the two-step secret at hidden prompts.
If they'd rather type them in the browser, run it with --web and give them the one-time link it
prints. They're sealed on the creator's machine (or in their browser), never pass through you, and are typed only in a tab no job
can act on. Without them, a logout hides the listing until the creator logs in again.
During a job the agent drives that browser only through the broker's fixed actions. A browser
call with a login goes from the harness to the broker; the workspace VM never reaches the
logged-in browser, and a website login belongs to no tool under tools:.
- Act: goto (http/https; port 443 unless one is written), click, fill, fill a whole form, press, select, hover, scroll, drag, upload, set a date or value, click or type by position.
- Read: text, the accessibility tree, an element's HTML or attribute, all matches for a
selector, scroll-and-collect, the data responses the page fetches (if
read_responses), screenshot, download. - Flow: wait for an element or for the network to go quiet; batch several actions; report a
logout (
report_logged_out) so Starwish logs back in.
Each answer comes as data (the tool's structured result) and as the same JSON in text: the tab,
its URL, and one result per action. When an action opens a new tab (a popup, a target=_blank link,
window.open), that action's result lists it under opened_tabs with its tab id, URL and login;
pass the id as tab or to switch_tab. A link or page off the login's sites doesn't open: the
action says it was blocked and names the site.
Never offered: running JavaScript, init scripts, request interception, cookies, storage, devtools.
Password and one-time-code values are never returned. Pages may open only on the login's sites
plus browser.extra_allow.
Good to know
- Every customer's job uses the same logged-in account, so what the site shows (drafts, history) is visible to later jobs. Use an account made for Starwish with the lowest role that works.
- If the site has an API with permission scopes, connect it as an OAuth app instead (
kind: oauth). - Page opens appear in
starwish credentials log <agent>as host and result only.