Skip to main content

Ferrant Logo

ferrant Python wrapper

This directory is an optional, thin Python binding around the Rust ferrant crate. The agent loop, providers, MCP, graph scheduler, persistence, streaming, and retrieval remain implemented in Rust. Installing this package does not change the Rust crate or its examples.

pip install ferrant

Then import it directly:

import asyncio
import os
from ferrant import Agent

async def main():
    agent = Agent.openai("gpt-5-nano", os.environ["OPENAI_API_KEY"])
    print(await agent.run("Explain Rust ownership in one paragraph."))

asyncio.run(main())

For local wrapper development, use maturin develop --release from this directory. End users do not need Maturin or a Rust toolchain when installing a prebuilt wheel.

pip install ferrant also installs the ferrant command and its local FastAPI/Uvicorn runtime dependencies. Run ferrant init to create a function-based Python agent and ferrant run to host it locally. Configure server: https://deploy.example.com and environment: <environment-id> in deploy.yml, create a token in the web console, run ferrant login --email you@example.com --token fdt_..., then run ferrant deploy to deploy through a Ferrant deployment server. The CLI does not accept account passwords. For CI, set a scoped deploy token in FERRANT_TOKEN. See the repository's deployment documentation for the handler contract.

The first authenticated deploy automatically creates or reuses the manifest's named project when environment still contains the generated placeholder. It selects the development environment and saves its ID back to deploy.yml.

The wheel uses PyO3's stable ABI for Python 3.9+. Rust futures are exposed as normal asyncio awaitables. Python custom-tool and graph-node callbacks are synchronous by design; keep expensive execution in Rust tools, MCP servers, or model calls.

See examples/ for Python counterparts of every top-level Rust example and matched advanced workflow examples.

Focused Python examples

Run these from the python-wrapper/ directory after installing the package:

python examples/streaming.py
python examples/memory.py
python examples/rag.py
DOCUMENT_PATH=invoice.pdf python examples/document_extraction.py
DOCUMENT_PATH=invoice.pdf python examples/rag_document_extraction.py
  • streaming.py prints content_delta events as the model generates them.
  • memory.py stores a session in .ferrant/sessions and recalls a prior turn.
  • rag.py persists a local hybrid vector index, retrieves relevant documents, and provides the matches as grounded agent context.
  • document_extraction.py base64-encodes a local PDF and asks OpenAI to extract invoice fields. Set DOCUMENT_PATH to a PDF and OPENAI_API_KEY before running it.
  • rag_document_extraction.py transcribes a local PDF with OpenAI, indexes the text locally, retrieves invoice-relevant passages, and returns schema-validated extraction results. Set DOCUMENT_PATH to a PDF.

The exposed surface covers OpenAI-compatible and Anthropic agents, Python tools, MCP-discovered tools, coordinator teams, multimodal input/output, streaming callbacks, schema-validated output, persistent retrieval, and durable workflow graphs with routes, parallel joins, retry/timeout policies, interrupts, resume, and recovery.

Release files for ferrant 0.1.18

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

Built distributions (wheels)

Table of built distributions (wheels) for ferrant 0.1.18
File Interpreter ABI Platform
ferrant-0.1.18-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
ferrant-0.1.18-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details
ferrant-0.1.18-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details

Total release size: 15.7 MB

Release files / ferrant-0.1.18-cp39-abi3-win_amd64.whl

Download URL ferrant-0.1.18-cp39-abi3-win_amd64.whl
Size 5.0 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
54b4ae276dbc0ce997225f6f7b910e4b5905dac958c8835568ae1e614b40fce7
BLAKE2b-256 checksum
How to use checksums
05c25fa17e9a30174f5f9b2f6aadb6bdd2e9b59e96ee0d09ec265fb57b8c93e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jul 14, 2026.

Transparency log

Release files / ferrant-0.1.18-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL ferrant-0.1.18-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 5.6 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
77d67582eda15dfa3db2bb457ac2f798999a50fad85e929f1be1f0014d97e685
BLAKE2b-256 checksum
How to use checksums
0a2b256a06b8c112b65e3040522e7908cb76a071a0a7d4ee27b8d618cba22f2c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jul 14, 2026.

Transparency log

Release files / ferrant-0.1.18-cp39-abi3-macosx_11_0_arm64.whl

Download URL ferrant-0.1.18-cp39-abi3-macosx_11_0_arm64.whl
Size 5.1 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
9fbe242b2aaf09acec8d4830775bc1e3bc400e28ddfa2a9625c5c7d92cff754d
BLAKE2b-256 checksum
How to use checksums
470ddd5f86a3e79184273223781da4ed1403983ee50b53d28ebd4b6d03065f03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jul 14, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.18 This release

3 release files

0.1.17

3 release files

0.1.15

3 release files

0.1.13

3 release files

0.1.10

3 release files

0.1.4

3 release files

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