Skip to main content

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 classes with @step methods that transition via Goto, Spawn (parallel children), or return a result
  • Persistent stateScalar[T] and AppendOnlyList[T] with incremental dirty-tracking and pluggable storage (in-memory, file-based, or custom)
  • Tool integration@tool decorator for local functions, MCP server support, DI into tool handlers
  • LLM abstraction — provider-agnostic LLMProvider interface with immutable message types (ships AnthropicVertexProvider, GoogleVertexProvider, OpenAIProvider)
  • Cooperative interruptsInterruptToken for graceful cancellation across the entire execution tree
  • Pre-built agentsChatAgent (multi-turn chat with session history) and ToolLoopAgent (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, step=ChatAgent.process_message,
                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, Goto, Spawn, 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

  • Architecture — package structure and data flow
  • LLM — message types, provider interface
  • Tools — tool definition and execution
  • Agent — state machine framework
  • Runtime — execution engine and persistence
  • Lib — pre-built agents, hooks, caching

Project details


Release history Release notifications | RSS feed

This version

0.0.1

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.1.tar.gz (221.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flowra-0.0.1-py3-none-any.whl (73.9 kB view details)

Uploaded Python 3

File details

Details for the file flowra-0.0.1.tar.gz.

File metadata

  • Download URL: flowra-0.0.1.tar.gz
  • Upload date:
  • Size: 221.6 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

Hashes for flowra-0.0.1.tar.gz
Algorithm Hash digest
SHA256 fdab2f508b4325595df0d74b3fa30e904e70c96990f8fea4a4da247730379549
MD5 dad59e0edacf78a851517988ba0ae296
BLAKE2b-256 97ef192c37f4ffffc85a0d6870d82b1c7040bfcb9d007ecca7323e751074420d

See more details on using hashes here.

File details

Details for the file flowra-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: flowra-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 73.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

Hashes for flowra-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b857829b3c8a440a043c98e31dc59646c91397f0e514b45acab807441dc7f350
MD5 75d28a8ff99c6ff227c323cb91ec4133
BLAKE2b-256 d08e1d7ff601eff12f8342708a5cc438aa40d85de772965c0e1df37252405340

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page