๐Ÿ“ฆ anthropics / riv2025-long-horizon-coding-agent-demo

โ˜… 47 stars โ‘‚ 25 forks ๐Ÿ‘ 47 watching โš–๏ธ Apache License 2.0
๐Ÿ“ฅ Clone https://github.com/anthropics/riv2025-long-horizon-coding-agent-demo.git
HTTPS git clone https://github.com/anthropics/riv2025-long-horizon-coding-agent-demo.git
SSH git clone git@github.com:anthropics/riv2025-long-horizon-coding-agent-demo.git
CLI gh repo clone anthropics/riv2025-long-horizon-coding-agent-demo
Alex Notov Alex Notov Merge pull request #47 from anthropics/fix/readme-license-apache 57aef80 2 months ago ๐Ÿ“ History
๐Ÿ“‚ main View all commits โ†’
๐Ÿ“ .github
๐Ÿ“ e2e-tests
๐Ÿ“ infrastructure
๐Ÿ“ prompts
๐Ÿ“ src
๐Ÿ“„ .dockerignore
๐Ÿ“„ .env.example
๐Ÿ“„ .gitignore
๐Ÿ“„ claude_code.py
๐Ÿ“„ docker-compose.yml
๐Ÿ“„ Dockerfile
๐Ÿ“„ LICENSE
๐Ÿ“„ Makefile
๐Ÿ“„ package-lock.json
๐Ÿ“„ package.json
๐Ÿ“„ README.md
๐Ÿ“„ requirements.txt
๐Ÿ“„ README.md

๐Ÿค– Long-Horizon Coding Agent Demo

An autonomous agent system that builds React applications from GitHub issues using AWS Bedrock AgentCore and the Claude Agent SDK. Demonstrated at AWS re:Invent 2025.

How It Works

End-to-End Flow

  • User creates GitHub issue with a feature request
  • Users vote with ๐Ÿ‘ reactions to prioritize what gets built
  • Authorized user approves by adding a ๐Ÿš€ reaction
  • Issue poller (runs every 5 min) detects approved issues, sorted by votes
  • Agent builder workflow acquires lock and invokes AWS Bedrock AgentCore
  • Bedrock entrypoint clones the repo and starts the Claude agent
  • Agent builds the feature following the build plan, taking screenshots, running tests
  • Progress is tracked via commits pushed to the agent-runtime branch
  • Screenshots and updates are posted to the GitHub issue
  • On completion, the agent signals done, commits are pushed, and agent-complete label is added
  • If more issues exist, the agent continues in enhancement mode
  • Deploy preview workflow builds and deploys to CloudFront

Key Features

  • Vote-based prioritization - Issues with more ๐Ÿ‘ reactions are built first
  • Health monitoring - CloudWatch heartbeat detects stale sessions and triggers auto-restart
  • Incremental builds - Agent builds new features on top of existing generated code
  • Screenshot capture - Playwright takes screenshots throughout development
  • Live previews - Each issue gets a CloudFront preview URL

Configuration

Prerequisites

  • AWS account with Bedrock AgentCore access
  • GitHub repository with Actions enabled
  • Docker for local development

AWS Configuration

  • Copy .bedrock_agentcore.yaml.template to .bedrock_agentcore.yaml
  • Fill in your AWS values:
ValueDescriptionExample
YOUR_ACCOUNT_IDYour AWS account ID123456789012
YOUR_EXECUTION_ROLEIAM role for AgentCore runtimeAmazonBedrockAgentCoreSDKRuntime-...
YOUR_PROJECT_NAMEECR repository namemy-agent
YOUR_AGENT_RUNTIME_IDAgentCore runtime ID (after first deploy)my_agent-abc123
YOUR_CODEBUILD_ROLEIAM role for CodeBuildAmazonBedrockAgentCoreSDKCodeBuild-...

GitHub Repository Secrets

Configure in Settings โ†’ Secrets and variables โ†’ Actions โ†’ Secrets:

SecretDescription
AWS_ACCESS_KEY_IDIAM user access key for GitHub Actions
AWS_SECRET_ACCESS_KEYIAM user secret key
AWS_AGENTCORE_ROLE_ARNIAM role ARN for invoking AgentCore
AWS_PREVIEW_DEPLOY_ROLE_ARNIAM role ARN for deploying previews

GitHub Repository Variables

Configure in Settings โ†’ Secrets and variables โ†’ Actions โ†’ Variables:

VariableDescription
AUTHORIZED_APPROVERSComma-separated GitHub usernames who can approve builds with ๐Ÿš€
PREVIEWS_BUCKET_NAMES3 bucket for preview deployments
PREVIEWS_CDN_DOMAINCloudFront domain for previews
PREVIEWS_DISTRIBUTION_IDCloudFront distribution ID for cache invalidation

GitHub Repository Labels

The following labels must exist for the workflows to function properly:

LabelColorDescription
agent-building#FBCA04 (yellow)Agent is actively working on this issue
agent-complete#0E8A16 (green)Agent has completed this issue
tests-failed#D93F0B (red)Tests failed during agent build
Create these at Settings โ†’ Labels, or via CLI:
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 from AWS Secrets Manager. Required secrets:

Secret NameDescription
claude-code/{env}/anthropic-api-keyAnthropic API key for Claude
claude-code/{env}/github-tokenDefault GitHub PAT (fallback)
claude-code/{env}/github-token-{org}Org-specific GitHub PAT (optional)
Where {env} is the environment name (default: reinvent) and {org} is the GitHub organization name.

Org-specific tokens allow separation of concerns when working with multiple GitHub organizations. The agent checks for an org-specific token first, then falls back to the default:

# Create org-specific token (recommended for multi-org setups)
aws secretsmanager create-secret \
  --name claude-code/reinvent/github-token-anthropics \
  --secret-string "ghp_your_pat_here" \
  --region us-west-2

# Or update existing default token
aws secretsmanager update-secret \
  --secret-id claude-code/reinvent/github-token \
  --secret-string "ghp_your_pat_here" \
  --region us-west-2

Project Structure

โ”œโ”€โ”€ bedrock_entrypoint.py    # Main orchestrator for AWS Bedrock AgentCore
โ”œโ”€โ”€ claude_code.py           # Agent session manager and local runner
โ”œโ”€โ”€ src/                     # Python modules
โ”‚   โ”œโ”€โ”€ cloudwatch_metrics.py  # Heartbeat and metrics
โ”‚   โ”œโ”€โ”€ github_integration.py  # GitHub API operations
โ”‚   โ””โ”€โ”€ git_operations.py      # Git commit/push logic
โ”œโ”€โ”€ prompts/                 # Build plans and system prompts
โ”‚   โ””โ”€โ”€ canopy/              # Project Management app build plan
โ”œโ”€โ”€ frontend-scaffold-template/  # React + Vite + Tailwind scaffold
โ””โ”€โ”€ .github/workflows/       # GitHub Actions
    โ”œโ”€โ”€ issue-poller.yml     # Polls for approved issues
    โ”œโ”€โ”€ agent-builder.yml    # Invokes AgentCore
    โ””โ”€โ”€ deploy-preview.yml   # Deploys to CloudFront

License

Apache 2.0