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
- Setup - Initialize worktree and pick up the issue
- Plan - Decompose the task into ordered user stories
- 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
- Verify Build - Final build and test verification
- 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 includedstory_doneโ Commit current story, proceed to nextdoneโ 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:
- Plan - Decompose task into ordered user stories
- Implement - Implement each story with tests
- Push - Push changes to repository
- Create PR - Create pull request
- 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
uvpackage 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 tokenDATABASE_URL- PostgreSQL connection stringREDIS_HOST/REDIS_PORT- Redis configurationOPENAI_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:
- Create GitHub App at https://github.com/settings/apps/new
- Configure permissions: Issues, Projects, Contents, Pull requests (Read & Write)
- Set webhook URL and secret
- Generate private key and add to
.env - Install app on target repositories
- 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.mdfor complete guidelines
Resources
License
MIT LICENSE
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36d49a63b9789695c3da01ed2b0f0b6b9ec98f3756e5a431a22b08f097574666
|
|
| MD5 |
93c04d98d227e47c98dd2078d9f67595
|
|
| BLAKE2b-256 |
1f5b2885ae5e7a4190edeebfa550266979b2f094852fcaa53e45ae6a930872c8
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
afd454f7149c551e3ff6c650d3df3ff2776c9a4d9d42975f0bd65da7bac40e1b
|
|
| MD5 |
5ef330848d05042f8da830abb8db06a3
|
|
| BLAKE2b-256 |
87021e1560dc4c8312d9c379de5359ac99d5c1aa7cb07470e4e36d5d59eb4be1
|