Flight Manual · 06
Driving Blackbird from programs
Hand Blackbird work from shell scripts, CI, or other agents with --once, or attach a live stateful session over framed pipes with --application.
One-shot commands
blackbird --once 'Inspect this project and explain its build.' --effort medium
--once PROMPT executes one turn in plain mode and exits. The model's reply—and anything else the turn program displays—goes to stdout. Session path, status lines, tool outcomes, and warnings go to stderr, keeping piped output clean for shell scripts or agents like Claude Code.
- Each call creates a fresh session unless you pass
--session DIRECTORY. Only one process can hold a session at a time. - A one-shot run cannot pause to ask which reasoning effort you meant, so pass an
--effortyour provider supports. --provider,--model, and--workflowbehave the same way they do interactively.SIGTERMstops the run cleanly with exit status143.
One-shot runs have the exact same tools as an interactive session, with no confirmation prompts (details).
The application interface
For a long-lived session driven by another process, launch Blackbird with --application and exchange length-prefixed binary packets over stdin / stdout. You get the same sessions, providers, turn programs, and tools as the terminal; stdout carries only packets and diagnostics go to stderr.
blackbird --application
Each frame is a 4-byte big-endian length prefix followed by a BBM2 packet starting with magic bytes 42 42 4d 02. Packet sizes run from 5 to 4,194,304 bytes; a malformed, oversized, or truncated frame immediately closes the connection.
What you send
| Packet | Purpose |
|---|---|
open | Must come first. Carries id, session directory, and optional model, effort, workflow. Blackbird replies ready. Keeps the session's saved provider; new sessions default to OpenAI. |
turn | Starts a turn with id, objective, and optional observations (such as page captures with url, title, and text). |
steer | Cancels the running turn and queues a replacement under a new id. |
cancel | Stops the active turn and drops any queued replacement. |
close | Halts work, flushes and saves the session, emits closed, and exits. |
What you get back
| Packet | Payload |
|---|---|
text | Chunk of the model's streamed reply. |
status | What the engine is doing right now. |
final | Closes a turn with outcome (completed, cancelled, or failed) and the displayed text. |
error | Carries message and final_follows (whether a final packet for that turn is still coming). |
Drain stdout continuously: Keep reading standard output until Blackbird exits—if your process stops draining the pipe, cancellation can stall. Closing stdin cancels whatever is running.
See the full application interface spec on GitHub for every field, byte limit, ordering rule, and optional host-provided tools.