Skip to main content

Fast, lightweight AI agents powered by a Rust core

Project description

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, ferrant run to host it locally, and ferrant deploy --server https://deploy.example.com to deploy through a Ferrant deployment server. See the repository's deployment documentation for the handler contract.

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

ferrant-0.1.17-cp39-abi3-win_amd64.whl (4.8 MB view details)

Uploaded CPython 3.9+Windows x86-64

ferrant-0.1.17-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

ferrant-0.1.17-cp39-abi3-macosx_11_0_arm64.whl (5.0 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file ferrant-0.1.17-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: ferrant-0.1.17-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 4.8 MB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ferrant-0.1.17-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 47f0a5957dc15529bea984313a580d444add315b6d1d0fd76b771eb516a149a3
MD5 fbd688b63e1b2af7be670bdb881f8d94
BLAKE2b-256 4265835d48a040536fd50c9f5e8eba0806d4b6bf69c72c3c283ab16aabbda291

See more details on using hashes here.

Provenance

The following attestation bundles were made for ferrant-0.1.17-cp39-abi3-win_amd64.whl:

Publisher: python-wheels.yml on avinash31d/ferrant

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ferrant-0.1.17-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ferrant-0.1.17-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f3886b34f7c146f6c4840b1b63d0339b65443582dbbbc412093ad1653d0dba51
MD5 282994004ba89521b073865ff6dc9ccd
BLAKE2b-256 6e5408c1d67ee137a1057abcf209c6fb0d731fd537a33cb8e331fa5cf2e5a6bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for ferrant-0.1.17-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: python-wheels.yml on avinash31d/ferrant

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ferrant-0.1.17-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ferrant-0.1.17-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b2390caf8796acb6a38c749de0269509d9a3426209e7e7f6b3affd8e30420b36
MD5 ac9a8bf06835c53bc0a7f314bf56ceeb
BLAKE2b-256 902b287a0e861038cbb037a28b0fd0d1ad439ae491484ca5e55059da42816b3d

See more details on using hashes here.

Provenance

The following attestation bundles were made for ferrant-0.1.17-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: python-wheels.yml on avinash31d/ferrant

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page