One protocol for running coding agents in the background, on this machine or another one.
Introduction · Architecture · Protocol · Schema · Examples
A caller is a program that wants an agent to do some work and tell it when it's done. The agent might be Claude Code, Codex, an ACP agent, a terminal UI or something you wrote last night. It might run on your laptop or on another machine across the network. FAP is the contract between those two sides.
Between them sits a host, the program that starts agent processes, keeps their conversations and records what they report. The caller talks to the host with one set of thread calls. It creates a thread (one conversation with one agent), sends it a message, reads the answer, steers the running turn and closes the thread. The agent talks to the host in JSON, one object per line on its stdin and stdout.
Neither side needs code from the other. The same calls also reach a host on another machine, through a connection called a link.
| FAP | ACP | MCP | |
|---|---|---|---|
| Connects | A program to agents nobody is watching | An editor to an agent a person is watching | An agent to tools |
| Typical caller | An orchestrator running ten children | An editor | An agent |
| Knowing when work is done | A create with a prompt and every send return a receipt with a watch command, so the caller doesn't poll | The user watches the session | Not its job |
| Other machines | Reaches threads on machines it doesn't run on, through a link | Not its focus | Not its focus |
FAP borrows ACP's ideas where they fit and tracks every stable ACP row in a coverage table so the gap stays visible.
The example needs Bun 1.4 or newer and the reference host, omo-harness, linked at the path the SDK is imported from:
gh repo clone sisyphuslabs/omo-harness-skill ~/.omo-harness-skill-src
mkdir -p ~/.agents/skills ~/.config/omo-harness/drivers
ln -sfn ~/.omo-harness-skill-src ~/.agents/skills/omo-harnessWrite an agent in one file, echo.ts. It reads one JSON object per line (a frame) on stdin and writes frames on stdout:
#!/usr/bin/env bun
const emit = (f: object) => process.stdout.write(JSON.stringify(f) + "\n")
for await (const line of console) {
if (line.trim() === "") continue // the read at end of input is an empty line
const frame = JSON.parse(line)
if (frame.type === "hello") emit({ type: "ready", id: frame.id })
if (frame.type === "prompt") {
emit({ type: "ack", id: frame.id, status: "active" })
emit({ type: "assistant", text: `echo: ${frame.message}` })
emit({ type: "turn_ended", status: "success" })
}
}Describe it with a spec file, ~/.config/omo-harness/drivers/echo.json. The host reads every spec file in that folder and lists each agent it finds in harnesses(). Put the real path to echo.ts in command:
{ "fap": 1, "id": "echo", "label": "Echo", "wire": "fap", "command": ["bun", "/path/to/echo.ts"] }Call it from any Bun script. harness is the spec's id, and made.thread.thread is the new thread's id:
const { connect } = await import(`${process.env.HOME}/.agents/skills/omo-harness/scripts/sdk.ts`)
const fap = connect()
const made = await fap.thread_create({ harness: "echo", prompt: "hi" })
const read = await fap.thread_read({ thread: made.thread.thread, wait_ms: 30_000 })
console.log(read.turn.response) // echo: hi
await fap.thread_close({ thread: made.thread.thread })The full walk-through is in Examples: a minimal agent.
Callers talk to a FAP host with thread_* calls. The host keeps threads, turns and an event log where each event has a sequence number (seq).
The host drives each agent over its wire, and calls reach a host on another machine over a link.
Mermaid source
flowchart LR
subgraph North["Callers"]
SDK["SDK"] --- CLI["CLI"] --- MCP["MCP / thread tools"]
end
subgraph Core["FAP host"]
T["threads, turns, event log (seq)"]
end
subgraph South["Agents"]
W1["wire: fap"] --- W2["wire: terminal"] --- W3["wire: acp"] --- W4["TypeScript driver"]
end
North -->|thread_* calls| Core
Core -->|hello / prompt / steer / abort| South
South -->|assistant / tool_start / usage / turn_ended| Core
Core <-->|"link (JSON-RPC, one frame per line)"| Far["FAP host on another machine"]
More detail is in Architecture.
FAP v1 is a draft, and it's what the reference implementation runs today. Pages in the docs mark anything that isn't built yet with a Planned callout.
| Piece | Status |
|---|---|
| Thread calls and receipts | Built |
Agent wire fap: 1 |
Built |
| Terminal UI agents (text only) | Built |
| Link to another machine: local, per-call and pipe routes | Built |
| ACP coverage table, no stable row planned | Built |
| Generic ACP wire, v1 and v2 | Built |
| Event vocabulary 2 and requests | Built |
| ACP agent face for editors | Built |
| Link: relay route | Planned |
See the roadmap for details.
| Section | Pages |
|---|---|
| Get started | Introduction, Architecture, Related protocols, Agents, Callers |
| Protocol | Overview, Initialization, Thread setup, Prompt turn, Events, Tool calls, Steering and interrupts, Receipts and watching, Other machines, Errors, Schema, Roadmap |
| Libraries | TypeScript |
| Examples | Minimal agent, Spec files, Calling from code, Another machine, Link frames |
New to FAP? Read the Introduction, then build the minimal agent. The machine-readable list of calls is in schema/ops.json, the event stream of vocabulary 2 is in schema/events.json, and npx mint dev in docs/ previews the site.
omo-harness is the reference host. It runs agents such as Claude Code and Codex through FAP. The docs describe it at commit 6e35377, and every source link points at that commit.
MIT. See LICENSE.