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

If Refract helps you, a GitHub star or feedback would be appreciated. The SDK prints this thank-you once per process when you create a run or service client with stderr connected to a terminal. Set REFRACT_NO_BANNER=1 to silence it.

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.5

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.5
File Size Uploaded Provenance Actions
llm_refract-0.1.5.tar.gz 64.2 kB With provenance Details for llm_refract-0.1.5.tar.gz

Built distribution (wheel)

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

Total release size: 118.9 kB

Release files / llm_refract-0.1.5.tar.gz

Download URL llm_refract-0.1.5.tar.gz
Size 64.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3ca5e7aee650c2810244c499ba4534f092ec7946aa85368f0d78ee1e690bc50e
BLAKE2b-256 checksum
How to use checksums
45978415e5d4a2dc863b9dc160b272036f47d05022aa627b3d22a807c2db7332
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 9, 2026.

Transparency log

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

Download URL llm_refract-0.1.5-py3-none-any.whl
Size 54.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e68cb48e33b2d9b2d807b5443105db28210869b595e0db0bcf404cc20abe8270
BLAKE2b-256 checksum
How to use checksums
6f12941504c51ba1310e9d35be374a863a9d5eb63f2bc8b9082b3828d5fef288
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 9, 2026.

Transparency log

Security for llm-refract 0.1.5

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.5.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 9, 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