Reusable orchestration core for AI coding agent CLI pipelines
Project description
orchcore
Reusable orchestration core for AI coding agent CLI pipelines.
What is orchcore?
orchcore is an async-first Python 3.12+ library that provides unified infrastructure for launching, monitoring, and managing multiple AI coding agent CLIs (Claude, Codex, Gemini, Copilot, OpenCode) as subprocesses through phase-based pipelines. It was extracted from four production orchestration systems — Planora, Articles, Finvault, and Raven — eliminating 60-70% of duplicated infrastructure so consuming projects only implement domain-specific logic.
Features
- Multi-agent subprocess orchestration — async launch, stream capture, concurrency control
- Unified stream processing — 4-stage pipeline normalizes 5 JSONL formats into a single
StreamEventmodel - DAG-based phase pipelines — sequential/parallel execution with dependency ordering and resume
- Rate-limit recovery — automatic detection, timezone-aware reset parsing, exponential backoff
- Layered configuration — TOML files, env vars, CLI overrides, named profiles
- Protocol-based UI —
UICallbackdecouples engine from display (Rich, Textual, headless) - Registry-as-data — new agent support via TOML config alone, zero code changes
- Graceful shutdown — SIGINT/SIGTERM with subprocess cleanup and state preservation
Installation
uv pip install orchcore
From source:
git clone https://github.com/AbdelazizMoustafa10m/orchcore.git
cd orchcore
uv pip install -e ".[dev]"
Requirements: Python 3.12+
Quick Start
1. Define Agents
# agents.toml
[agents.claude]
binary = "claude"
model = "claude-sonnet-4-20250514"
subcommand = "-p"
stream_format = "claude"
[agents.claude.flags]
plan = ["--think", "--verbose"]
[agents.claude.output_extraction]
strategy = "jq_filter"
jq_expression = ".content[0].text"
2. Run a Pipeline
import asyncio
from pathlib import Path
from orchcore.pipeline import PipelineRunner, PhaseRunner, Phase
from orchcore.registry import AgentRegistry, AgentMode, ToolSet
from orchcore.runner import AgentRunner
from orchcore.ui import NullCallback
async def main() -> None:
registry = AgentRegistry()
registry.load_from_toml(Path("agents.toml"))
phase = Phase(
name="planning",
agents=["claude"],
tools=ToolSet(internal=["Read", "Glob", "Grep"], permission="read-only"),
)
runner = AgentRunner()
phase_runner = PhaseRunner(runner, registry, max_concurrency=4)
pipeline = PipelineRunner(phase_runner)
result = await pipeline.run_pipeline(
phases=[phase],
prompts={"planning": "Analyze the codebase and create a plan."},
ui_callback=NullCallback(),
mode=AgentMode.PLAN,
)
print(f"Success: {result.success} | Cost: ${result.total_cost_usd}")
asyncio.run(main())
Modules
| Module | Purpose |
|---|---|
stream/ |
4-stage pipeline (Filter → Parse → Monitor → Stall Detect) for 5 agent formats |
pipeline/ |
DAG-based phase orchestration — sequential/parallel multi-agent execution |
runner/ |
Async subprocess management with stdin/stdout/stderr piping |
registry/ |
Agent configurations as data (TOML/dict) with runtime lookup |
config/ |
Layered configuration: TOML → env vars → CLI overrides → profiles |
recovery/ |
Rate-limit detection, exponential backoff, git dirty-tree recovery |
workspace/ |
Artifact lifecycle management |
prompt/ |
Jinja2 template rendering with frontmatter stripping |
ui/ |
UICallback protocol for pluggable display layers |
signals/ |
Graceful SIGINT/SIGTERM shutdown |
display/ |
Colored stderr logging (no Rich dependency in core) |
observability/ |
Optional OpenTelemetry integration |
Documentation
Full documentation is available at abdelazizmoustafa10m.github.io/orchcore.
| Document | Description |
|---|---|
| Installation | Prerequisites, install options, extras |
| Quick Start | Define agents, build phases, run pipelines |
| Configuration Reference | Full settings table, profiles, env vars |
| Stream Events Reference | StreamEvent fields, types, agent states |
| UICallback Reference | Protocol methods and built-in implementations |
| Architecture | Package layout, core abstractions, design decisions |
| Stream Pipeline | 4-stage composable pipeline deep-dive |
| Design Document | Problem statement, requirements, proposed design |
| Writing a UICallback | Build custom display layers |
| Agent Registry | TOML config, adding new agents, ToolSets |
| Recovery & Retry | Rate limits, backoff, failure modes |
| Contributing | Dev setup, code standards, testing |
Contributing
See CONTRIBUTING.md for development setup, testing instructions, and code standards.
Please also review CODE_OF_CONDUCT.md and SECURITY.md.
License
orchcore is released under the 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 orchcore-0.2.1.tar.gz.
File metadata
- Download URL: orchcore-0.2.1.tar.gz
- Upload date:
- Size: 1.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc4ce7c71059ae8e55f06d2dda9b1f8d0d76f79ea4856fe825935590dbae2320
|
|
| MD5 |
b9861f5bf6c18e54bb746cb746b1470c
|
|
| BLAKE2b-256 |
55b1c49cea3c03f8629ae10fda47d2c5cfa8fe4902d1b917b39b7dc35fd05793
|
Provenance
The following attestation bundles were made for orchcore-0.2.1.tar.gz:
Publisher:
publish.yml on AbdelazizMoustafa10m/orchcore
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
orchcore-0.2.1.tar.gz -
Subject digest:
cc4ce7c71059ae8e55f06d2dda9b1f8d0d76f79ea4856fe825935590dbae2320 - Sigstore transparency entry: 1194202393
- Sigstore integration time:
-
Permalink:
AbdelazizMoustafa10m/orchcore@4d834d3a7a34dac6d4cd7b972158363db4591ee5 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/AbdelazizMoustafa10m
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4d834d3a7a34dac6d4cd7b972158363db4591ee5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file orchcore-0.2.1-py3-none-any.whl.
File metadata
- Download URL: orchcore-0.2.1-py3-none-any.whl
- Upload date:
- Size: 62.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
948783b77ab2cd00b494e6a16b6c59dc721d6c208215c4e5cee41cf879b3bb49
|
|
| MD5 |
3e9ac51d8bef39595cc8b1ac1a32fb83
|
|
| BLAKE2b-256 |
4fe4cf6dcedf0a18c6d0d18ddcc5c6c094c20ffa7134117dcbd2fb7203760725
|
Provenance
The following attestation bundles were made for orchcore-0.2.1-py3-none-any.whl:
Publisher:
publish.yml on AbdelazizMoustafa10m/orchcore
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
orchcore-0.2.1-py3-none-any.whl -
Subject digest:
948783b77ab2cd00b494e6a16b6c59dc721d6c208215c4e5cee41cf879b3bb49 - Sigstore transparency entry: 1194202431
- Sigstore integration time:
-
Permalink:
AbdelazizMoustafa10m/orchcore@4d834d3a7a34dac6d4cd7b972158363db4591ee5 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/AbdelazizMoustafa10m
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4d834d3a7a34dac6d4cd7b972158363db4591ee5 -
Trigger Event:
push
-
Statement type: