Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Flame Python SDK

Python SDK for the Flame, a distributed system for Agentic AI.

For the user guide, see Flame Python SDK. For the detailed API surface, see API.md.

Installation

pip install flamepy

Quick Start

import flamepy

def main():
    # Create a session with the application, e.g. Agent
    session = flamepy.create_session("flmping")
    
    # Create and run a task
    resp = session.run(b"task input data")

    # Handle the output of task
    print(resp)

    # Close session
    session.close()

if __name__ == "__main__":
    main()

Verify an App Cluster

After configuring ~/.flame/flame.yaml for a running cluster with session manager, object cache, executor manager, and the flmrun template application, run:

uv run --project e2e python -m e2e.app

Run the command from the repository root. The check packages a tiny temporary project and verifies App function calls, ObjectFuture chaining, and a stateful instance service. Use --json for machine-readable output and --python-version 3.12 to verify a specific executor Python runtime.

For application services, initialize the process-wide application before importing modules that declare services:

import flamepy.app as app

app.init("my-app")

# my_project.services declares services with @app.service().
from my_project import services  # noqa: E402

result = services.run("input")
app.destroy()

API Reference

Session

Represents a computing session with application, e.g. Agent, Tools.

# Create a session
session = flamepy.create_session("my-app")

# Close a session
session.close()

Task

Represents individual computing tasks within a session.

from concurrent.futures import wait

# Run a task synchronously (blocks until complete)
result = session.run(b"input data")

# Submit multiple tasks without waiting for each CreateTask response
futures = [session.submit(f"input {i}".encode()) for i in range(10)]
wait(futures)  # Wait for all tasks to complete
results = [f.result() for f in futures]

# Create a task and get task object
task = session.create_task(b"input data")

# Get task status
task = session.get_task(task.id)

# Watch task progress
for update in session.watch_task(task.id):
    print(f"Task state: {update.state}")
    if update.is_completed():
        break

Error Handling

The SDK provides custom exception types for different error scenarios:

from flamepy import FlameError, FlameErrorCode

try:
    session = flamepy.create_session("flmping")
except FlameError as e:
    if e.code == FlameErrorCode.INVALID_CONFIG:
        print("Configuration error:", e.message)
    elif e.code == FlameErrorCode.INVALID_STATE:
        print("State error:", e.message)

Development

To set up the development environment:

# Clone the repository
git clone https://github.com/xflops/flame.git
cd flame/sdk/python

# Install in development mode
# Note: Use --no-build-isolation if you have setuptools>=61.0 installed
python3 -m pip install -e . --user --no-build-isolation

# Or build and install the wheel
python3 -m build --wheel --no-isolation
python3 -m pip install dist/flamepy-0.7.0rc3-py3-none-any.whl --user

# Install development dependencies
pip install -e .[dev]

# Run tests
pytest

# Format code
ruff format

# Type checking
mypy flamepy/

Requirements

  • Python >= 3.9
  • setuptools >= 61.0 (for building from source)

Troubleshooting

If you encounter issues with the package name showing as "UNKNOWN":

  1. Make sure you have setuptools>=61.0 installed:

    python3 -m pip install --user --upgrade "setuptools>=61.0"
    
  2. Clean any stale build artifacts:

    rm -rf dist build src/flamepy.egg-info *.egg-info
    
  3. Use --no-build-isolation flag when installing:

    python3 -m pip install . --user --no-build-isolation
    

Metadata

Release files for flamepy 0.7.0rc3

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

Source distribution (sdist)

Source distribution for flamepy 0.7.0rc3
File Size Uploaded Provenance Actions
flamepy-0.7.0rc3.tar.gz 126.3 kB Without provenance Details for flamepy-0.7.0rc3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for flamepy 0.7.0rc3
File Interpreter ABI Platform Actions
flamepy-0.7.0rc3-py3-none-any.whl Python 3 none any Details for flamepy-0.7.0rc3-py3-none-any.whl

Total release size: 231.8 kB

Release files / flamepy-0.7.0rc3.tar.gz

Download URL flamepy-0.7.0rc3.tar.gz
Size 126.3 kB
Tags Source
SHA-256 checksum
How to use checksums
405703d57c05031b5853c24c072e17c5693041fdf4359533b08f48e5cc2a0a53
BLAKE2b-256 checksum
How to use checksums
20873d7a769cf563fe341a7ba341f26a87d1e79c5c331685d5158e9ef291ab27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / flamepy-0.7.0rc3-py3-none-any.whl

Download URL flamepy-0.7.0rc3-py3-none-any.whl
Size 105.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7274d0082954fb70c0cebfb0feb8bdef396c407fc96374478bf20eb48ac4d194
BLAKE2b-256 checksum
How to use checksums
a0d0cc24f9ddabf5051c922705a62a9e12c90c25f22f218ec93e78f857dad6ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for flamepy 0.7.0rc3

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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