RepoAnthropicAnthropicpublished Nov 23, 2025seen 6d

anthropics/riv2025-long-horizon-coding-agent-demo

Python

Open original ↗

Captured source

source ↗

anthropics/riv2025-long-horizon-coding-agent-demo

Language: Python

License: Apache-2.0

Stars: 66

Forks: 34

Open issues: 26

Created: 2025-11-23T15:54:49Z

Pushed: 2026-05-07T17:58:36Z

Default branch: main

Fork: no

Archived: yes

README:

Long-Horizon Coding Agent Demo

> [!IMPORTANT] > This repository is archived. It was built for the AWS re:Invent 2025 demo and is no longer maintained. The code is provided as-is for reference. No further updates, bug fixes, or security patches will be made, and issues and pull requests will not be reviewed. > > If you adapt this code, treat it as a starting point — not a production-ready template. In particular, review the IAM policies, the agent's command allowlist, and the test-verification gates against your own threat model before deploying to any account that holds real workloads or data.

An autonomous agent system that builds full-stack applications from GitHub issues using AWS Bedrock AgentCore and the Claude Agent SDK.

Quick Start

Prerequisites

  • AWS account with Bedrock AgentCore access
  • GitHub repository with Actions enabled
  • Docker installed locally
  • AWS CLI and CDK configured
  • agentcore CLI installed (pip install bedrock-agentcore) — Note: the agentcore launch/push/build subcommands are broken; use make targets instead (see below)

Deployment Steps

# 0. Copy and fill in your local config
cp Makefile.local.example Makefile.local
# Edit Makefile.local: set AWS_PROFILE, AWS_REGION, VPC_ID, GITHUB_REPO

# 1. Deploy CDK infrastructure (ECR, S3 buckets, CloudFront, IAM roles)
make deploy-infra

# 2. Build and push the Docker image (ECR URI from: make show-config)
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin
docker build --platform linux/arm64 -t :latest .
docker push :latest

# 3. Create the AgentCore runtime (first time only)
make create-runtime
# Copy the agentRuntimeId from the output into Makefile.local as AGENT_RUNTIME_ID
# Then update the runtime environment:
make update-runtime-env

GitHub Setup

1. Secrets (Settings > Secrets and variables > Actions > Secrets):

| Secret | Description | |--------|-------------| | AWS_ACCESS_KEY_ID | IAM user access key for GitHub Actions | | AWS_SECRET_ACCESS_KEY | IAM user secret key | | AWS_AGENTCORE_ROLE_ARN | IAM role ARN for invoking AgentCore (output of CDK deploy) | | AWS_PREVIEW_DEPLOY_ROLE_ARN | IAM role ARN for deploying previews (output of CDK deploy) | | AWS_INFRA_DEPLOY_ROLE_ARN | IAM role ARN for deploying agent-written CDK infra (output of CDK deploy) |

2. Variables (Settings > Secrets and variables > Actions > Variables):

| Variable | Description | |----------|-------------| | AUTHORIZED_APPROVERS | Comma-separated GitHub usernames who can approve builds | | AWS_REGION | AWS region where infrastructure is deployed (e.g. us-east-1) | | AGENTCORE_AGENT_ID | AgentCore runtime ID (from make create-runtime output) | | APP_CDK_STACK_NAME | CDK stack name for agent-generated app (e.g. canopy-app-stack) | | PREVIEWS_BUCKET_NAME | S3 bucket for preview deployments (output of CDK deploy) | | PREVIEWS_CDN_DOMAIN | CloudFront domain for previews (output of CDK deploy) | | PREVIEWS_DISTRIBUTION_ID | CloudFront distribution ID for cache invalidation (output of CDK deploy) |

3. Labels (must exist for workflows):

gh api repos/OWNER/REPO/labels -f name="agent-building" -f color="FBCA04" -f description="Agent is actively working on this issue"
gh api repos/OWNER/REPO/labels -f name="agent-complete" -f color="0E8A16" -f description="Agent has completed this issue"
gh api repos/OWNER/REPO/labels -f name="tests-failed" -f color="D93F0B" -f description="Tests failed during agent build"

AWS Secrets Manager

The agent reads secrets at runtime:

| Secret Name | Description | |-------------|-------------| | claude-code/{env}/anthropic-api-key | Anthropic API key (not needed if using Bedrock) | | claude-code/{env}/github-token | Default GitHub PAT (fallback) | | claude-code/{env}/github-token-{org} | Org-specific GitHub PAT (optional) |

Where {env} is the environment name (default: reinvent).

How It Works

1. User creates a GitHub issue with a feature request 2. Users vote with reactions to prioritize what gets built 3. Authorized user approves by adding a reaction 4. Issue poller (runs every 5 min) detects approved issues, sorted by votes 5. Agent builder workflow acquires lock and invokes AWS Bedrock AgentCore 6. Bedrock entrypoint clones the repo and starts the Claude agent 7. Agent builds the feature following the build plan, taking screenshots, running tests 8. Progress is tracked via commits pushed to the agent-runtime branch 9. On completion, the agent-complete label is added 10. Deploy preview workflow builds and deploys to CloudFront

Creating a New Project

> Recommended: Run claude in this repo for an interactive guided setup. Claude will check your prerequisites, help you create a BUILD_PLAN.md, deploy infrastructure, and trigger the agent — all conversationally.

The agent uses PROJECT_NAME to find build plans and configure each project. To build something other than the default Canopy app:

1. Create a build plan directory

prompts/
myapp/
BUILD_PLAN.md # Required: full project specification
EXAMPLE_TEST.txt # Optional: example test for the agent to follow
DEBUGGING_GUIDE.md # Optional: project-specific debugging tips

2. Write BUILD_PLAN.md

This is the most important file. It tells the agent exactly what to build. Include:

  • Project overview — what the app does, who it's for
  • Technology stack — framework, build tools, styling, backend
  • API specification — endpoints, request/response schemas
  • Data models — entities, relationships, database design
  • UI specification — pages, components, layout
  • Test requirements — what tests to write, how to run them

See prompts/canopy/BUILD_PLAN.md for a complete example.

3. Launch with your project name

# Via make
make launch PROJECT_NAME=myapp

# Or override just the variable
make launch-local PROJECT_NAME=myapp

What PROJECT_NAME controls

  • prompts/{PROJECT_NAME}/BUILD_PLAN.md is loaded as the build plan
  • prompts/{PROJECT_NAME}/EXAMPLE_TEST.txt is loaded as test guidance
  • prompts/{PROJECT_NAME}/DEBUGGING_GUIDE.md is loaded for debugging…

Excerpt shown — open the source for the full document.

Notability

notability 4.0/10

Routine demo repo, low traction