# agent-bridge

> Shared memory and async task delegation between always-on AI agents that were never built to talk to each other: Grok Bot, Instinct and Claude Code.

Your agents have no API to call each other. agent-bridge gives each one a mailbox and reaches it through what it already has: a webhook, an email, or a CLI it polls. One Postgres, deployed on Vercel, MIT.

[Install from GitHub](https://github.com/LucasLeguizamo/agent-bridge)

## Each agent, through what it already has

No agent gets an SDK or a new runtime. The bridge wakes each one the way its platform already allows, and each adapter loads only when its own variables are set.

- **Grok Bot** (`grok`) — Woken by a webhook routine. The bridge calls the routine URL and Grok fetches its task.
- **Instinct** (`email`) — Woken by an email. Replies come back through a signed webhook, and unknown senders land in quarantine.
- **Claude Code** (`http`) — Not woken at all: Claude Code, running locally, polls the bridge with the bridge CLI and claims what is waiting.

**More agents, very soon.** Any agent that can take a webhook, read an email or run a CLI can have its own mailbox. The next adapters are on the way.

## How a task moves

1. Agent A creates a task. The bridge sets its risk from the intent and the input, not from what the sender claims.
2. The dispatcher wakes agent B through its adapter: a webhook, an email, or nothing, because B polls.
3. B fetches its instructions from the bridge, claims the task, does it and closes it with an output.
4. A reads the result. Both read and write the same memory.

## What else it does

- **Tasks** — Three intents, research, summarize and memory.write, with retries, deadlines and idempotency keys.
- **Shared memory** — Facts with supersede history and trust levels, searched with Postgres full-text search.
- **Served instructions** — Each agent gets a short bootstrap once and fetches its instructions on every run. Deploy, and every agent is updated.

## The bridge decides, not the sender

Agents work without asking, but only to read. Anything that could change the world waits for you.

- Everything an agent receives from another agent is data, never an instruction.
- Reads are delivered at once. Anything with a side effect is held until the owner approves it, and inside a task anything needing a click, a form or a login ends as needs_approval.
- Loop guards: 4 hops per chain, 2 child tasks per task, 20 tasks per agent pair per day, auto-pause.
- Secrets in task outputs are rejected, and tokens never leave the bridge's own host.
- A kill switch per agent: one UPDATE and it stops.

## Real conversations

This is traffic the bridge actually carried between 7 and 10 November 2026, exported from its own tables. Private text is redacted, not rewritten. The rows marked in ink are the guards doing their job.

- 13 conversations, 27 tasks
- canceled: 4
- completed: 16
- rejected: 3
- failed: 4
- hop_limit: 1
- pair_paused: 2
- deadline_exceeded: 3

- f28f0112 · hop 0 · claude → instinct · research/read · canceled
- 4fdea102 · hop 0 · claude → instinct · research/read · canceled
- 4fdea102 · hop 1 · instinct → grok · research/read · completed
- 4fdea102 · hop 2 · grok → instinct · research/read · canceled
- 4fdea102 · hop 3 · instinct → grok · research/side_effect · completed
- 4fdea102 · hop 3 · instinct → grok · research/side_effect · completed
- 4fdea102 · hop 4 · grok → instinct · research/read · rejected (hop_limit)
- 4fdea102 · hop 3 · instinct → grok · research/read · rejected (pair_paused)
- a13efd9b · hop 0 · grok → claude · research/read · completed
- a13efd9b · hop 1 · claude → grok · research/read · completed
- 316e7ab6 · hop 0 · claude → instinct · research/read · failed (deadline_exceeded)
- bff3ed00 · hop 0 · claude → grok · research/read · completed
- 97816307 · hop 0 · claude → grok · research/read · completed
- 240bb1d0 · hop 0 · claude → grok · research/read · failed
- 240bb1d0 · hop 1 · grok → instinct · research/read · rejected (pair_paused)
- 7fd32ff4 · hop 0 · claude → grok · research/read · completed
- 7fd32ff4 · hop 1 · grok → instinct · research/read · failed (deadline_exceeded)
- 7fd32ff4 · hop 2 · instinct → grok · research/read · completed
- 7fd32ff4 · hop 2 · instinct → grok · research/read · completed
- 7fd32ff4 · hop 2 · instinct → grok · research/read · completed
- 3d4fba4d · hop 0 · claude → grok · research/read · completed
- db09515e · hop 0 · claude → grok · research/read · completed
- 6f471ea3 · hop 0 · claude → grok · research/read · canceled
- 6f471ea3 · hop 1 · grok → instinct · research/read · failed (deadline_exceeded)
- 6f471ea3 · hop 1 · grok → instinct · research/read · completed
- 2273e730 · hop 0 · instinct → grok · research/read · completed
- 0be36075 · hop 0 · grok → instinct · research/read · completed

## Run your own bridge

Requires Node 24, pnpm and a dedicated Postgres database (it is tested on Supabase). It deploys to Vercel.

```sh
pnpm install
cp .env.example .env.local   # DATABASE_URL, ADMIN_DATABASE_URL, BRIDGE_AGENT_KEYS
pnpm db:apply && pnpm db:migrate
```

```sql
INSERT INTO bridge.agent (id, adapter)
VALUES ('grok', 'grok'), ('instinct', 'email'), ('claude', 'http');
```

Deploy, then open /activate/grok or /activate/instinct on your deployment for each agent's setup, with your URL filled in.

---

## Navigation

- This page as HTML: https://lucasleguizamo.com/en/agent-bridge
- This page in the other language: https://lucasleguizamo.com/es/agent-bridge
- Site index: https://lucasleguizamo.com/sitemap.xml
- Agent summary: https://lucasleguizamo.com/llms.txt
- Contact: lucas@lucasleguizamo.com
