Skip to main content
Refract green diamond

llm-refract

Provider-neutral Python instrumentation for AI systems, with an optional MCP interface.

PyPI Python Downloads MCP License

Docs · Examples · Source · Issues


Instrument synchronous and asynchronous AI applications with provider-neutral events. Export portable .rfr files or submit snapshots to the Refract REST service. Record model calls, tools, retrieval, decisions, state changes, checkpoints and failures — then inspect, replay, fork and diff them.

Install

pip install llm-refract

MCP support is an optional extra:

pip install "llm-refract[mcp]"

SDK usage

import refract

with refract.run("agent", path="run.rfr"):
    refract.event(type="generation", name="answer", output={"text": "Hello"})

Try python examples/python/basic/record.py after installing. Outputs go to .examples/.

See the Python usage guide for async patterns, redaction, failure capture and submitting to a remote endpoint.

MCP server

Executable stdio interface to the Rust Refract API: fourteen read-only tools, plus import/fork tools when REFRACT_MCP_ALLOW_WRITES=1. Requires the mcp extra above. Start with:

refract-mcp

See configuration, tool inventory and limits. Implementation: server.py.

License

Apache-2.0 — see LICENSE.

See provider coverage for Azure, Gemini/Vertex, Bedrock and custom model adapters, and production operation for reliable remote capture.

Use refract.instrument_litellm() with llm-refract[litellm] to observe LiteLLM module or Router calls. Provider documentation covers configuration, mock examples and nested-call deduplication.

Metadata

Release files for llm-refract 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llm-refract 0.1.4
File Size Uploaded Provenance Actions
llm_refract-0.1.4.tar.gz 63.5 kB With provenance Details for llm_refract-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llm-refract 0.1.4
File Interpreter ABI Platform Actions
llm_refract-0.1.4-py3-none-any.whl Python 3 none any Details for llm_refract-0.1.4-py3-none-any.whl

Total release size: 117.3 kB

Release files / llm_refract-0.1.4.tar.gz

Download URL llm_refract-0.1.4.tar.gz
Size 63.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8fb62cc102500a4e25a544f6bede660fbf6e613ef05e8bb755a34ffb42856b1c
BLAKE2b-256 checksum
How to use checksums
9aacbb68b2c4b9ef60b0d22fb513c4ed77d2e99105f20659ada98ef0ccb7679c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 3, 2026.

Transparency log

Release files / llm_refract-0.1.4-py3-none-any.whl

Download URL llm_refract-0.1.4-py3-none-any.whl
Size 53.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
080786ff66eda399ca33c955550df209108e6182711358bf71386e8cd2b47ac9
BLAKE2b-256 checksum
How to use checksums
5d2d3b131435f3b22abbd73d942b32b58d3ff6c2c173d1d3b43944e053fcd197
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 3, 2026.

Transparency log

Security for llm-refract 0.1.4

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for llm_refract-0.1.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 3, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page