Flight Recorder
Record every step of an AI agent run: each model call (messages, response, tokens, cost, latency) and each tool call (arguments, result, effect), in local JSONL files you can list and read.
v0.1 records. Replay in CI, cost budgets and approval gates come in later releases.
Quickstart
Python 3.11 or newer. No API key needed.
pip install ai-flight-recorder
Save this as agent.py:
import flight_recorder as fr
@fr.tool(effect="read")
def lookup_order(order_id: str) -> dict[str, str]:
return {"order_id": order_id, "status": "shipped"}
@fr.tool(effect="irreversible")
def issue_refund(order_id: str, amount: float) -> str:
return f"refunded {amount} on {order_id}"
with fr.run("refund-desk", inputs={"order_id": "A-17"}) as run:
order = lookup_order("A-17")
run.output = issue_refund(order["order_id"], 19.99)
print(run.run_id)
Run it, then look at what was recorded:
python agent.py # prints the run id
fr runs # list runs, newest first
fr show <run id> # every step, in order (a unique prefix of the id works)
Runs are written to .fr/ in the current directory (set FR_DIR or fr.configure(dir=...) to change it).
Recording model calls
Wrap the client instance. Calls, streams and async calls behave exactly as before.
pip install 'ai-flight-recorder[openai]' # or [anthropic]
from openai import OpenAI
client = fr.wrap(OpenAI())
with fr.run("triage"):
client.chat.completions.create(model="gpt-4.1-mini", messages=[...])
fr.wrap also takes AsyncOpenAI, Anthropic and AsyncAnthropic. Cost comes from the shipped pricing table; a model missing from it records a null cost and warns once. Add or override prices with fr.configure(pricing="prices.toml").
LangChain and LangGraph
pip install 'ai-flight-recorder[langchain]'
model = fr.langchain.wrap_model(ChatOpenAI(model="gpt-4.1-mini"))
tools = fr.langchain.wrap_tools(tools, effects={"search": "read"})
Steps inside a LangGraph graph are tagged with their node (node:agent).
What is recorded, and what is not
- Secrets are redacted before anything is written. Add your own rules with
fr.configure(redact=[fr.redact.pattern(...), fr.redact.path(...)]). - Recording fails open: if a write fails, the agent keeps running and one warning is logged.
- Nothing leaves your machine except your own model and tool calls. With
fr.configure(otel=True)(theotelextra), each run is also exported to your OpenTelemetry tracer provider, with message content off by default. - Overhead is under 2 ms per call, checked in CI.
License
Apache-2.0
Metadata
Release files for ai-flight-recorder 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ai_flight_recorder-0.1.1.tar.gz | 43.8 kB | Without provenance | Details for ai_flight_recorder-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ai_flight_recorder-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for ai_flight_recorder-0.1.1-py3-none-any.whl |
Total release size: 97.0 kB
Release files / ai_flight_recorder-0.1.1.tar.gz
| Download URL | ai_flight_recorder-0.1.1.tar.gz |
|---|---|
| Size | 43.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
25233576433feb39b672350e94142e42046083d435bca25eae60aba01a0d4209
|
|
BLAKE2b-256 checksum How to use checksums |
edc6a93ff18f23b2a2dbf1baf4060c6afc788d11b8fa287210c7817572425912
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / ai_flight_recorder-0.1.1-py3-none-any.whl
| Download URL | ai_flight_recorder-0.1.1-py3-none-any.whl |
|---|---|
| Size | 53.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b28fe5dc3af40208e1fddb63f4107d79386cd1d5808e93e36187b72942b6ccab
|
|
BLAKE2b-256 checksum How to use checksums |
6513b40c39fafdbb21ce9ca74aeb75a73227dac94e36c90a1cd27b8b3e07c7ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for ai-flight-recorder 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.