Skip to main content

Python bindings for FlowgentraAI - build AI agents with graphs

Project description

FlowgentraAI Python Bindings

Python bindings for the FlowgentraAI Rust library, built with PyO3 + maturin.

Installation

From source (development)

cd flowgentra-ai-py
pip install maturin
maturin develop

Build a wheel

maturin build --release
pip install target/wheels/flowgentra_ai-*.whl

Quick Start

from flowgentra_ai import Agent, SharedState, Message

# Create agent from YAML config
agent = Agent.from_config_path("config.yaml")

# Set initial state
agent.state["input"] = "Hello, world!"

# Run the agent
result = agent.run()
print(result.to_dict())

API Overview

State Management

from flowgentra_ai import SharedState, PlainState

# SharedState (thread-safe, default)
state = SharedState({"key": "value"})
state["name"] = "FlowgentraAI"
print(state["name"])        # "FlowgentraAI"
print("name" in state)      # True
print(state.to_dict())      # {"key": "value", "name": "FlowgentraAI"}
print(state.to_json())      # JSON string

# From/to JSON
state = SharedState.from_json('{"a": 1}')
state = SharedState.from_dict({"a": 1})

Agent

from flowgentra_ai import Agent, AgentConfig

# From config file
agent = Agent.from_config_path("config.yaml")

# From config object
config = AgentConfig.from_file("config.yaml")
agent = Agent.from_config(config)

# Run
result = agent.run()

# Run with thread (checkpointing)
result = agent.run_with_thread("thread-123")

LLM Types

from flowgentra_ai import LLMConfig, Message, TokenUsage

# LLM config
config = LLMConfig("openai", "gpt-4", api_key="sk-...")

# Messages
msg = Message.system("You are a helpful assistant")
msg = Message.user("What is Rust?")
msg = Message.assistant("Rust is a systems language")
msg = Message.tool("result", tool_call_id="call_123")

# Token usage & cost
usage = TokenUsage(1000, 500)
cost = usage.estimated_cost("gpt-4")

RAG Utilities

from flowgentra_ai import Document, chunk_text, extract_text, estimate_tokens

# Documents
doc = Document("doc-1", "Hello world", {"source": "example"})

# Text chunking
chunks = chunk_text("long text...", chunk_size=500, overlap=50)

# PDF extraction
text = extract_text("document.pdf")

# Token estimation
tokens = estimate_tokens("some text")

Model Pricing

from flowgentra_ai import model_pricing

pricing = model_pricing("gpt-4")  # (30.0, 60.0) per million tokens

Project details


Download files

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

Source Distribution

flowgentra_ai-0.1.2.tar.gz (74.6 kB view details)

Uploaded Source

Built Distributions

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

flowgentra_ai-0.1.2-cp313-cp313-win_amd64.whl (4.8 MB view details)

Uploaded CPython 3.13Windows x86-64

