Workspace secrets
Give browser agents saved website logins, store API keys and tokens as workspace environment variables, and keep credential values out of agent output.
Sign your agents in to websites
Give a browser agent a saved login and it can sign in on any of your computers without asking for the password.
The encrypted store holds the site's username, password, authenticator setup and passkeys. Choose all your agents
(agents), one project (project), or one thread (conversation). Each computer signs itself in to the site.
Save a login from your application's secure credential entry flow with a person's session (TypeScript SDK 0.32.5+):
import { ShardfluxAccount } from '@shardflux/sdk';
const account = new ShardfluxAccount({ sessionToken: process.env.SHARDFLUX_SESSION_TOKEN! });
const login = await account.siteLogins.add({
organizationId: process.env.SHARDFLUX_ORGANIZATION_ID!,
site: 'https://agent.example.com',
username: 'agent@example.com',
password: process.env.WEBSITE_PASSWORD!,
scope: 'agents',
});On the workspace's shardflux-credentials MCP server, your agent calls sign_in where it is browsing:
{"name":"sign_in","arguments":{"url":"https://agent.example.com","account":"agent@example.com"}}The tool opens that computer's browser and uses the saved login, including authenticator codes or a passkey when the
site asks for them. Its result reports the sign-in state; credential values stay outside model context.
credential_fill({site, fields, account?}) fills selected fields on an open page. Logins match their exact origin and
the related sign-in origins approved for them, so a login for one site stays with that site's sign-in flow.
On a sign-up page, create_account generates a password on the agent's computer, fills the form and saves the login
in the same store. The agent can then submit the form, or pass submit: true to submit with the call. totp_enroll
reads the site's authenticator setup on that computer, saves it to the login and fills the confirmation code.
Passkeys created in the agent's browser are saved with the login for its next sign-in.
For an account that already exists, save_login({site, username, secret}) saves its login from a credential in the
agent's environment: the agent names the credential, and Shardflux copies its password into the login on the server.
The login appears in the person's store like any other.
A saved password or authenticator stays the one the site knows. When the account already has one, create_account,
save_login and totp_enroll keep it and answer login_exists or totp_exists with who saved it and when, so the
agent signs in with it. After the agent changes the password or authenticator on the site, it passes replace: true
and the login is updated in place; the store keeps every earlier version.
When the store needs a login, your product can show a secure sign-in request to the person on any device. Your secure
handler saves the answer in the chosen scope and seals it to the requesting computer with /fulfil. A saved answer
within the request lifetime wakes an agent that has moved on, and its next sign-in uses the store. The
HTTP answer flow shows the calls for your UI.
Use the same SDK object to list metadata, explicitly reveal a value on the person's device, and remove a login:
const logins = await account.siteLogins.list({ site: 'https://agent.example.com' });
const value = await account.siteLogins.reveal(login.id); // only in the person's secure UI
await account.siteLogins.remove(login.id);The TypeScript (0.32.5+) and Python (0.28.3+) references list the store
methods. The HTTP reference covers POST /v1/site-logins,
GET /v1/site-logins, POST /v1/site-logins/{id}/reveal and DELETE /v1/site-logins/{id}. List responses contain
metadata such as username, scope, TOTP and passkey status, provenance and last use. Reveal requires a person's session
and is audited. See website sign-in limits for sizes and request timing.
Store a secret and bind it to a workspace
Store a credential once as a project secret and bind it to workspaces by name. Every command and terminal in the workspace gets it as an environment variable, and no API ever returns the value.
const projectId = (await cloud.me()).api_key!.project_id;
await cloud.secrets.create(projectId, { name: 'OPENAI_API_KEY', value: process.env.OPENAI_API_KEY! });
const ws = await cloud.workspaces.open({ key: 'customer-42/main', template: 'python-node-browser', secrets: ['OPENAI_API_KEY'] });
await ws.secrets.set(['OPENAI_API_KEY', 'DATABASE_URL']); // replace the binding; [] clears itimport os
project_id = sf.me()["api_key"]["project_id"]
sf.secrets.create(project_id, "OPENAI_API_KEY", os.environ["OPENAI_API_KEY"])
ws = sf.open(key="customer-42/main", template="python-node-browser", secrets=["OPENAI_API_KEY"])
ws.secrets.set(["OPENAI_API_KEY", "DATABASE_URL"]) # replace the binding; [] clears itprintf %s "$OPENAI_API_KEY" | shard secrets create OPENAI_API_KEY
shard ws open customer-42/main --template python-node-browser --secret OPENAI_API_KEY
shard ws secrets customer-42/main # names and status, never values- On an existing key,
secretsreplaces the binding; leaving it out keeps it. Forks keep the binding. - A single command can add more with
secretRefs(secret_refsin Python), for that process only. rotatestores a new value as the next version and erases the older ones. Running processes keep what they read.- A secret can be limited to specific workspaces and tools (
allowedWorkspaceIds,allowedTools;execandptyby default). A name that is unknown, or one the workspace may not use, is refused on open with422(reason: secret_not_available,details.names), and nothing changes.
Install the CLI with npm i -g shardflux. If npm reports EACCES or EPERM, follow the
user-directory install.
Type a secret in a page
Add a project secret without pasting it into a terminal or a chat (CLI 0.22.0+):
shard secrets create GITHUB_TOKEN --ask
shard secrets rotate GITHUB_TOKEN --ask--ask opens a one-time page on your computer. Type the value there: it goes straight to your project's secrets, and
the page says Saved once it is stored. An agent that runs the command sees only that the secret was saved; in its
shell, --ask is the default when nothing is piped. Without --ask, your own terminal asks with a hidden prompt.
shard files write <key> <path> --ask does the same for a secret file in a workspace, such as ~/.npmrc. The page
closes after one use or 10 minutes.
Sign a workspace's browser in
A browser session gives the workspace's browser your customer's signed-in state for chosen sites, so a browser agent starts logged in and never sees a password. Sessions are write-only: reads return metadata.
const state = await context.storageState(); // a Playwright context your app signed in
await cloud.browserProfiles.put('customer-42-crm', {
scope: { workspace_id: ws.id }, // or 'project' for every workspace of the project
sites: [{ site: 'https://crm.example.com', storage_state: state }], // Playwright cookies and origins
});state = context.storage_state() # a Playwright context your app signed in
sf.browser_profiles.put(
"customer-42-crm",
scope={"workspace_id": ws.id},
sites=[{"site": "https://crm.example.com", "storage_state": state}],
)storage_state is Playwright's storage state: cookies, and each origin's local storage. A workspace-scoped session
takes precedence over a project-scoped one. remove(name, { site }) revokes one site; without site it removes the
session. Stored encrypted with AWS KMS; only this project's workspaces can load it, and every load is logged.
Keep secret values out of output
Bound secret values are redacted from exec output, terminal streams and saved command logs. The filter also covers base64 and URL-encoded forms and secrets split across output chunks. Tool-call capture sanitizes bound secret values before writing captured input and output.
Project secrets are stored encrypted with AWS KMS; only the project's workspaces can load them, and every load is
logged (shard secrets access-log).
Template files remain ordinary files, so keep secrets in project secrets rather than in a template.
The CLI, TypeScript and Python references list every option; Browser sessions has the HTTP shape.
When you do not have an account for a service, choose Create the account for me on its credential request. The requesting agent continues the same task, creates the account and stores its credentials securely. It asks you only for a specific remaining step that only you can take, such as email verification or approving a paid plan.