Building headless automation with Claude Code

Introduction and Agenda 00:05

  • Presenter introduces themselves as an engineer on the cloud code team and outlines the agenda: SDK quick start, live GitHub action demo, advanced SDK features, and setting up the GitHub action.
  • Asks audience about their familiarity with cloud code and claude.
  • Encourages installing cloud code locally to follow along.

Overview of Cloud Code SDK 01:43

  • Cloud code SDK enables programmatic access to the cloud code agent in headless mode, acting as a foundational building block for new application types.
  • The SDK can be used like a Unix tool, integrated with bash or terminal workflows, and used in pipelines.
  • Supports use cases like code review, automated linter creation, and building custom chatbots or remote code writing systems.
  • Upcoming support for Python and TypeScript bindings.

Basic SDK Usage Examples 03:07

  • Calling claude via claude-b <prompt> executes tasks (e.g., generating a Fibonacci sequence generator).
  • Using the d-allow tools write flag grants permission for writing files.
  • Examples shown: piping log files to Claude for summarization and interpreting outputs like ifconfig.
  • Output can be requested in JSON format for programmatic parsing and building downstream integrations.

Demo: GitHub Action Built on the SDK 04:43

  • Live demonstration using a small open source quiz app repository.
  • Claude can be prompted via GitHub issues to implement new features (e.g., '50/50' powerup and 'skip question' options), even with sparse specifications.
  • Additional issue (per-question timer) is also submitted for Claude to build.
  • Claude's workflow: responds to the issue, creates a job run with logs, generates a to-do list, and works through the implementation.

Pull Request Interactions 08:48

  • Claude can be asked to review or modify pull requests (e.g., changing background color from blue to green).
  • Claude adds new commits to already open pull requests, fully automating simple code changes on request.

Deep Dive: SDK Features 09:33

  • By default, cloud-ba has no edit or destructive permissions; permissions must be explicitly granted via the d-allowed tools flag.
  • Permissions example: granting bash access to npm run build, npm test, and file writing.
  • Structured output available in "stream JSON" (chunked updates) or "JSON" (final output only) modes for easier downstream processing.
  • System prompts can be customized (e.g., making Claude respond "like a pirate").
  • Session IDs enable interactive, stateful experiences where the context is preserved across exchanges.
  • Recent addition: d-permission prompt tool enables real-time, user-driven permission management via an MCP server, removing need to pre-declare tools.

Demo Results and Teaching Points 13:14

  • Claude works through the power-up feature request, creates new code and a pull request.
  • Demonstrated testing of the new feature directly in the app, with live changes reflected (e.g., new 50/50 and skip question buttons).
  • Claude successfully executes additional code changes as requested (color changes), updating all relevant files.

Recap and Capabilities of GitHub Action 16:58

  • Claude GitHub action can read code, create PRs from issues, add commits to existing PRs, answer technical questions, and review code—all via GitHub comments.
  • No infrastructure burden: action runs on GitHub-hosted runners, leveraging existing CI infrastructure.

Technical Architecture of Actions 17:55

  • GitHub actions are built on top of the SDK.
  • Two main open source actions: base action (talks directly to Claude), and PR action (handles advanced PR/comment features like to-dos and rendering).
  • The codebase is open source for reviewing and building further customizations.

How to Install and Set Up the GitHub Action 18:55

  • To install, open Cloud Code in the target repo and run /install github action from the terminal.
  • Guided flow walks the user through setup, resulting in a PR for the YAML workflow file.
  • Bedrock and Vertex users follow slightly different manual installation steps, detailed in the docs.

Resources and Feedback 20:07

  • Links to the open source repos for the base and PR actions are provided.
  • Users are encouraged to give feedback via the public GitHub repo by filing issues.
  • Presentation concludes with thanks and an invitation to engage further.