API reference¶
The reference is generated from the library's docstrings and type annotations. It documents each package's public API: the names in its __all__. Anything else is internal and may change without notice.
Packages¶
The packages are layers. Each depends only on the ones below it, so each is usable without the ones above (Architecture).
| Package | What it holds | Install |
|---|---|---|
reflexr.core |
Every decision, as pure functions over immutable values: events and envelopes, actors, conditions, rules, evaluation, the run lifecycle, feedback, rejections and the protocol's frames | core |
reflexr.telemetry |
Tracing and metrics through the OpenTelemetry API: attribute names, the metric registry and its cardinality policy, and untraced polling | core |
reflexr.workspace |
Tenant-scoped workspace handles, the Reactor, the action port and Reaction, schedules, the storage protocol and in-memory storage |
core |
reflexr.agent |
pydantic-ai agents and pydantic-graph graphs as actions, with the EventContext capability and graph checkpoints |
core |
reflexr.scores |
Feedback as scores: the mirror that follows the log, on evalr's mapping and ports | langfuse or evals extra |
reflexr.sql |
SQL storage on PostgreSQL and SQLite, and its migrations | sql, postgres or sqlite extra |
reflexr.fastapi |
HTTP ingest, REST reads and administration, and the WebSocket stream, as a FastAPI router | fastapi extra |
reflexr.mcp |
An MCP server for external agents | mcp extra |
reflexr.otel |
configure_telemetry: the OpenTelemetry SDK, OTLP export, instrumentations and metric views, composed with other libraries' contributions |
otel extra |
reflexr.langfuse |
Langfuse: whole traces, each run's session and trace attributes, and feedback as scores | langfuse extra |
reflexr.litellm |
The LLM gateway: models over a LiteLLM proxy, with tenancy, keys and guardrails on every request | litellm extra |
reflexr.evals |
evalr for reflexr: feedback as examples, evaluators as rules, replay experiments and end-to-end measures | evals extra |
The wire formats have their own pages: the stream protocol, and the JSON Schemas of rules and of the protocol's frames.
The top-level package¶
reflexr re-exports the names most applications need to define events and rules, so from reflexr import Event, Rule, on, by, run, F works. Each is documented in its layer:
| Name | Documented in |
|---|---|
Event, Envelope |
reflexr.core: Events |
Rule, RetryPolicy, by, run |
reflexr.core: Rules |
on, sequence, F, field |
reflexr.core: Conditions |
Actor, UserActor, AgentActor, ExternalAgentActor, SystemActor, SourceActor, EvaluatorActor |
reflexr.core: Actors |
Feedback |
reflexr.core: Feedback |
Rejection, NotFound, InvalidRule |
reflexr.core: Rejections |
new_id |
reflexr.core: Identifiers |
The runtime lives in its own layers: Workspaces, Reactor, Reaction, Schedule and InMemoryStorage in reflexr.workspace, and AgentAction, EventContext and GraphAction in reflexr.agent.
reflexr.__version__ is the installed version.