flowgentra_ai-0.1.2-cp313-cp313-manylinux_2_39_x86_64.whl (7.8 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.39+ x86-64

flowgentra_ai-0.1.2-cp313-cp313-manylinux_2_39_aarch64.whl (7.7 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.39+ ARM64

flowgentra_ai-0.1.2-cp313-cp313-macosx_11_0_arm64.whl (5.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

flowgentra_ai-0.1.2-cp313-cp313-macosx_10_12_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

flowgentra_ai-0.1.2-cp312-cp312-manylinux_2_39_x86_64.whl (7.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ x86-64

flowgentra_ai-0.1.2-cp311-cp311-manylinux_2_39_x86_64.whl (7.8 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.39+ x86-64

flowgentra_ai-0.1.2-cp310-cp310-manylinux_2_39_x86_64.whl (7.8 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.39+ x86-64

flowgentra_ai-0.1.2-cp39-cp39-manylinux_2_39_x86_64.whl (7.8 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.39+ x86-64

File details

Details for the file flowgentra_ai-0.1.2.tar.gz.

File metadata

  • Download URL: flowgentra_ai-0.1.2.tar.gz
  • Upload date:
  • Size: 74.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for flowgentra_ai-0.1.2.tar.gz
Algorithm Hash digest
SHA256 5715cfc8f4a8df65b76c1578bf2b906dbff413bc6806ea938b33f556fed702ca
MD5 f146393dcc55640997c8ad1115728706
BLAKE2b-256 aa7f3df7331ab6f1c8db7877705928d22031cb40eb73c407a1af5e04e2f413e7

See more details on using hashes here.

Provenance

The following attestation bundles were made for flowgentra_ai-0.1.2.tar.gz:

Publisher: publish.yml on oussamabenhariz/flowgentra-ai-py

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

File details

Details for the file flowgentra_ai-0.1.2-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for flowgentra_ai-0.1.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 0fbc392d3133d2d901bf75613ec9b0c0df9ef06a90384c99acd0ff51b64d36bc
MD5 0a97e4d8cd04536ccbc81b0ef9b0c6c5
BLAKE2b-256 d27a683f2ea94df86f2031d96068a96f4cb7fccc2b46b08d819a7ba138733818

See more details on using hashes here.

Provenance

The following attestation bundles were made for flowgentra_ai-0.1.2-cp313-cp313-win_amd64.whl:

Publisher: publish.yml on oussamabenhariz/flowgentra-ai-py

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

File details

Details for the file flowgentra_ai-0.1.2-cp313-cp313-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for flowgentra_ai-0.1.2-cp313-cp313-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 2f6eb43db555834ad81aad5ee7ba54f61e883b6b7f37911c8209dd5afaeb5d04
MD5 45e68ed968f0284c64e664be2bc76d42
BLAKE2b-256 eb4a8d761d9a48accd7a6b45429b57070ceb6276828c8acec9c20a60d666b3a6

See more details on using hashes here.

Provenance

The following attestation bundles were made for flowgentra_ai-0.1.2-cp313-cp313-manylinux_2_39_x86_64.whl:

Publisher: publish.yml on oussamabenhariz/flowgentra-ai-py

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

File details

Details for the file flowgentra_ai-0.1.2-cp313-cp313-manylinux_2_39_aarch64.whl.

File metadata

File hashes

Hashes for flowgentra_ai-0.1.2-cp313-cp313-manylinux_2_39_aarch64.whl
Algorithm Hash digest
SHA256 bb5b1023d8d8e7892748c0d803c8fac50cfc12f167b1f9b1f6ab26a1d4685625
MD5 5a60f937c0c9b9f02f2224e0b7fb96ff
BLAKE2b-256 40abb80979175f8889a8a5e176ca0473e1eb39e24706cbad20d929aea75291ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for flowgentra_ai-0.1.2-cp313-cp313-manylinux_2_39_aarch64.whl:

Publisher: publish.yml on oussamabenhariz/flowgentra-ai-py

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

File details

Details for the file flowgentra_ai-0.1.2-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for flowgentra_ai-0.1.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 541dfb9ba2c7fcc1560bab5b8942e1f0c9aacc616c9804061204ff932c097e0e
MD5 93e2bf1a625a25e64c20d52669ee5a59
BLAKE2b-256 a3925e68784072ed89ee8ff3d2a395bb1680aa8cc8e61daeb356fe7eb041dcaa

See more details on using hashes here.

Provenance

The following attestation bundles were made for flowgentra_ai-0.1.2-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: publish.yml on oussamabenhariz/flowgentra-ai-py

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

File details

Details for the file flowgentra_ai-0.1.2-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for flowgentra_ai-0.1.2-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c02105886110087b83b025d36ca55f215899579c90cdf16bdcd077523d427fdb
MD5 1c91aaa2562a640d1be02572be5b7e3b
BLAKE2b-256 fcf7b93abc4e20df5ed5634b93437ecf44ae14fcbcdce0025ab3211f5431804f

See more details on using hashes here.

Provenance

The following attestation bundles were made for flowgentra_ai-0.1.2-cp313-cp313-macosx_10_12_x86_64.whl:

Publisher: publish.yml on oussamabenhariz/flowgentra-ai-py

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

File details

Details for the file flowgentra_ai-0.1.2-cp312-cp312-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for flowgentra_ai-0.1.2-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 00c71a1e3d52f1d4ef4e39dd52de9aba558feba2c649882cba5d425353e2da91
MD5 d0174318a7b8b3b015a54a04e7c03f9e
BLAKE2b-256 62d3fe61c97a90640e8239fee4ffe39c682f0638ff56460debe1186719237c81

See more details on using hashes here.

Provenance

The following attestation bundles were made for flowgentra_ai-0.1.2-cp312-cp312-manylinux_2_39_x86_64.whl:

Publisher: publish.yml on oussamabenhariz/flowgentra-ai-py

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

File details

Details for the file flowgentra_ai-0.1.2-cp311-cp311-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for flowgentra_ai-0.1.2-cp311-cp311-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 60f9615c8b3357b9f92694323fdd57055fc8ed458577447833e19cc8d6b2d8cd
MD5 d012eb3b055fdc87d1f4c14d5c50a472
BLAKE2b-256 12abbb2d0d24d8cec0850d10d3a9934e3b25a0ab793d0ae9546472a8134063a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for flowgentra_ai-0.1.2-cp311-cp311-manylinux_2_39_x86_64.whl:

Publisher: publish.yml on oussamabenhariz/flowgentra-ai-py

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

File details

Details for the file flowgentra_ai-0.1.2-cp310-cp310-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for flowgentra_ai-0.1.2-cp310-cp310-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 53e61e3d0770558cc8b374e451ccf407e0ad0a93a7074c91d497f8408b3e8215
MD5 0c047fcbebf0ac754179bb917bbe7378
BLAKE2b-256 27b91cead02c111d5ed7a0a4f7d369904d6b5d09ecc53f80966a7f6e01e9e494

See more details on using hashes here.

Provenance

The following attestation bundles were made for flowgentra_ai-0.1.2-cp310-cp310-manylinux_2_39_x86_64.whl:

Publisher: publish.yml on oussamabenhariz/flowgentra-ai-py

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

File details

Details for the file flowgentra_ai-0.1.2-cp39-cp39-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for flowgentra_ai-0.1.2-cp39-cp39-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 50ce9fd844ca75d0de4f1d2bb557e86727f53c2c53dc02a028bfd4e2b88b2df0
MD5 04be43c5ba4a6b029c30de7f5999433c
BLAKE2b-256 ca41289471c21e2b114de0a2ebca8a985d419d0ed39631665c29c29fdf45c225

See more details on using hashes here.

Provenance

The following attestation bundles were made for flowgentra_ai-0.1.2-cp39-cp39-manylinux_2_39_x86_64.whl:

Publisher: publish.yml on oussamabenhariz/flowgentra-ai-py

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