Skip to content

Add Claude Code example - #513

Merged
rakyll merged 6 commits into
mainfrom
claudecode
Oct 30, 2026
Merged

rakyll merged 6 commits into
mainfrom
claudecode

Conversation

@rakyll

@rakyll rakyll commented Oct 24, 2026

Copy link
Copy Markdown
Member
  • Push the Claude Code image to gcr.io/ax-images/ax-images and update examples/claude-code.yaml to reference it.
  • Write the agent's output to /workspace/claude-output.md.
  • Add a TODO to inject ANTHROPIC_API_KEY into outbound calls automatically.
  • Add a short Claude Code example pointer to the README and runner docs, including the amd64 build note.

- Push the Claude Code image to gcr.io/ax-images/ax-images and update
  examples/claude-code.yaml to reference it.
- Write the agent's output to /workspace/claude-output.md.
- Add a TODO to inject ANTHROPIC_API_KEY into outbound calls automatically.
- Add a short Claude Code example pointer to the README and runner docs,
  including the amd64 build note.
@rakyll rakyll changed the title Add Claude Code example [DON'T MERGE] Add Claude Code example Oct 27, 2026
Add cmd/runners/claude-code-runner, a runner that runs Claude Code
headlessly. When a Task leaves spec.command empty, the runner builds a
`claude --print` command from spec.config: prompt is the positional
argument and every other key is a claude flag in snake_case, so
max_turns becomes --max-turns. Strings and numbers become --flag=value,
true becomes --flag, lists repeat the flag, and objects are passed as
JSON. claude validates the flags itself, so new Claude Code flags work
without a runner change. A Task that sets spec.command runs it
unchanged.

MCP servers come from the bound Workspace's spec.mcp, including servers
listed under registries, and are passed with --mcp-config. Endpoints
use streamable HTTP and commands use stdio.

Dockerfile.claude-code now installs the runner as
/usr/local/bin/ax-task-runner, and make build-claude-code-image
cross-compiles it first. examples/claude-code.yaml uses spec.config
instead of an sh -c command, and docs/claude-code.md documents the
config.

Move loadSpec from cmd/ax-task-runner into the runner package as
runner.LoadSpec so both runners share it.
Put the Claude Code runner docs and example manifest together in one
directory:

- examples/claude-code.yaml -> examples/claude-code/task.yaml
- docs/claude-code.md       -> examples/claude-code/README.md

Update the README's relative links and every reference to the old
paths in Dockerfile.claude-code, docs/manifests.md and docs/runner.md.
@rakyll rakyll changed the title [DON'T MERGE] Add Claude Code example Add Claude Code example Oct 29, 2026
@rakyll
rakyll requested a review from mayawang October 29, 2026 23:08
@rakyll
rakyll marked this pull request as ready for review October 29, 2026 23:08

@mayawang mayawang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love this, it makes the runner story click. Two small things: the README lists allowedTools as a key the runner rejects, but it's valid camelCase and used in the example above (allowed_tools?). And the Claude Code image builds on the private runner image, so outside folks can't build it. Could it default to the runner make images just pushed, like make deploy does now? Neither blocks. Heads up it'll conflict with #461 on examples/task.yaml, trivial either way.

Point the Makefile's apply-example target, the README and
docs/manifests.md at examples/simple.yaml instead. simple.yaml now
runs `echo $ENVIRONMENT` as its command.
@rakyll

rakyll commented Oct 30, 2026

Copy link
Copy Markdown
Member Author

Fixed the README example. Regarding images, we will provide prebuilt images for officially supported runners and will externalize runner once the APIs are stable. It's something we should follow up with.

@rakyll
rakyll merged commit af5fe46 into main Oct 30, 2026
10 checks passed
@rakyll
rakyll deleted the claudecode branch October 30, 2026 19:32
cloudonly added a commit to cloudonly/ax that referenced this pull request Nov 3, 2026
… step

examples/task.yaml was replaced by simple.yaml in google#513. The WorkerPool step
now links to examples/workerpool.yaml and the installation guide instead of
walking through ko.
mayawang added a commit that referenced this pull request Nov 4, 2026
…es (#505)

* docs: add WorkerPool step to quick start, fix Suspended flow, add multi-workspace example

The quick start jumped from deploying the control plane straight to running
a task, but nothing creates a WorkerPool: the first ax resume fails with
ResourceExhausted (no free workers available) until one is applied. Add a
step that applies examples/workerpool.yaml, with guidance on the
ate.dev/substrate-version nodeSelector label and the ko apply flow from a
Substrate checkout.

New tasks are stored Suspended and only start on ax resume, so the quick
start now resumes task123 after applying it instead of showing Running
straight away, and notes that a slow first resume does not mean failure.

docs/manifests.md links to examples/multi-workspace.yaml, which did not
exist; add it as a Task binding two Workspaces (one git-backed, one built
from inlined files).

* docs: bind a single workspace in the manifests example

#496 moves AX to one workspace per task, so the example linked from
docs/manifests.md now shows a Task bound to a single git-backed
Workspace instead of composing two. The filename is kept so the link
keeps resolving.

* docs: fix single workspace schema in manifest example

* docs: describe the current binding docs in the example header

#496 removed the docs/manifests.md link to this file, so the header
comment no longer needs to claim the filename keeps that link
resolving.

* docs: drop the multi-workspace example

* docs: update the WorkerPool example for Substrate v0.6.0

* docs: use ate.dev/v1 in the WorkerPool example

Substrate v1.0.0-rc.1 serves WorkerPool only as ate.dev/v1.

* docs: point the quick start at simple.yaml and shorten the WorkerPool step

examples/task.yaml was replaced by simple.yaml in #513. The WorkerPool step
now links to examples/workerpool.yaml and the installation guide instead of
walking through ko.

---------

Co-authored-by: cloudonly <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants