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.lib.chat import ChatAgent, ChatConfig, ChatResult, ChatSpec
from flowra.lib import LLMConfig
from flowra.llm import LLMProvider, SystemMessage, TextBlock
from flowra.llm.providers.anthropic_vertex import AnthropicVertexProvider
from flowra.runtime import AgentRuntime
from flowra.tools import ToolRegistry
async def main() -> None:
provider = AnthropicVertexProvider()
async with await ToolRegistry.create([]) as registry:
config = ChatConfig(
llm_config=LLMConfig(model="claude-sonnet-4-5@20250929"),
system_messages=[
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/ # State machine framework (@step, Agent[S,R], stored values)
├── runtime/ # Execution engine, persistence, interrupt support
└── lib/ # Pre-built agents (ChatAgent, ToolLoopAgent, hooks, caching)
See docs/architecture.md for the full dependency graph and
data flow. Each package has its own documentation in docs/.
Development
make deps # install dependencies (uv sync)
make check # lint + test
make chat # run interactive console chat example
Documentation
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 flowra-0.0.7.tar.gz.
File metadata
- Download URL: flowra-0.0.7.tar.gz
- Upload date:
- Size: 266.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","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 |
87e775f5416492fca4913c8d5c958d0b7a363191ec9685493661c5d06f26c412
|
|
| MD5 |
3565700939fac34f485546166b5e1dd3
|
|
| BLAKE2b-256 |
900125abfb8038695f168a3ad221af036de8f299c82df477c7e325b64136d93a
|
File details
Details for the file flowra-0.0.7-py3-none-any.whl.
File metadata
- Download URL: flowra-0.0.7-py3-none-any.whl
- Upload date:
- Size: 84.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","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 |
328e7b98456513694711e203c6db837c5997a86198752fb713abc6d5a7197cb3
|
|
| MD5 |
501adf92898eabf9183461835e03dbc2
|
|
| BLAKE2b-256 |
9dcd64ac0d82faa4abf36853e1e8a23ba0344e376b03220a5a1fc86e2e4a582f
|