Give every agent shared state, explicit ownership, and a safe way to publish concurrent work.
Cohort is a coordination layer for AI agents that need to work on the same workspace. It provides isolated branches, conflict-aware commits, resource leases, durable task claims, fencing tokens, and an inspectable event history.
It works alongside your existing agents and frameworks through a Python SDK, REST API, and MCP server. Cohort does not replace your agent runtime or decide what work agents should perform.
Connect compatible clients through MCP. The icons identify agent projects; they do not imply a separate native integration for each client. See integration notes.
Quick start · How it works · Core capabilities · MCP · Deployment · Documentation
Parallel agents increase throughput only when they can safely share work.
Imagine Claude Code changing an authentication module while Codex updates the same files and a third agent publishes an older snapshot. Without coordination, one agent can overwrite another agent's work, duplicate effort, or continue using stale ownership.
Cohort provides the shared coordination primitives around those agents:
- Shared state gives agents a common, versioned workspace.
- Isolated branches let agents prepare changes without immediately publishing them.
- Conflict-aware commits reject overlapping changes instead of silently overwriting the current state.
- Resource leases coordinate temporary ownership of shared keys.
- Task claims and fencing tokens prevent an expired worker from completing work with an obsolete claim.
- Event history makes coordination activity inspectable.
Cohort coordinates state and ownership. Your agent framework remains responsible for planning, model calls, and tool execution.
| Capability | What it provides |
|---|---|
| Shared workspace | A common key-value state that agents can read and update. |
| Isolated branches | Independent working copies created from a known workspace version. |
| Conflict detection | Rejects commits when concurrent changes overlap incompatibly. |
| Explicit resolution | Supports resolver strategies such as PreferBranch, PreferHead, and PreferAgent. |
| Resource leases | Temporary ownership for keys and shared resources, with expiry and handoff. |
| Fencing tokens | Monotonically increasing tokens distinguish current lease/task owners from stale workers. |
| Durable task coordination | Task lifecycle: pending → assigned → running → completed/failed. |
| Idempotent operations | Stable idempotency keys make supported retries safe against duplicate commits. |
| Event history | Structured events can be inspected and exported as JSONL. |
| Persistence | SQLite for local use and PostgreSQL for the hosted multi-tenant service. |
| Observability export | Hosted workspaces can export coordination logs to an OTLP/HTTP destination. |
Conflict detection currently operates at key granularity. A conflict resolver makes a decision explicit; it does not guarantee that the selected value is semantically correct.
Agents connect through the interface that fits their environment. Each request reaches Cohort's coordination layer, which manages branches, leases, tasks, snapshots, and events.
flowchart TD
A["Agent runtimes"] --> P["Python SDK"]
A --> M["MCP server"]
A --> R["REST API"]
P --> C["Cohort coordination layer"]
M --> C
R --> C
C --> B["Branches and conflict-aware commits"]
C --> L["Leases and fencing tokens"]
C --> T["Durable task coordination"]
C --> S["Shared state and snapshots"]
C --> E["Structured event history"]
- Register a distinct identity and credential for each agent.
- Claim a task and retain its fencing token.
- Create a branch from the current workspace state.
- Read the keys required for the task and acquire leases before protected writes.
- Make changes on the isolated branch.
- Commit with the task identity and current fencing token.
- If the commit conflicts, inspect the latest state and reconcile explicitly.
- Inspect the event history to understand what happened.
- Python 3.10+
- Git
- An MCP-compatible client (for MCP usage)
git clone https://github.com/chrismsmr-celcom/cerbere-cohort.git
cd cerbere-cohort
python -m pip install -e "./python"
from cerbere_cohort import ConflictError, Workspace
workspace = Workspace()
workspace.seed({"spec/auth": "initial"})
claude = workspace.create_branch("claude-code", "auth-update")
codex = workspace.create_branch("codex", "auth-fix")
claude.set("spec/auth", "updated by Claude Code")
codex.set("spec/auth", "updated by Codex")
workspace.commit("claude-code", claude)
try:
workspace.commit("codex", codex)
except ConflictError as exc:
print("Conflict detected:", exc.conflicting_keys)
print(workspace.head.data)
Both agents started from the same state and changed the same key. Cohort accepts the first commit and rejects the conflicting commit rather than silently replacing the accepted value.
For a runnable example, see two-agent conflict example.
python -m pip install -e "./python[dev]"
python -m pytest python/tests
The MCP server exposes Cohort coordination tools to compatible clients. It supports Streamable HTTP for remote clients and stdio for local single-client setups.
Install from the repository root:
python -m pip install -e "./python"
python -m pip install -e "./integrations/mcp-server"
Start a local Streamable HTTP server:
cerbere-cohort-mcp --transport streamable-http
The default local endpoint is:
http://127.0.0.1:8765/mcp
Keep the server on loopback for unauthenticated local SQLite use. Do not expose it directly to a network or the public internet.
For remote deployment, authentication, environment variables, available tools, and client-specific setup, read the MCP server guide.
| Interface | Best suited for |
|---|---|
| Python SDK | Add coordination directly to Python applications and agent workflows. |
| MCP server | Expose shared coordination tools to MCP-compatible agent clients. |
| REST API | Integrate a frontend, backend, or custom agent runtime. |
| Dashboard | Inspect workspaces, agents, branches, leases, tasks, and events. |
| SQLite | Local development and single-machine self-hosting. |
| PostgreSQL | Hosted beta persistence and organization-scoped workspaces. |
Cohort is framework-independent at the protocol boundary. A client needs a compatible MCP transport or an application-level integration with the REST API/SDK. See supported connection paths.
- Hosted beta deployment — Vercel, Render, Supabase, environment variables, and deployment verification.
- Self-hosting — local Docker Compose and SQLite.
- MCP server — local and remote MCP configuration.
- Closed beta tester guide — account setup, credentials, the multi-agent test workflow, and known limits.
| Guide | Description |
|---|---|
| Integration guide | Agent clients, connection methods, and integration boundaries. |
| Concepts | Workspace, branches, conflicts, leases, fencing, and event history. |
| MCP server | MCP transports, authentication, tools, and client setup. |
| Deployment | Hosted beta architecture and deployment steps. |
| Self-hosting | Local Community deployment and security boundary. |
| Tester guide | Beta onboarding and validation scenarios. |
| Privacy | Telemetry and data-handling details. |
| Changelog | Release history. |
The FastAPI service also exposes interactive OpenAPI documentation at /docs when running.
Cohort is an early beta under active development. The repository currently includes a key-value workspace, isolated branches, conflict-aware commits, resolver strategies, resource leases, deadlock detection, content-addressed snapshots, event replay, SQLite persistence, a PostgreSQL adapter, a FastAPI REST service, and an MCP server.
Important operational boundaries:
- Local SQLite mode is for trusted local use. It does not provide the hosted authentication boundary; keep unauthenticated local services bound to loopback.
- Hosted deployment is not yet a horizontally scalable control plane. Follow the single-instance and worker constraints in the deployment guide.
- REST and MCP deployment topologies have operational constraints. Follow the transport-specific guidance and avoid mixing writers until the shared-runtime boundary is verified for your deployment.
- Conflict detection is key-based. Cohort does not perform semantic code review or guarantee that a resolver's chosen value is correct.
- Cohort is not a sandbox or external tool authorization system. It coordinates shared state, leases, tasks, and events; it does not contain arbitrary agent code or authorize every external action.
- The Rust trace analyzer is an early utility for basic JSONL analysis.
Read the deployment guide and self-hosting security boundary before exposing any service.
Areas under development include finer-grained coordination scopes, stronger shared-runtime boundaries across deployment topologies, richer shared resources, broader integration examples, and improved trace analytics. Roadmap items are not presented as shipped capabilities.
Bug reports, integration feedback, and pull requests are welcome.
- Read CONTRIBUTING.md before opening a pull request.
- Report security issues privately using SECURITY.md.
- For beta product feedback, use the beta feedback issue template.
Cerbere Cohort is released under the MIT License.
