Agent Bridge
A public MIT-licensed, local-first coordination protocol for durable messaging, shared tasks, and bounded handoffs between terminal AI agents.
Project Context & Scope
- Company
- Open-Source AI Tooling
- Role
- Author & Systems Engineer
- Period
- 2026
- Scope
- Local-first coordination protocol and CLI for terminal AI agents
Problem & Operational Bottleneck
Terminal-based AI agents and CLI copilots typically operate in isolated session silos. Passing state, sub-task delegations, and execution context between disparate agent runtimes required cumbersome manual copying or fragile temporary files.
Constraints & Requirements
- Zero cloud service dependencies—must run entirely offline and locally
- A structured primary transport with tmux available only as a compatibility fallback
- Python standard-library-only runtime dependencies
- Bounded messages, inboxes, retries, and explicit acknowledgement states
System Architecture Lifecycle
A local process registers its run name, policy, and inbox address
The bounded message is persisted before delivery is attempted
A structured JSON frame is sent to the recipient's local inbox
Prompt injection is attempted only when configured and no socket listener is ready
Recipient acknowledgement and delivery state remain inspectable
Detailed architecture diagram illustrating stages and transition safeguards for Agent Bridge.
System Architecture & Ownership
Designed a Python CLI and protocol with SQLite-backed messages and tasks, Unix-domain socket inbox delivery as the primary transport, and explicit tmux prompt injection as a fallback. Runs, policies, delivery states, acknowledgements, and task claims remain durable locally.
Engineering Decisions & Rationale
- Used SQLite for the durable queue and atomic task claims instead of introducing a hosted relay.
- Made Unix-domain sockets the structured primary delivery path and kept tmux injection explicit and optional.
- Published under the permissive MIT license on GitHub to foster community adoption and extensible tooling integration.
- Kept runtime dependencies within the Python standard library.
Reliability, Retries & Safeguards
- Messages are stored before delivery and claimed atomically so concurrent workers cannot inject the same message twice.
- Sender-scoped idempotency, bounded payloads, inbox limits, rate limits, and reply-hop limits constrain coordination loops.
- Queued, held, delivered, acknowledged, failed, and refused outcomes remain distinct and inspectable.
Evidence & Production Outcomes
Published as an open-source public repository on GitHub (github.com/oliveralerubio/agent-bridge) with complete test suites and documentation.
Reflection & Engineering Learnings
The implementation showed that SQLite plus local sockets can provide durable, inspectable coordination while keeping provider-specific adapters outside the core protocol.
Need a similar automation system?
Let's review your operational bottlenecks and design a reliable production pipeline.
AI Marketing Creative Engine
An AI creative pipeline for Listing Profit that reduced campaign turnaround from four hours to five minutes and approximate unit cost from $300 to $8 through retryable n8n orchestration, structured outputs and automated QA gates.
Roads Consulting Group USmarketingAI
A production full-stack AI marketing SaaS that combines Pydantic AI generation, human approval controls, durable job execution, and Cloudflare-hosted web and API services.