Claude
Tuist Sandboxes, both Linux and macOS, are currently invite-only. Reach out or ping us in the community Slack to request access for your account.
Anthropic runs Claude's agent loop, and a self-hosted environment decides where Claude's tools run. Connect one to Tuist, and every session in it gets its own Tuist sandbox, on Linux or macOS. Tuist runs the workers and runners those environments need, so you don't host anything.
There are two kinds of environments, one per Claude product:
- Claude Managed Agents: sessions you start with the Claude API or Tuist's agent-sessions API. You create the environment (
env_…) in the Claude Console, and each session can choose Linux or macOS. - Claude Code: cloud sessions developers start from claude.ai, the Claude desktop and mobile apps, and
claude --cloud. A Claude Team or Enterprise Owner creates the environments (ccpool_…) in claude.ai admin settings, one for each platform, and developers pick Linux or macOS by picking the environment.
Both are connected through the Tuist API by an account administrator. Authenticate with tuist auth login, then:
export TUIST_TOKEN=$(tuist auth token)
Claude Managed Agents#
Connect an environment#
Connect from your account's Settings → Integrations → Claude. The form asks for a self-hosted environment and the credential Tuist starts its sessions with:
- Create the environment. In the Claude Console, create a self-hosted environment on the Environments page, open it and click Generate environment key. Anthropic only generates environment keys in the Console.
- Pick a credential with the selector at the top of the form (see below).
- Paste the environment ID and key and choose the platform and shape of the environment's sandboxes.
Tuist fetches the environment with the credential before it saves anything, so a wrong credential, ID or workspace fails in the form. It stores the keys encrypted and never shows them again. Within a minute, Tuist starts serving the environment's sessions. See Linux and macOS for the shapes.
With an API key#
The default, and the quickest way to try sandboxes out. Paste an API key with the developer role in the environment's workspace. The integration marks environments that use an API key; before you rely on one, connect it with a federated identity instead, so Tuist holds no long-lived key.
With a federated identity#
Tuist authenticates with Anthropic's Workload Identity Federation, so you never give it an Anthropic API key. You need the admin role in your Anthropic organization.
- Trust Tuist. The form shows your account's issuer URL and subject prefix. In the Claude Console, open Workload identity, click Connect workload, choose Custom OIDC, and enter them with the scope
workspace:developer. Add the service account the wizard creates to the environment's workspace. - Enter the IDs. The organization ID is under Settings → Organization and the workspace ID under Settings → Workspaces. Connect workload shows the service account and federation rule IDs when it finishes, and the rule's page in Workload identity shows them again. None of them is a secret. If Anthropic rejects Tuist's token, the Console's authentication history shows why.
With the API#
To connect from automation, create a self-hosted environment in the Claude Console, generate its key, and send both to Tuist:
curl -X POST "https://tuist.dev/api/accounts/my-org/sandboxes/agent-environments" \
-H "Authorization: Bearer $TUIST_TOKEN" -H "Content-Type: application/json" \
-d '{
"anthropic_environment_id": "env_...",
"environment_key": "<environment key>"
}'
To start sessions through Tuist's API, also send either the four federation IDs (see Connect without an API key) or an anthropic_api_key. The environment runs on Linux unless you pass "platform": "darwin"; vcpus, memory_mb and workspace_gb change the shape of its sandboxes, and xcode_version the Xcode of its macOS sandboxes.
Start a session#
Each session runs on the environment's platform unless the session asks for another one.
With the Claude API, create the session as usual with the environment's ID, and set tuist_platform in the session's metadata to macos or linux:
curl https://api.anthropic.com/v1/sessions \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "anthropic-beta: managed-agents-2026-04-01" \
-H "content-type: application/json" \
-d '{
"agent": "agent_...",
"environment_id": "env_...",
"metadata": {
"tuist_platform": "macos",
"repository_url": "https://github.com/my-org/my-app"
}
}'
repository_url and, optionally, repository_ref (a branch or commit) make Tuist clone a public repository into the sandbox before the agent's first turn.
With Tuist's agent-sessions API, Tuist creates the agent and the session for you, and clones private GitHub repositories that are connected to your Tuist account:
curl -X POST "https://tuist.dev/api/accounts/my-org/sandboxes/agent-sessions" \
-H "Authorization: Bearer $TUIST_TOKEN" -H "Content-Type: application/json" \
-d '{
"prompt": "Fix the failing snapshot tests",
"platform": "darwin",
"repository_url": "https://github.com/my-org/my-app",
"repository_ref": "main"
}'
When the account has more than one environment, pass agent_environment_id. You can follow the session with GET /agent-sessions/{id}/events, reply with POST /agent-sessions/{id}/messages, and end it with POST /agent-sessions/{id}/archive.
The repository is checked out in /workspace on Linux and /Users/runner/work on macOS. A session's sandbox pauses after the agent finishes a turn and resumes on the next message.
Choose a session's Xcode#
A session's Mac boots before Claude runs any tool, so Claude can't choose its own Xcode. Whoever creates the session chooses it, the same way they choose macOS. Tuist uses the first of these that is set:
-
xcode_versionin Tuist's agent-sessions API, next toplatform. A version Tuist doesn't offer is refused when you create the session, with the list of versions you can choose. -
tuist_xcode_versionin the session's metadata, when you create the session with the Claude API:"metadata": { "tuist_platform": "macos", "tuist_xcode_version": "26.1.1" }json"metadata": { "tuist_platform": "macos", "tuist_xcode_version": "26.1.1" } -
The environment's
xcode_version, when the session runs on the environment's platform. -
The default Xcode.
An Xcode without a platform asks for macOS. Some things to know:
- The session keeps its Xcode. Its sandbox boots once, and a later message or changed metadata doesn't move it. Use a new session for another Xcode.
- Tuist checks metadata when the first turn arrives. If
tuist_xcode_versionnames an Xcode Tuist doesn't offer, Tuist stops that turn without starting a sandbox and logs the versions you can choose. Use Tuist's agent-sessions API to get the error when you create the session. - On a macOS environment, Tuist waits rather than guesses. If Tuist can't read a new session's metadata, it holds the turn and tries again instead of booting the environment's Xcode.
Anyone who can create sessions in the Claude workspace that owns the environment can run sessions on your Tuist account, and can ask for macOS, and its Xcode, with session metadata. Limit access to that workspace accordingly.
Connect without an API key#
The dashboard sets this up for you. Through the API, Tuist works the same way: every account has its own OpenID Connect issuer at Tuist, https://tuist.dev/oidc/accounts/<account id>, and signs a short-lived token for each call to Anthropic, which it exchanges for an Anthropic access token that lasts a few minutes. A federation rule that trusts your issuer never accepts tokens Tuist signs for other accounts.
- Every agent environment response includes
federation_issuer_urlandfederation_subject(account:123:agent-environment:456). In the Console's Custom OIDC wizard, use the issuer URL and either that exact subject, to admit only this environment, oraccount:123:*to admit every environment of the account. The dashboard's setup checks use the subjectaccount:123:setup, which only the prefix admits. Use the scopeworkspace:developer. - Send the organization, workspace, service account and rule IDs as
anthropic_organization_id,anthropic_workspace_id,anthropic_service_account_idandanthropic_federation_rule_id, on create or withPATCH /agent-environments/{id}. When an environment has both the IDs and an API key, Tuist uses federation.
Anthropic fetches the issuer's keys over HTTPS on port 443 from a public hostname. If your self-hosted Tuist server is not reachable from the internet, choose the inline JWKS source in the Console and paste the key set your server serves at <issuer>/jwks.json. Paste it again whenever Tuist's signing key changes, which happens when the server's TUIST_SECRET_KEY_TOKENS (or, when it is unset, TUIST_SECRET_KEY_BASE) changes.
Claude Code#
Claude Code cloud sessions are the ones developers start from claude.ai/code, the Claude desktop and mobile apps, and claude --cloud. They pick where a session runs by its environment, so you connect one environment for each platform you want to offer.
Connect environments#
-
A Claude organization Owner turns on Allow self-hosted environments on the Cloud environments admin page. This needs a Team or Enterprise plan; see Anthropic's self-hosted environments guide.
-
On the same page, create a self-hosted environment for each platform, with the name developers will see, for example Tuist Linux and Tuist macOS. Copy each environment's
ccpool_…ID and its environment key, which is shown only once. -
Connect each environment to your Tuist account with
kindset toclaude_codeand its platform:curl -X POST "https://tuist.dev/api/accounts/my-org/sandboxes/agent-environments" \ -H "Authorization: Bearer $TUIST_TOKEN" -H "Content-Type: application/json" \ -d '{ "kind": "claude_code", "platform": "darwin", "name": "Tuist macOS", "anthropic_environment_id": "ccpool_...", "environment_key": "<environment key>" }'bashcurl -X POST "https://tuist.dev/api/accounts/my-org/sandboxes/agent-environments" \-H "Authorization: Bearer $TUIST_TOKEN" -H "Content-Type: application/json" \-d '{"kind": "claude_code","platform": "darwin","name": "Tuist macOS","anthropic_environment_id": "ccpool_...","environment_key": "<environment key>"}'Repeat with
"platform": "linux"and the other environment's ID and key.
Within a minute, the environments are ready to take sessions. An idle session keeps its sandbox running for 30 minutes, then pauses it; the session's next message resumes the same sandbox. Change the wait with max_idle_seconds (up to 3600).
Choose Linux or macOS#
Developers pick the environment, and with it the platform, when they start a cloud session:
-
claude.ai, desktop and mobile apps: choose Tuist Linux or Tuist macOS in the environment picker of a new session.
-
Claude Code CLI: run
/remote-envinclaudeand choose the environment by name.claude --cloud "<task>"then runs on it. To pick one for a single session, pass its ID:claude --cloud "<task>" --environment ccpool_.... -
A whole team or repository: set the default environment's ID in Claude Code settings, for example in a repository's
.claude/settings.json:{ "remote": { "defaultEnvironmentId": "ccpool_..." } }json{ "remote": { "defaultEnvironmentId": "ccpool_..." } }
Sessions in these environments use your organization's Claude Code usage as usual, and their sandboxes count toward your Tuist account.
Choose an Xcode#
Each macOS environment boots one Xcode, the default unless you connect it with xcode_version, for example "xcode_version": "26.1.1". To offer more than one, connect an environment for each and name them after it, for example Tuist macOS · Xcode 26.1.1. Developers then pick the Xcode by picking the environment.
To move an environment to another Xcode, update it:
curl -X PATCH "https://tuist.dev/api/accounts/my-org/sandboxes/agent-environments/<id>" \
-H "Authorization: Bearer $TUIST_TOKEN" -H "Content-Type: application/json" \
-d '{ "xcode_version": "27.0" }'
New sessions get the new Xcode, and sessions that already have a sandbox keep theirs. null goes back to the default. The same applies to Managed Agents environments, whose sessions can also choose their own.
Faster session starts and builds#
- Tuist cache: sessions get
TUIST_URLand, when your account has a cache in the same rack,TUIST_CACHE_ENDPOINT. The Tuist CLI and thetuist_exMix tasks in a session sign in on their own with the session's identity token. See Claude Code sessions in the authentication guide. - Cached checkouts: when the Tuist GitHub app of your account can read a session's repository, a new session starts from the same cached checkout your Tuist runners use, so it fetches only the commits it lacks instead of cloning. When the session ends, it gives back the objects of the default branch's latest commit, which keeps the cached checkout current even for repositories that don't run CI on Tuist. Only the commit GitHub reports for the default branch updates it; a session's own branches never do. Disable sandboxes or uninstall the app to stop this.
- macOS: the Mac shares the Claude Code build sessions run with each VM, so a new session doesn't download it.
Use a Mac from any Claude Code session#
Claude Code sessions that run on Linux, such as cloud sessions in an Anthropic-hosted environment, can still build and test Apple-platform code on a Tuist macOS sandbox, as described in Build on a Mac from a coding agent. Unlike a Tuist macOS environment, the session keeps its own environment.
In a Tuist Linux environment there is nothing to set up: the Tuist CLI and the Tuist MCP server are already installed and sign in with the session's identity.
For cloud sessions in an Anthropic-hosted environment:
- Make the Tuist MCP server available to sessions: add
https://tuist.dev/mcpas a connector in claude.ai and enable it for the session, or declare it in the repository's committed.mcp.json. - Install the Tuist CLI in the environment's setup script, for example with
curl -fsSL https://github.com/tuist/tuist/releases/download/<version>/tuist-linux-x86_64.tar.gz | tar -xz -C /usr/local/bin tuist. - Create an account token with the
account:sandboxes:writescope, and add it to the environment's environment variables asTUIST_TOKEN. Everyone who uses the environment can read it, so give it no other scope unless they may also use your cache: the Mac's commands get cache access only as far as the token has it, so addcifor builds on the Mac to read and write your cache. - Let the environment reach Tuist. Anthropic's default Trusted network access doesn't include
tuist.dev, so pick Custom, keep the default domains, and addtuist.devto Allowed domains. The CLI uploads the session's files to the Mac throughtuist.dev, so it needs no other domain.
The Mac has the Tuist CLI, and runs the project's own version when it pins one through mise; Tuist 4.218.0 and later sign in to your account's cache in each command on their own.
Ready Macs#
A Tuist Linux environment can prepare these Macs ahead of time. Set its macOS setup script with the API (macos_setup_script on PATCH /api/accounts/{account}/sandboxes/agent-environments/{id}), such as:
mise install
tuist install
tuist generate --no-open
xcodebuild build -workspace App.xcworkspace -scheme App -destination 'platform=iOS Simulator,name=iPhone 17'
When Claude creates a Mac for a repository connected to one of your Tuist projects, create_sandbox gets the repository, and the Mac boots from that repository's snapshot for its Xcode: the default branch is cloned to ~/work/<name>, the script has run there, and the build products are in place. The first tuist sandbox sync sends only the files that differ from that commit, so Xcode rebuilds only what they change. The first Mac of a repository and Xcode boots bare and has its snapshot built on an idle Mac, for up to an hour, for the Macs after it. Changing the script, the Xcode or the image builds it again. The snapshot keeps the image's simulators and drops the ones the script created, and each of these Macs starts booting the image's newest Pro iPhone (iPhone 18 Pro on Xcode 27.2) as soon as it runs, so it is ready by the time the first build ends; build for that simulator in the script too, so the session's builds for it reuse the snapshot's.
Claude deletes the Mac when the task is done. A Mac left behind pauses when idle and is deleted after 14 days paused. Macs created this way count toward your Tuist account like any other sandbox.