Python SDK for Flame, a distributed system for Agentic AI
Project description
Flame Python SDK
Python SDK for the Flame, a distributed system for Agentic AI.
Installation
pip install flamepy
Quick Start
import asyncio
import flamepy
async def main():
# Create a session with the application, e.g. Agent
session = await flamepy.create_session("flmping")
# Create and run a task
resp = await session.invoke(b"task input data")
# Handle the output of task
print(resp.output)
# Close session
await session.close()
if __name__ == "__main__":
asyncio.run(main())
API Reference
Session
Represents a computing session with application, e.g. Agent, Tools.
# Create a session
session = await flamepy.create_session("my-app")
# Close a session
await session.close()
Task
Represents individual computing tasks within a session.
# Create a task
task = await session.invoke(b"input data")
# Get task status
task = await session.get_task(task.id)
# Watch task progress
async 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 = await 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
pip install -e .[dev]
# Run tests
pytest
# Format code
black flamepy/
isort flamepy/
# Type checking
mypy flamepy/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flamepy-0.5.0.tar.gz.
File metadata
- Download URL: flamepy-0.5.0.tar.gz
- Upload date:
- Size: 23.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26560d0bca3323c0ba2bf25bb3526ac683799171e6532bc31da2cf76bfd8fe85
|
|
| MD5 |
5ce0a11a8fe564a69bb063c767b32a28
|
|
| BLAKE2b-256 |
ce385102bf91396a52151d296337e17c7fad06d817e18898ce4f7f3a29a23f21
|
File details
Details for the file flamepy-0.5.0-py3-none-any.whl.
File metadata
- Download URL: flamepy-0.5.0-py3-none-any.whl
- Upload date:
- Size: 27.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6a4272102a3a061c05b007016ee3c1fef79169995afe1ab59b82bdbadb69428
|
|
| MD5 |
1c4d7fa90eeb8410f1d79e3125f4e91e
|
|
| BLAKE2b-256 |
1707af6da7fc18016ac4ff9eea93f0a9b60c3a6156c60080a115ed0d21b83912
|