Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

agentflight-sdk

Latest version: v0.2.0

Overview

Last scanned
28 Nov 2026
Published
28 Nov 2026
PyPI package Publisher: shupandee
0 Stars
0 Forks
2 Versions
Python Repo language

Scan summary

agentflight-sdk was last scanned on 28 Nov 2026 at version 0.2.0. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 2 versions, all published within 2 days (27 and 28 Nov 2026).
  • Findings: No rules fired in version 0.2.0.

Versions

2 versions published
Versions and the rules that fired in each
VersionPublishedStatus
0.2.0 LATEST 28 Nov 2026 No rules fired
0.1.0 27 Nov 2026 No rules fired

No rules fired in 0.2.0

Findings

Findings for v0.2.0. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 0.2.0; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

AgentFlight

A black box recorder for AI agents. AgentFlight records what an agent does during a run: model calls, tool executions, decisions, state changes, token spend and failures. Every run is stored as an ordered timeline you can query, replay and fork.

Status: early development (week 5, viewer). APIs may change; see CHANGELOG.md.

AgentFlight, Langfuse, LangSmith or Phoenix?

Langfuse, LangSmith and Arize Phoenix are full LLM engineering platforms. Besides tracing they offer evaluations, datasets and experiments, prompt management and dashboards, with many framework and provider integrations. Langfuse and Phoenix can be self-hosted and accept OpenTelemetry traces. LangSmith runs as a LangChain cloud service, with self-hosted and bring-your-own-cloud options on its Enterprise plan.

AgentFlight is much smaller: a Python recorder, one server on Postgres (or SQLite) and a read-only viewer, with no evaluations, prompt management or dashboards. Its focus is re-running your own agent code from a recording. Replay serves the recorded model and tool outputs back to the same code in your process, offline, and fork swaps one step and runs live from there. That's different from re-running a single LLM call in a playground (Phoenix's span replay, for example, replays LLM calls with different inputs). Choose one of the platforms if you need evaluations, prompt management or team features; AgentFlight if you want a small self-hosted recorder with step-by-step replay of agent runs.

Architecture

flowchart LR
    subgraph Agent process
        A[Your agent code] -->|run / llm_call / @tool / decision / state_change| SDK[agentflight SDK]
        SDK --> OTel[OpenTelemetry spans<br/>private TracerProvider]
        OTel --> EXP[AgentFlightExporter<br/>batched HTTP JSON]
    end
    EXP -->|POST /v1/spans| API[FastAPI ingest server]
    O[Any OpenTelemetry agent<br/>or Collector] -->|POST /v1/traces<br/>OTLP/HTTP| API
    API --> DB[(PostgreSQL<br/>runs + events)]
    C[curl / scripts] -->|GET /v1/runs, /v1/runs/:id| API
    V[Browser] -->|/ui viewer| API
  • One run = one OpenTelemetry trace. agentflight.run(...) opens the root span; its trace id is the run id. Everything recorded inside it is a child span.
  • *Each span carries `agentflight.attributes** (kind`, model, messages, tokens, tool args/result, error type...). Structured values are stored as JSON.
  • The SDK uses its own TracerProvider, so it doesn't change any global OTel setup your app already has.
  • The server upserts by span id (re-sent batches are idempotent) and accepts child spans before their root span arrives (the run shows as running until then; see Run status).
  • Run totals are stored on the run row (calls, errors, tokens, cost) and recomputed in SQL for every run an ingest batch touches, so listing runs never reads their events and re-sent spans can't make the totals drift.

Quickstart

# 0. A key for the server and the SDK (never commit it)
export AGENTFLIGHT_API_KEY=$(openssl rand -hex 32)

# 1. Server + Postgres + retention job (applies Alembic migrations on start)
docker compose up --build

# or without Docker, using SQLite (from a checkout; elsewhere,
# `pip install "agentflight-sdk[server]"`):
pip install -e ".[server]"
agentflight-server migrate      # uses AGENTFLIGHT_DATABASE_URL, default sqlite:///./agentflight.db
agentflight-server serve        # http://127.0.0.1:8000

