Give your agent the task and the workspace you intend to use. Switch to For agents for the complete command reference, or use it directly from your terminal.
Sign in
struct login --device --json and give the person the link and code. Device login requires server support. --no-browser suppresses opening a browser but does not by itself turn a loopback callback into device login: a loopback link must be opened in a browser that can reach the CLI’s machine.Use struct login --org WORKSPACE_ID --admin --json when a workspace admin needs to create keys, configure the GitHub deployment webhook or administer members. The person approves this additional permission. A normal login grants read/write access subject to the person’s role; requesting admin scope does not make a member an admin. Billing changes stay in the web app.Workspace API keys
Use a workspace API key for recurring jobs such as on-call polling or merged-PR coverage. This requires a Struct server that supports workspace automation scopes and an updated CLI with workspace-key support.In the intended workspace, a workspace admin signs in and creates the key:workspace:read, telemetry:read, monitors:read, monitors:write and observations:publish. For a polling job, pass only the scopes it needs with repeated --scope flags. Explicit scopes take precedence over the preset.Store the key printed at creation in the runner’s secret store. Supply it as STRUCT_TOKEN when running commands such as struct whoami --json, struct telemetry query and struct monitors firings --json. The CLI uses the key in memory. The optional workspace:read scope lets whoami verify the workspace ID.With the write scopes, the key can add Observations, publish its own drafts, end its own overlays, and create or update native monitors. Each scope works only in the key’s workspace, with the workspace’s feature settings. An admin revokes an automation key with struct keys api revoke KEY_ID.See workspace API keys for MCP to use the same key from an unattended MCP client.Create a workspace
Requires CLI 2.5.0 or newer and agent signup available on the server. The agent setup guide covers the full flow.--no-wait returns without issuing an approval link; it includes workspace, claimed: false, activeUntil and deleteAfter. Without --no-wait, init prints a claim link and waits for a person.Until claim, the temporary key can manage ingest/deployment keys, query telemetry and configure native monitors while the workspace is active and activated. Other setup operations require claim. There may be ten non-deleted native monitors, including disabled ones; deletion frees a slot. Background AI and outbound notifications remain off.
Claim and resume
url and userCode from the waiting_for_human event. With --json they appear only there, on stdout, never on stderr. They sign in, verify the workspace preview and claim it. The CLI then replaces its temporary login with a login acting as the claimer, who becomes the workspace admin. Completion reports claimed: true and loggedIn: true.A code can expire while the CLI waits; it prints a replacement until the command’s timeout. On claim_timeout, the workspace is kept. Run struct init again from the same environment to resume, or struct init --status --json to check once. Do not use --new as a retry.A workspace that pauses before claim retains configuration and existing firing-history reads. Telemetry queries, previews and new setup changes wait for claim. Check the returned deadlines; on claim_expired, follow the command’s recovery advice rather than assuming the original workspace is recoverable.The claim state is saved under ~/.struct/pending-claims/ and logins under ~/.struct/profiles/, with private file permissions. Preserve them when resuming in the same environment. Do not copy these files into the repository or paste their contents into chat. If you lose this environment after a person claimed the workspace, use struct login --org WORKSPACE_ID to authorize a new login.Recovery
Access tokens last one hour and renew through the saved login. Ninety days without renewal requires sign-in again. Network failures preserve the saved login.
STRUCT_TOKEN overrides profiles and is never saved automatically. struct login --with-token reads a token from stdin, but refuses to overwrite an existing OAuth login for that workspace.Interactive CLI and MCP logins authorize separately. Installing Struct MCP supplies the server URL for your client’s sign-in.