Flowra — flow infrastructure for building stateful LLM agents
Project description
Flowra
Flow infra for building stateful, persistent LLM agents with tool use, parallel execution, and crash recovery. Requires Python 3.12+.
Features
- State machine agents — define agents as
Agent[Spec, Result]classes with@stepmethods, a single entry point, and typed spec/result contracts - Persistent state —
Scalar[T]andAppendOnlyList[T]with incremental dirty-tracking and pluggable storage (in-memory, file-based, or custom) - Tool integration —
@tooldecorator for local functions, MCP server support, DI into tool handlers, agents as tools for LLM-driven delegation - LLM abstraction — provider-agnostic
LLMProviderinterface with immutable message types and real-time streaming (shipsAnthropicVertexProvider,GoogleVertexProvider,OpenAIProvider) - Agents as tools —
@agent_tooldecorator exposes an agent as a tool the LLM can call autonomously; sub-agent runs its own system prompt and tool loop - Cooperative interrupts —
InterruptTokenfor graceful cancellation across the entire execution tree - Pre-built agents —
ChatAgent(multi-turn chat with session history) andToolLoopAgent(single-turn LLM tool loop with hooks and caching)
Installation
# Base package (no LLM providers)
pip install flowra
# With specific providers
pip install flowra[anthropic]
pip install flowra[openai]
pip install flowra[google]
# All providers
pip install flowra[all]
Quick start
import asyncio
from flowra.agent import AgentRuntime
from flowra.lib import LLMConfig
from flowra.lib.chat import ChatAgent, ChatConfig, ChatResult, ChatSpec
from flowra.llm import LLMProvider, SystemMessage, TextBlock
from flowra.llm.providers.anthropic_vertex import AnthropicVertexProvider
from flowra.tools import ToolRegistry
async def main() -> None:
async with (
AnthropicVertexProvider() as provider,
await ToolRegistry.create([]) as registry,
):
config = ChatConfig(
llm_config=LLMConfig(model="claude-sonnet-4-5@20250929"),
system=[SystemMessage(blocks=[TextBlock(text="You are a helpful assistant.")])],
)
runtime = AgentRuntime(
agents={"chat": ChatAgent},
services={LLMProvider: provider, ToolRegistry: registry, ChatConfig: config},
)
while True:
user_input = input("You: ")
if not user_input:
break
result = await runtime.run(agent=ChatAgent, spec=ChatSpec(user_message=user_input))
if isinstance(result, ChatResult) and result.response:
print(f"Assistant: {result.response}")
asyncio.run(main())
Package structure
flowra/
├── llm/ # LLM abstraction (messages, blocks, provider interface)
├── tools/ # Tool definition, registration, execution
├── agent/ # Agent framework + execution engine + persistence
└── lib/ # Pre-built agents (ChatAgent, ToolLoopAgent, hooks, caching)
Documentation
- Getting Started — from installation to a working chatbot with tools in 5 minutes
- Working with LLMs — providers, streaming, structured output, caching, extended thinking
- Tools — tool groups, MCP servers, service injection
- Agents — custom agents, state machines, control flow, parallel execution
- Patterns — multi-agent patterns: router, pipeline, race, fan-out
- Observability — hooks, spans, MLflow and OTel integrations
Development
make deps # install dependencies (uv sync)
make check # lint + test
make chat # run interactive console chat example
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
flowra-0.0.23.dev31.tar.gz
(452.2 kB
view details)
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
flowra-0.0.23.dev31-py3-none-any.whl
(112.7 kB
view details)
File details
Details for the file flowra-0.0.23.dev31.tar.gz.
File metadata
- Download URL: flowra-0.0.23.dev31.tar.gz
- Upload date:
- Size: 452.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8e0cac5c5f141a3c3c6426a7997ed1c3f3d939903da13c34bf674d2695ca762
|
|
| MD5 |
651a7a819f084a4c1e84f64c49992739
|
|
| BLAKE2b-256 |
e69c8e1bd3fba75bd7b811f9d3b38f4d68f2ff3f061955237be564846bb60c7d
|
File details
Details for the file flowra-0.0.23.dev31-py3-none-any.whl.
File metadata
- Download URL: flowra-0.0.23.dev31-py3-none-any.whl
- Upload date:
- Size: 112.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
488f8f0122dfa253b68ca591dc6f78e893433084688fee5252fa39933dbfc068
|
|
| MD5 |
47784758fc9209a9544c90a14d53ecb0
|
|
| BLAKE2b-256 |
d8cb4680311a9b9350ebd75900ac0d33bc4195749dccb8899b6f9fb136f22e2a
|