Skip to main content

Coding agent that lives in your project management tool

Project description

Polycode ๐Ÿš€

Multi-agent software development automation using CrewAI with GitHub App integration for webhook-driven workflows.

Overview

Polycode automates software development tasks using AI-powered multi-agent workflows built with CrewAI. It integrates as a GitHub App to provide seamless automation across multiple repositories.

Key Features:

  • Multi-agent workflows with CrewAI framework
  • GitHub App integration for multi-repo automation
  • Webhook-driven automation triggered by labels
  • Push to external repos via GitHub App tokens
  • Label-to-flow mapping (e.g., ralph โ†’ ralph_flow)

Available Workflows

  • Ralph Flow (ralph): Fast iterative implementation with automated verification
  • Feature Development Flow (feature-dev): Comprehensive feature implementation with planning, testing, and review

Ralph Flow

The Ralph Flow is an iterative development workflow that implements changes with built-in verification loops. It's designed for fast, reliable code changes with automatic quality checks.

How It Works

  1. Setup - Initialize worktree and pick up the issue
  2. Plan - Decompose the task into ordered user stories
  3. Ralph Loop - Iterative implementation with verification:
    • Implement the current story
    • Run tests to verify changes
    • If tests fail, retry with error context (max 3 iterations)
    • If tests pass, commit the story and move to next
  4. Verify Build - Final build and test verification
  5. Push & PR - Push changes and create pull request

Ralph Loop Control Flow

The loop uses a router-based mechanism with status outputs:

  • retry โ†’ Continue loop with error context included
  • story_done โ†’ Commit current story, proceed to next
  • done โ†’ All stories complete, run final verification

Key safety features:

  • Per-Story Commits: Each story is committed immediately upon completion
  • Safety Brake: Maximum 3 iterations per story prevents runaway processes
  • Error Context: Agent receives previous errors for smarter retries

Tools Available to Ralph Agents

  • FileReadTool - Read file contents
  • FileWriterTool - Write/modify files
  • DirectoryReadTool - Explore directory structure
  • ExecTool - Execute shell commands (build, test, lint)
  • AgentsMDLoaderTool - Load AGENTS.md context files

Feature Development Flow

A comprehensive workflow for larger feature implementations:

  1. Plan - Decompose task into ordered user stories
  2. Implement - Implement each story with tests
  3. Push - Push changes to repository
  4. Create PR - Create pull request
  5. Review - Code review with feedback

Project Structure

polycode/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ ralph/               # Ralph Loop workflow
โ”‚   โ”‚   โ”œโ”€โ”€ crews/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ plan_crew/   # Planning crew
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ralph_crew/  # Implementation crew
โ”‚   โ”‚   โ””โ”€โ”€ __init__.py      # Ralph flow definition
โ”‚   โ”œโ”€โ”€ feature_dev/         # Feature development workflow
โ”‚   โ”‚   โ””โ”€โ”€ crews/
โ”‚   โ”‚       โ”œโ”€โ”€ plan_crew/
โ”‚   โ”‚       โ”œโ”€โ”€ implement_crew/
โ”‚   โ”‚       โ”œโ”€โ”€ verify_crew/
โ”‚   โ”‚       โ”œโ”€โ”€ test_crew/
โ”‚   โ”‚       โ””โ”€โ”€ review_crew/
โ”‚   โ”œโ”€โ”€ github_app/          # GitHub App integration
โ”‚   โ”œโ”€โ”€ project_manager/     # Project management utilities
โ”‚   โ”œโ”€โ”€ celery_tasks/        # Async task processing
โ”‚   โ”œโ”€โ”€ persistence/         # Database layer
โ”‚   โ”œโ”€โ”€ tools/               # Custom CrewAI tools
โ”‚   โ””โ”€โ”€ flowbase.py          # Base flow classes
โ”œโ”€โ”€ tests/                   # Test files
โ””โ”€โ”€ pyproject.toml           # Project configuration

Installation

Prerequisites

  • Python 3.13 or higher
  • uv package manager

Setup

# Install dependencies
uv sync

# Configure environment
cp .env.example .env
# Edit .env with your credentials

Required environment variables:

  • GITHUB_TOKEN - GitHub personal access token
  • DATABASE_URL - PostgreSQL connection string
  • REDIS_HOST / REDIS_PORT - Redis configuration
  • OPENAI_API_KEY - OpenAI API key

Usage

Running Flows

# Run Ralph flow example
uv run ralph

# Run feature development example
uv run example

GitHub App Integration

Polycode includes GitHub App support for webhook-driven automation:

  1. Create GitHub App at https://github.com/settings/apps/new
  2. Configure permissions: Issues, Projects, Contents, Pull requests (Read & Write)
  3. Set webhook URL and secret
  4. Generate private key and add to .env
  5. Install app on target repositories
  6. Create label mappings to trigger flows

Label-to-Flow Mapping

# Map "ralph" label to ralph flow
curl -X POST http://localhost:8000/mappings \
  -H "Content-Type: application/json" \
  -d '{
    "installation_id": 12345,
    "label_name": "ralph",
    "flow_name": "ralph_flow"
  }'

Development

Commands

uv sync                   # Install dependencies
uv run ruff check .       # Lint
uv run ruff format .      # Format
uv run pytest             # Run tests
uv run pyright            # Type check

Code Style

  • Line length: 79 characters
  • Use modern Python 3.10+ type annotations
  • See src/AGENTS.md for complete guidelines

Resources

License

MIT LICENSE

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

polycoding-0.1.0.tar.gz (376.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

polycoding-0.1.0-py3-none-any.whl (56.6 kB view details)

Uploaded Python 3

File details

Details for the file polycoding-0.1.0.tar.gz.

File metadata

  • Download URL: polycoding-0.1.0.tar.gz
  • Upload date:
  • Size: 376.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.4

File hashes

Hashes for polycoding-0.1.0.tar.gz
Algorithm Hash digest
SHA256 36d49a63b9789695c3da01ed2b0f0b6b9ec98f3756e5a431a22b08f097574666
MD5 93c04d98d227e47c98dd2078d9f67595
BLAKE2b-256 1f5b2885ae5e7a4190edeebfa550266979b2f094852fcaa53e45ae6a930872c8

See more details on using hashes here.

File details

Details for the file polycoding-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: polycoding-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 56.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.4

File hashes

Hashes for polycoding-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 afd454f7149c551e3ff6c650d3df3ff2776c9a4d9d42975f0bd65da7bac40e1b
MD5 5ef330848d05042f8da830abb8db06a3
BLAKE2b-256 87021e1560dc4c8312d9c379de5359ac99d5c1aa7cb07470e4e36d5d59eb4be1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page