A Python framework for building AI agents with advanced orchestration capabilities
Project description
nFactorial
Factorial is a Python framework for reliably running high-concurrency agents asynchronously. It's designed for production workloads where you need to process thousands of agent tasks concurrently with built-in retries, monitoring, and distributed execution.
Features
- Distributed execution: Run agents across multiple workers and machines with Redis-based coordination
- Fault tolerance: Automatic retries, backoff strategies, and recovery of dropped tasks from crashed workers
- Real-time events: Stream progress updates and results via WebSocket or Redis pub/sub
- In-flight agent task management: Cancel, steer, and monitor running tasks
- Observability: Built-in metrics dashboard and comprehensive logging
- Deferred tools: Support for long-running operations that complete outside the agent execution
Installation
pip install nfactorial
Quick Start
from factorial import Agent, Orchestrator, gpt_41
# Define tools
tools = [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather",
"parameters": {
"type": "object",
"properties": {
"location": {"type": "string"},
},
"required": ["location"],
},
},
}
]
# Define tool actions
def get_weather(location: str) -> str:
return f"The weather in {location} is sunny and 72°F"
# Create agent
agent = Agent(
instructions="You help users get weather information.",
model=gpt_41,
tools=tools,
tool_actions={"get_weather": get_weather},
)
# Create orchestrator
orchestrator = Orchestrator()
orchestrator.register_runner(
agent=agent,
agent_worker_config=AgentWorkerConfig(workers=30),
)
# Run the system
if __name__ == "__main__":
orchestrator.run()
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 nfactorial-0.1.0.tar.gz.
File metadata
- Download URL: nfactorial-0.1.0.tar.gz
- Upload date:
- Size: 40.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
807ea29a28105bf08f61dea2c094966950198355b5bf1da3d0b9ce0e5ab766a9
|
|
| MD5 |
97ee0ec05d915b9dc5fe02a1bd776b60
|
|
| BLAKE2b-256 |
88b3384f590bbe8fc25126866735550b66a944011924db6985ee6af2ac10eb18
|
File details
Details for the file nfactorial-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nfactorial-0.1.0-py3-none-any.whl
- Upload date:
- Size: 43.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a29511afa911d4351f2612aa9e4fe6d7ce4c8c5266e3704e17c52b188b6ae465
|
|
| MD5 |
7d9b0b317264b6fa3f474cb35685886a
|
|
| BLAKE2b-256 |
69e0d74d5e36e8604222e187dcb36e6a45d08fb5620aaadff87d42c527539f38
|