How to deploy a Claude Code agent: five places to run it off your laptop
To deploy a Claude Code agent, pick what should start it. A schedule or a script can call claude -p on any server, a GitHub event can start the official GitHub Action, and your own app can call the Agent SDK in a container or Anthropic's hosted Claude Managed Agents. If you want strangers to run it and pay per task, you can publish it on Starwish, where it runs in a fresh sandbox for each job.
This page compares those five routes, then walks through the Starwish one command by command. Anthropic's and the hosts' pages were read on 25 November 2026; the Starwish commands were checked against the CLI's own help (version 0.1.39) and its built-in guides on the same day.
Which deployment route fits your Claude Code agent?
The deciding question is who or what triggers a run. Cost and setup follow from that.
| Route | What starts a run | Who runs the machine | You pay for |
|---|---|---|---|
claude -p on a server or cron host | A script, cron or queue you own | You | The server, plus model usage |
| Claude Code GitHub Actions | An @claude mention, any GitHub event, or a cron schedule | GitHub's runners | Actions minutes, plus model usage |
| Agent SDK in a container (Docker, Modal, Kubernetes, Cloudflare Sandbox) | Requests to your own app | You, or a sandbox provider | The container, plus tokens |
| Claude Managed Agents | Your app, through Anthropic's API; also cron schedules | Anthropic, or your own sandbox | $0.08 per running session hour, plus tokens |
| Starwish | Another person's Claude Code or Codex hiring it | Starwish | Your model key's usage only; the machines are free |
The first four are how to deploy Claude Code agents for yourself or inside your own product, and you host the agentic workflow on infrastructure you pick. The last one is for when the agent is the product.
Is a "Claude Code agent" the same thing as a subagent?
No. In Brave Search results for this phrase on 25 November 2026, four of the links were Reddit threads about subagents, which are something else. A subagent is a Markdown file in .claude/agents/ (or ~/.claude/agents/) that Claude Code hands a side task to. Anthropic's subagent docs say subagents "work within a single session", so there is nothing to deploy on its own: it runs wherever the session runs.
What people usually want to deploy is a whole Claude Code run: a prompt, some instructions (a CLAUDE.md, skills, subagents), and the tools to do one job without someone at the keyboard. Every route below deploys that. If you only want other people to install your skill files and run them in their own Claude Code, that is a different job, covered in how to publish a Claude Code skill.
How do you run Claude Code on a server or schedule?
Claude Code has a non-interactive mode. Anthropic's headless guide gives this as the basic form:
$ claude -p "Find and fix the bug in auth.py" --allowedTools "Read,Edit,Bash"
Put that line in a cron job or a queue worker and you have a deployed agent. Two details from the same guide matter on a server:
- Add
--barefor scripted runs. It skips auto discovery of hooks, skills, plugins, MCP servers andCLAUDE.md, and Anthropic says it will become the default for-p. - Without
--bare, a-prun in a cloned repo runs that repo's hooks and connects its.mcp.jsonservers with no trust prompt. Only point it at repositories you trust.
Any always-on host works. Render, for example, offers background workers that run continuously and poll a queue, and cron jobs that rebuild from your Git branch on each push. Its cron jobs cannot use a persistent disk, so anything the agent should remember between runs has to go to a database or object store.
This route is the cheapest to set up. It also leaves you with every operations job: keys on the box, isolation between runs, logs and restarts.
How do you deploy Claude Code with GitHub Actions?
If the agent's work lives in a repository (triage issues, fix bugs, review pull requests, a nightly report), Claude Code GitHub Actions is the shortest path:
- Run
claudein the repository. - At the prompt, run
/install-github-app. It opens the Claude GitHub App install page, sets up the key as a repository secret and writes the workflow file. - Mention
@claudein an issue or pull request, or give the action apromptand a trigger such asschedule.
The workflow step is anthropics/claude-code-action@v1, and a skill in .claude/skills/ can run as the prompt once the job checks out the repo. Two limits from Anthropic's page: /install-github-app only works for github.com repositories, and GitHub runs scheduled workflows only from the default branch, turning the schedule off in a public repository after 60 days with no activity.
How do you host Claude Code agents in a container with the Agent SDK?
When your own product needs to start agent runs, the Agent SDK is the documented route. Anthropic's hosting guide explains the shape: each query() call starts a claude CLI subprocess that owns a shell, a working directory and session files on local disk. That state is lost when the container restarts unless you add a SessionStore.
The guide describes four session patterns (ephemeral, long running, hybrid, and several agents in one container) and points to a hosting cookbook with the same image deployed on local Docker, Modal and Kubernetes. What each host is good at:
- Modal bills per second and sells Sandboxes built for coding agents, which suits bursty one task containers.
- Cloudflare has a Run Claude Code in a sandbox guide: a Worker clones a GitHub repo into a Linux sandbox, runs a pinned Claude Code version on a prompt, and returns the changes as a diff, with model calls going through AI Gateway.
- Kubernetes or any container platform you already run gives you full control of networking, storage and tenants.
Anthropic's own cost note: token spend "typically dominates container infrastructure cost by an order of magnitude or more", with a small container at roughly $0.05 an hour. Isolation between customers is yours to build; the guide lists the settings to switch off so one tenant's CLAUDE.md and memory do not leak into another's session.
When are Claude Managed Agents the better choice?
If you do not want to run the agent loop at all, Claude Managed Agents runs it for you. You create an agent (model, system prompt, tools, MCP servers, skills), an environment, then sessions, and stream events back. Sessions can run in Anthropic's cloud sandbox or a self hosted sandbox, and scheduled deployments run an agent on a cron schedule.
Facts to weigh, all from Anthropic's pages:
- It is in beta and every request needs the
managed-agents-2026-04-01header. - Pricing is tokens at normal model rates plus $0.08 per session hour, counted only while the session is running.
- It is available on the Claude API, Claude Platform on AWS and Claude Models on Google Cloud (Anthropic managed), all in beta. That is the cleanest option if your company already buys through AWS.
- Sessions keep their history on Anthropic's side, so it is not eligible for Zero Data Retention or HIPAA, except the self hosted version.
For an agent inside your own product, this saves the most operations work of any route here. It does not give you customers or billing for them.
How do you deploy a Claude Code agent on Starwish?
Starwish is an AI agent marketplace where creators deploy agents on free GPUs and containers at one fixed price, and people hire them from Claude Code or Codex, paying per task only when the result passes a check. The deploy is a CLI flow your own Claude Code can run for you. These are the steps from Starwish's publish your first agent guide:
Install the CLI and sign in once in the browser:
Terminal$ curl -fsSL https://starwish.ing/install.sh | sh $ starwish login --scope hire,publish,credentials --json
Set a public handle. Every agent lives at
starwish.ing/@handle/name:Terminal$ starwish profile set --handle <handle> --name "<your name>" --jsonStart a folder with the Claude Code preset. The other presets are
codex,pi,gemini-cli,opencodeandcopilot-cli:Terminal$ starwish init ./my-agent --harness claude-code --jsonWrite
prompt.md(the instructions, where your existingCLAUDE.mdor skill text goes) andagent.yaml(name, version, inputs, outputs, tests). Leavepriceandmax_response_timeasTODO.Check the folder locally until it reports no errors:
Terminal$ starwish doctor ./my-agent --jsonPipe your Anthropic key in so it never prints:
Terminal$ printenv ANTHROPIC_API_KEY | starwish credentials set ANTHROPIC_API_KEY --agent ./my-agent --stdinRun it on two or three real requests in the same sandbox customers get:
Terminal$ starwish dev ./my-agent "a realistic request" --file sample.pdf --jsonRead what those runs used (models, tokens, run times) and pick a price and time limit:
Terminal$ starwish price ./my-agent --jsonPublish. Starwish runs the tests from
agent.yamland lists the version only if they pass:Terminal$ starwish publish ./my-agent --json
You can skip typing all of that. The prompt Starwish's FAQ gives creators is Set up starwish.ing/agent.md and list my agent; paste it into Claude Code and it runs the same steps, stopping for you only at the sign in, the key and the price.
What changes when Claude Code runs as a Starwish job?
Each job gets two fresh machines (Two machines). Claude Code and your key sit on the harness machine. Every command the model runs happens on a separate workspace machine that holds no credential, where the customer's files are in /job/input/ and results go to /job/output/. The preset switches off Claude Code's built in tools and gives it Starwish's tool server instead (run_command, read_file, write_file, edit_file, fetch, browser, progress). A job has no back and forth, so anything that waits for a person must be turned off.
Heavy installs (ffmpeg, Blender, model weights) go in workspace.install, and adding gpu under workspace gives each job a GPU. Starwish pays for the machines and the GPU, and your own dev, test and publish runs are free within daily limits (Runs).
What do agents on Starwish charge, and how long do they get?
These are all 18 agents in Starwish's agent sitemap on 25 November 2026, each read with starwish show <agent> that day. The time limit is each agent's max_response_time: the job is refunded if it runs past it. 1000 stars = $1.
| Agent | Price per task | Time limit |
|---|---|---|
| Business Inbox Desk | 60 stars ($0.06) | 1 min |
| Photo Inquiry Desk | 100 stars ($0.10) | 1 min |
| GAME Singing Voice to MIDI | 100 stars ($0.10) | 15 min |
| Splat Painter | 100 stars ($0.10) | 10 min |
| Code-Animated Video Maker | 150 stars ($0.15) | 10 min |
| Talking-Head Captions | 200 stars ($0.20) | 15 min |
| Rust Port with Proof | 200 stars ($0.20) | 1 h 10 min |
| UGC Brief Scope Checker | 300 stars ($0.30) | 3 min |
| Podcast Clipper | 450 stars ($0.45) | 2 h |
| EchoCut Talking-Head Shorts | 500 stars ($0.50) | 30 min |
| LUT Creator | 500 stars ($0.50) | 3 min |
| The Art Direction Desk | 800 stars ($0.80) | 2 min |
| RAW Darkroom | 800 stars ($0.80) | 5 min |
| Gameplay Clipper | 1,000 stars ($1.00) | 1 h 30 min |
| Repo to Live Site | 3,000 stars ($3.00) | 10 min |
| Site to Video | 3,200 stars ($3.20) | 18 min |
| Claudemy: Audio Course on Any Topic | 10,000 stars ($10.00) | 55 min |
| Claudemy Large | 15,000 stars ($15.00) | 1 h 20 min |
What the 18 show:
- Half the agents charge 450 stars ($0.45) or less, and the cheapest is 60 stars. Half allow 10 minutes or less, and four allow more than an hour.
- Price does not track run time. Rust Port with Proof asks 200 stars for up to 70 minutes; Repo to Live Site asks 3,000 stars for up to 10.
- Only Code-Animated Video Maker had public ratings that day (4.1/5 over 2 jobs). The other 17 showed "New".
The public listing does not say which harness each agent uses, so this is not a sample of Claude Code agents only.
How much does a Starwish deployment cost the creator?
From Starwish's Money page and the CLI pricing guide:
- Publishing costs nothing, and neither do the machines or GPU behind each job.
- Your model provider bills your key for every run, yours and customers', including runs that fail the check. The price has to cover those.
- When a job passes Starwish's check, Starwish keeps 10% (rounded down) and the rest lands in your balance.
- If a job fails the check, times out or crashes, the customer gets their stars back and you earn nothing for it.
- The minimum price is 10 stars, and cash out starts at $10.
Compare that with Managed Agents: there you pay $0.08 per running session hour plus tokens, and finding and billing your own users is up to you. On Starwish the machines are free and customers pay through Starwish, but you only get paid for results that pass.
How do people use a deployed agent from Claude Code?
The buyer never installs your agent. They tell Claude Code or Codex:
Set up https://starwish.ing/SKILL.md and hire a Starwish agent for this task: <their task>
Their AI installs the CLI, searches Starwish, names an agent with its price and time limit, and hires it only after they say yes. The result comes back as files. The hire page and the FAQ cover the buyer's side.
What are the limits of deploying on Starwish?
- One job is one request with no conversation. Long running bots, chat agents and anything that waits for input are a better fit for a server, the Agent SDK or Managed Agents.
- Only Starwish's tool server reaches the customer's files. Claude Code hooks, plugins and other features that rely on the built in tools are not expected to carry over. Not tested.
- You see whether each customer job passed and what kind of problem a failed one had. You never see the request, files or results, which also means you cannot debug a customer's job by reading its input.
- Changing the price means publishing a new version, and each version is tested again before it goes live.
- The Starwish CLI has no schedule command: a job starts only when someone hires the agent. An agent that should run every morning on your own data belongs on GitHub Actions, a cron host or Managed Agents.
FAQ
Can I deploy Claude Code with my Claude subscription instead of an API key?
On Starwish, no: the claude-code preset runs on an ANTHROPIC_API_KEY. The GitHub Action accepts a CLAUDE_CODE_OAUTH_TOKEN secret in place of the API key, per Anthropic's GitHub Actions page.
Can I run a Claude Code agent 24/7?
Yes, on a host that keeps a process alive: a Render background worker, a long running Agent SDK container, or Managed Agents sessions. Starwish runs one job per hire and stops at the time limit, so it does not keep an agent running between jobs.
Do I need Docker to deploy a Claude Code agent?
For the Agent SDK route, in practice yes: Anthropic's cookbook ships a Dockerfile for every tier. GitHub Actions, Managed Agents and Starwish build the environment for you; on Starwish you list installs in agent.yaml instead.