Run it
- Forces test mode for the run. No real money can move.
- Detects your stack (framework, package manager, any existing OAuth or MCP code) and asks for consent before provisioning anything or touching files.
- Signs you in if needed (a one-time code we email you), then provisions your company and a confidential OAuth client with test credentials. The secrets go straight into your app’s env file (
.env.localor.env, chmod 600) and are never shown to the AI. - Makes minimal, idiomatic edits following the Agentcard integration playbook.
- Verifies the integration by issuing a test card, then prints a summary of every file it changed, plus your account dashboard link (
app.agentcard.sh/org/<orgId>) where you can see the cards, balance, and OAuth client it set up.
Options
Agent mode
The wizard is built to be driven by another AI agent (Claude Code, Cursor, a CI job). In agent mode it never prompts: every input is a flag, progress streams as plain lines, and the run always ends with a single machine-readable result line. Agent mode turns on automatically when any of these is true:--agentis passedAGENT_CARDS_WIZARD_MODE=agentis setCLAUDECODEorCLAUDE_CODEis set (Claude Code exports these)CIis set- stdin or stdout is not a TTY
AGENT_CARDS_WIZARD_MODE=interactive to force the interactive UI back on (for example, a human piping output through tee).
The copy-paste invocation:
Driving the wizard from a coding agent. Runs take 5 to 20 minutes end to end, so use a generous timeout (20+ minutes) or run it in the background. Re-running is safe and resumable: a pending sign-in resumes instead of re-emailing, and every exit-2 result carries a
hint naming the missing flag — and, when the value isn’t derivable, what to ask your user (the emailed sign-in code, which organization, the app’s base URL). Resolve it in your own conversation, then re-run with that flag. Add --verbose to stream tool inputs and outputs. If the stream prints a connect link that needs a user tap, open it so the run can continue. On success, hand your user the dashboardUrl from the result line — it’s their account view (cards, balance, billing) for everything the wizard set up.Sign-in
With no existing session, the wizard emails a one-time code to--email. Interactive runs prompt for the code in place; in agent mode the run exits 2 with code_required and the driving agent asks its user for the code, then re-runs with --code.
Re-runs resume a pending sign-in: if a driving agent times out and runs the wizard again, it continues the same session instead of sending a fresh, superseding email. If more than one email did get sent, use the newest one.
Legacy backends that still sign in with a magic link are handled by polling: the wizard waits up to 15 minutes while someone clicks the link (override the window with AGENT_CARDS_WIZARD_LOGIN_TIMEOUT_MS, in milliseconds); transient backend errors during the wait are retried with backoff instead of failing the run. Against the current backend you finish a code sign-in with:
agent-cards login) or an exported AGENT_CARDS_JWT skips sign-in entirely.
Progress and the result line
While it works, the wizard streams plain progress lines, and during any silent stretch (in every phase, sign-in wait included) it prints a heartbeat so a driver can tell a pause from a hang:AGENTCARD_WIZARD_RESULT prefix; the rest of the line is one JSON object. A success payload (pretty-printed here, the real thing is a single line):
credentialsReused is true when the wizard found valid Agentcard credentials already in your env (from a previous run) and reused them instead of minting new ones. Re-runs are therefore idempotent: they do not pile up orphaned clients, and a multi-company account only needs --org on the first run (the saved credentials pin the company). A warnings array appears when there is something worth flagging, for example ["not_a_git_repo"] (the wizard still runs, you just lose the review-the-diff safety net).
Failures look like {"ok":false,"error":"<code>","runId":"…"} plus what a driver needs to recover without scraping the stream. Every exit-2 (missing/bad input) failure carries a message saying what is wrong and a hint saying how to fix it — including what to ask your user when the value can’t be derived (the sign-in code from their inbox, which company the app belongs to, the app’s base URL). Relay that question, then re-run with the flag the hint names. Company-selection errors additionally carry the orgs list ([{id, name}]) so the user can pick from real options. Exit-1 failures carry a bounded message and, when the cause is recognizable, a probableCause (gateway_disabled, daily_limit_exceeded, gateway_unconfigured, or auth_expired_mid_run).
Secrets never appear in the stream or the result line. The OAuth client credentials are written only to your app’s env file.
Exit and error codes
Both modes let the user complete these cases instead of dead-ending — they just do it through different surfaces. The interactive wizard prompts in place: a bad--path asks for the right directory, an over-long app name asks for a shorter one, an unknown --org falls back to the company picker, an invalid --app-url or --email falls back to the corresponding prompt, and a mistyped sign-in code re-prompts instead of failing the run. In agent mode the same resolution happens through the driving agent: the exit-2 result line carries message + hint (+ orgs on org errors) telling the driver exactly what to ask its user and which flag to re-run with, so the case gets solved in the driver’s own conversation.
Good to know
- Re-running is safe. The wizard detects an existing integration and continues or fixes it; it never duplicates the integration.
- You review everything. Edits happen locally and are left uncommitted; nothing ships until you commit.
- It ends in test mode. Production credentials come with a company subscription (
agent-cards companies subscribe) when you’re ready to go live. - Telemetry. The CLI reports lifecycle events (run started, phases, completion, with run id, error codes, and durations; never repo contents, paths, or secrets). Opt out with
DO_NOT_TRACK=1orAGENT_CARDS_TELEMETRY=0.