Claude Code remote sessions
A Claude Code session that runs in the cloud (started from claude.ai/code, the Claude app, or a scheduled task) can work as a StratoNext External agent. The session’s environment carries the agent’s credential and installs the StratoNext plugin, so every session started there signs in as that agent and reaches your cloud accounts through the StratoNext credential broker. Nobody copies a cloud key into the session.
This is the Your own agent mode, with Claude Code’s cloud environment as the place the process runs.
Why it is safe
Section titled “Why it is safe”- No long-lived cloud keys. The environment holds only the StratoNext agent credential. Cloud credentials are issued per request by the credential broker, short-lived and scoped to one environment, and the plugin tells Claude to use them inside the command that needs them, so they never land in the conversation or on disk.
- Scoped to one workspace. An External agent belongs to a single workspace, so a session can only reach the environments that workspace connects. Give each workspace its own agent and its own Claude Code environment, and sessions in one can never touch another’s accounts.
- Your policies still apply. The broker hands out the environment’s Operations Role, read-only by default. Anything more goes through an escalation request and your approval policy, and only humans can approve.
- Everything is audited. Each credential issued and each task worked is recorded against the agent’s identity, so the audit trail shows exactly which session did what.
- Revocable at any time. Rotate the agent’s secret, or disable or delete the agent, and every session using it loses access on its next request. The agent’s credential is also listed under Settings → Machine credentials, alongside every other credential that can act in the workspace.
1. Register an External agent
Section titled “1. Register an External agent”Register one agent per workspace you want remote sessions to work in, either with New Agent on the Agents page or from the terminal while signed in as yourself:
stratonext agent create --name "claude-remote" --kind EXTERNAL --secret-expires-in-days 90Copy the client id and secret. The secret is shown once.
2. Create the Claude Code environment
Section titled “2. Create the Claude Code environment”In Claude Code’s cloud environment settings, create an environment for this workspace and set:
-
Environment variables: the agent’s credential.
STRATONEXT_AUTH_API_CLIENT_ID=agtc_...STRATONEXT_AUTH_API_CLIENT_SECRET=... -
Network access: allow PyPI, GitHub (to fetch the plugin marketplace) and the StratoNext API. Allow
awscli.amazonaws.comtoo if you want AWS CLI v2; the script below falls back to the PyPI build otherwise. -
Setup script: the script below. It runs when a session starts, before Claude does anything.
#!/bin/bashset -e
pip_install() { pip install --upgrade --quiet "$@" 2>/dev/null \ || pip install --upgrade --quiet --break-system-packages "$@"}
# uv (the plugin runs the StratoNext MCP server with uvx), the StratoNext CLI and boto3pip_install uv stratonext boto3
# AWS CLI v2, falling back to the PyPI build if the download is blockedif ! command -v aws >/dev/null 2>&1; then ARCH=$(uname -m) # x86_64 or aarch64 TMP=$(mktemp -d) if curl -fsSL "https://awscli.amazonaws.com/awscli-exe-linux-${ARCH}.zip" -o "$TMP/awscliv2.zip" \ && command -v unzip >/dev/null 2>&1; then unzip -q "$TMP/awscliv2.zip" -d "$TMP" "$TMP/aws/install" --update 2>/dev/null || sudo "$TMP/aws/install" --update else pip_install awscli fi rm -rf "$TMP"fi
# StratoNext plugin: skill, MCP server and the session-start identity hookclaude plugin marketplace add stratonext/claude-plugins 2>/dev/null || trueclaude plugin install stratonext@stratonext3. Start a session and verify
Section titled “3. Start a session and verify”Start a session in the new environment. The plugin’s session-start hook reports the identity it found; it should say the session is the agent. To confirm, ask Claude to run:
stratonext whoami # authMode: agentHow a session works
Section titled “How a session works”When a session starts, the plugin checks for the agent credential and tells Claude that it is that agent. Claude then does the work itself rather than dispatching it to another agent:
-
Tracks the work on a task assigned to the agent: it creates one, or claims a task already dispatched to it, and reports progress as it goes.
-
Draws cloud credentials per command from the broker, so they exist only for the command that uses them:
Terminal window eval "$(uvx stratonext@latest credential issue --environment-id <env_id> --format env)" && aws ...The AWS CLI and boto3 both pick up the issued credentials, and they expire on their own.
-
Stops at a permission wall. It files an escalation request with the narrowest actions and resources it needs. If the request is pending, it tells you a human must decide in StratoNext and waits; it never retries or works around the gate.
-
Completes the task with a result, or fails it with a reason.
You can give a session work in plain language (“investigate the latest Lambda errors in the production environment”) or point it at a task already dispatched to the agent.