# 2. Record the toy agent (the SDK reads AGENTFLIGHT_API_KEY)
pip install -e .                # elsewhere: pip install agentflight-sdk
                                # (the package is agentflight-sdk; you import agentflight)
python examples/toy_agent.py

# 3. Inspect: open http://localhost:8000/ui and sign in with the key, or use the API
curl -H "Authorization: Bearer $AGENTFLIGHT_API_KEY" localhost:8000/v1/runs
curl -H "Authorization: Bearer $AGENTFLIGHT_API_KEY" localhost:8000/v1/runs/<run_id>

Viewer

The server includes a read-only viewer at /ui:

  • Runs: every run with its status, start time, duration, call counts, failures, tokens and cost, filtered by status, name, model, tool, errors, metadata (key:value) and start time. Filters update the table in place. A run whose recorder dropped spans is marked "incomplete recording: N spans dropped" (see "Dropped spans are counted" below).
  • Run page: the run's spans as an indented tree (each span under its parent, siblings in start order) with a bar per span on the run's time axis, failures highlighted with their messages, and replay/fork runs linked to the run they came from. A span whose parent never arrived starts its own subtree at the left. Events load in pages of 100 without payloads, and the next page continues the tree where the last one stopped; selecting an event loads its messages, outputs, arguments and stack traces on demand. An incomplete recording gets a warning above the timeline. (To page in tree order the server reads every span's id and parent for each page, which is cheap next to loading the events themselves.)

Run list with filters

Run page: span tree, timeline bars, a failed tool call, and an event's payloads

A LangGraph run: model and tool calls nested under graph nodes

A fork run, linked to its source run, with cached, overridden and live steps

The screenshots come from the browser smoke test against the example agents; regenerate them with AGENTFLIGHT_SCREENSHOT_DIR=docs/screenshots pytest tests/test_viewer_browser.py.

It is server-rendered (Jinja2 and htmx, vendored, no build step) and reads through the same service functions and JSON shapes as the /v1 API, so another frontend can be built on the API alone. Everything a run recorded is treated as untrusted: templates autoescape everything and nothing is marked safe, and pages are served with a Content-Security-Policy that allows no inline script or style (script-src 'self'). See Viewer sign-in for how sessions work.

Recording API

import agentflight

agentflight.configure("http://localhost:8000")


@agentflight.tool  # records name, bound args, result or exception
def search(query: str) -> list[str]: ...


with agentflight.run("support-agent", metadata={"ticket": 42}) as run:
    with agentflight.llm_call("gpt-4o-mini", messages) as call:
        resp = client.chat(...)  # your model client
        call.record(resp.text, tokens_in=..., tokens_out=..., cost_usd=...)  # cost optional
    agentflight.decision("next_step", "search", reason="needs docs")
    agentflight.state_change("plan", new_plan, old=old_plan)
    try:
        search("refund policy")
    except Exception as exc:
        agentflight.error(exc)  # handled error: recorded, run continues

agentflight.flush()  # before exit, so batched spans are sent
  • Latency is the span duration (duration_ms in the API).
  • An exception escaping run, llm_call or a @tool marks that span (and the run) as error and is re-raised unchanged.
  • @agentflight.tool works on sync and async functions; @agentflight.tool(name="...") overrides the name.
  • If the server is unreachable, export fails with a logged warning; your agent keeps running.

Integrations

Optional extras; the core SDK depends on neither package.

OpenAI-style chat clients
pip install "agentflight-sdk[openai]"
from openai import OpenAI
from agentflight.integrations.openai import instrument_openai

client = instrument_openai(OpenAI())  # same client, now recorded
with agentflight.run("support-agent"):
    resp = client.chat.completions.create(model="gpt-4o-mini", messages=msgs, tools=tools)
  • Each chat.completions.create call is an llm span with the model, messages, request params (tools, temperature, ...), the full response (tool calls included) and tokens_in/tokens_out from response.usage.
  • Works with OpenAI and AsyncOpenAI, and with any client that has the same client.chat.completions.create(model=..., messages=...) shape. openai itself is never imported by AgentFlight.
  • Cost isn't guessed. There's no built-in price table, so pass instrument_openai(client, cost=lambda model, tokens_in, tokens_out: ...) if you want it.
  • extra_headers, extra_query, extra_body and timeout are passed to the client but never recorded (headers can carry credentials). Everything recorded goes through your redact hook.
  • Fail-open: the call happens exactly once with your arguments and its response or exception comes back unchanged. If response parsing or your cost function fails, that's logged and ignored. A client without the expected shape is returned untouched.
  • Not recorded yet: stream=True calls (passed straight through) and the Responses API.
LangGraph
pip install "agentflight-sdk[langgraph]"
from agentflight.integrations.langgraph import AgentFlightCallbackHandler

handler = AgentFlightCallbackHandler(run_name="react-agent")
graph.invoke(inputs, config={"callbacks": [handler]})
print(handler.run_id)
  • The graph becomes a run. Inside an agentflight.run(...) it's a node span in that run instead. Each executed node is a node span with agentflight.node.name, .step, .input (state in) and .output (state update).
  • Chat model and LLM calls inside nodes are llm spans (messages, params, response, token usage from usage_metadata or token_usage). LangChain tools are tool spans. So create_react_agent-style graphs record without any SDK calls in your code.
  • LangChain's own runnables inside a node (prompts, sequences, routers) aren't recorded. Their children attach to the nearest recorded span.
  • Errors are recorded where they happen and share one failure id up the graph. LangGraph interrupts aren't errors: the node's output records {"interrupted": ...}.
  • Params whose names contain api_key, secret, password or authorization are dropped.
  • Fail-open: every callback is guarded, so a broken recorder never changes the graph's result or exception.
  • Limitation: spans you record yourself inside a node (@agentflight.tool, llm_call) attach to the surrounding agentflight.run, not to the node span, and are only part of a run if one is open.

Both examples run offline (scripted model, no API key needed):

python examples/openai_agent.py      # uses the real API if OPENAI_API_KEY is set
python examples/langgraph_agent.py

OTLP ingest (any OpenTelemetry agent)

Agents that are already instrumented with OpenTelemetry (OpenLLMetry, OpenInference, framework auto-instrumentation or your own spans) can send traces to AgentFlight over standard OTLP/HTTP, without the AgentFlight SDK: POST /v1/traces accepts application/x-protobuf and application/json, optionally with Content-Encoding: gzip. OTLP over gRPC is not supported.

Use an ingest key, sent as Authorization: Bearer <key> (or X-AgentFlight-Key). With the stock environment variables (the exporter appends /v1/traces to OTEL_EXPORTER_OTLP_ENDPOINT; the space in the header value is written %20):

export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:8000
export OTEL_EXPORTER_OTLP_HEADERS="authorization=Bearer%20${AGENTFLIGHT_INGEST_KEY}"
export OTEL_EXPORTER_OTLP_COMPRESSION=gzip

Or in Python (pip install opentelemetry-exporter-otlp-proto-http):

from opentelemetry.exporter.otlp.proto.http import Compression
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor

exporter = OTLPSpanExporter(
    endpoint="http://localhost:8000/v1/traces",
    headers={"Authorization": f"Bearer {ingest_key}"},
    compression=Compression.Gzip,
)
provider = TracerProvider()
provider.add_span_processor(BatchSpanProcessor(exporter))

Or from an OpenTelemetry Collector, next to whatever else it exports to:

exporters:
  otlphttp/agentflight:
    endpoint: http://agentflight:8000        # the exporter appends /v1/traces
    headers:
      authorization: "Bearer ${env:AGENTFLIGHT_INGEST_KEY}"
    compression: gzip
service:
  pipelines:
    traces:
      receivers: [otlp]
      exporters: [otlphttp/agentflight]

How spans become runs. One trace is one run (the run id is the trace id), as with the SDK:

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • pypi-releases agentflight-sdk

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Powered by Read the latest findings

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Ethersphere Hijacked With Crypto Stealing Malware (1)
npm

Ethersphere Hijacked With Crypto Stealing Malware Via Github & npm

The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Vulnerability Insights

The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?

Cry2Wolf: How to Tell a Real Bug from a Nothingburger
AI & VibeSec

Cry2Wolf: Not Every Branded Bug Deserves a Fire Drill

Frame 2085668439 (1)
Group 1261154229