FlowFoundry: a strategy-first, cloud-agnostic agentic workflow framework (LangGraph/LangChain)
Project description
FlowFoundry
A strategy-first, cloud-agnostic framework for LLM workflows.
Compose chunking, indexing, retrieval, reranking, and agentic flows — with Keras-like ergonomics over LangChain / LangGraph.
✨ Features
- Strategies: chunking, indexing, retrieval, reranking
- Functional API: call strategies directly as Python functions
- Blocks API: compose strategies like layers
- Nodes & Graphs: LangGraph-backed workflows (YAML or Python)
- Extensible: register custom strategies or nodes
Installation
Core only:
pip install flowfoundry
With extras:
pip install "flowfoundry[rag,search,rerank,qdrant,openai,llm-openai]"
Extras include: chromadb, qdrant-client, sentence-transformers, rank-bm25, openai, etc. All examples run offline by default (echo LLM). Missing deps no-op gracefully.
Sanity check:
from flowfoundry import ping, hello
print(ping()) # -> "flowfoundry: ok"
print(hello("there")) # -> "hello, there!"
Quickstart (Functional API)
from flowfoundry.functional import (
chunk_recursive, index_chroma_upsert, index_chroma_query, preselect_bm25
)
text = "FlowFoundry lets you mix strategies to build RAG."
chunks = chunk_recursive(text, chunk_size=120, chunk_overlap=20, doc_id="demo")
# Index & query (requires chromadb extra)
index_chroma_upsert(chunks, path=".ff_chroma", collection="docs")
hits = index_chroma_query("What is FlowFoundry?", path=".ff_chroma", collection="docs", k=8)
# Optional rerank (requires rank-bm25)
hits = preselect_bm25("What is FlowFoundry?", hits, top_k=5)
print(hits[0]["text"])
CLI
All registered strategies are available via the flowfoundry CLI.
Run:
# list families and functions
flowfoundry list
# call a strategy directly
flowfoundry chunking fixed --kwargs '{"data":"hello world","chunk_size":5}'
# equivalent generic call
flowfoundry call chunking fixed --kwargs '{"data":"hello world","chunk_size":5}'
Functional API Reference
Available in flowfoundry.functional:
Chunking
| Function | Purpose | Extra deps |
|---|---|---|
chunk_fixed |
Fixed-size splitter | – |
chunk_recursive |
Recursive splitter | langchain-text-splitters |
chunk_hybrid |
Hybrid splitter | – |
chunk_fixed(text, *, chunk_size=800, chunk_overlap=80, doc_id="doc") -> list[Chunk]
chunk_recursive(text, *, chunk_size=800, chunk_overlap=80, doc_id="doc") -> list[Chunk]
chunk_hybrid(text, **kwargs) -> list[Chunk]
Indexing (Chroma)
| Function | Purpose | Extra deps |
|---|---|---|
index_chroma_upsert |
Upsert chunks into Chroma | chromadb |
index_chroma_query |
Query Chroma | chromadb |
index_chroma_upsert(chunks, *, path=".ff_chroma", collection="docs") -> str
index_chroma_query(query, *, path, collection, k=5) -> list[Hit]
Reranking
| Function | Purpose | Extra deps |
|---|---|---|
rerank_identity |
No-op reranker | – |
preselect_bm25 |
BM25 preselect | rank-bm25 |
rerank_cross_encoder |
Cross-encoder reranker | sentence-transformers |
rerank_identity(query, hits, top_k=None) -> list[Hit]
preselect_bm25(query, hits, top_k=20) -> list[Hit]
rerank_cross_encoder(query, hits, *, model, top_k=None) -> list[Hit]
Composition (LLM Answering)
| Function | Purpose | Providers supported | Extra deps |
|---|---|---|---|
compose_llm |
Generate an answer from hits via an LLM | openai, ollama, huggingface, langchain | provider-specific |
compose_llm(
question: str,
hits: list[Hit],
*,
provider: str, # "openai", "ollama", "huggingface", "langchain"
model: str, # e.g. "gpt-4o-mini", "llama3:8b", "distilgpt2"
max_context_chars=6000,
max_tokens=512,
reuse_provider=True,
**provider_kwargs # api_key, host, backend, device, etc.
) -> str
Example Code:
from flowfoundry import index_chroma_query, preselect_bm25, compose_llm
question = "What is people's budget?"
hits = index_chroma_query(question, path=".ff_chroma", collection="docs", k=8)
hits = preselect_bm25(question, hits, top_k=5)
# OpenAI provider
answer = compose_llm(
question, hits,
provider="openai",
model="gpt-4o-mini",
max_tokens=400,
)
print(answer)
# Ollama provider
answer = compose_llm(
question, hits,
provider="ollama",
model="llama3:8b",
host="http://localhost:11434",
max_tokens=400,
)
print(answer)
# HuggingFace local transformers
answer = compose_llm(
question, hits,
provider="huggingface",
model="distilgpt2",
max_tokens=200,
)
print(answer)
Example (CLI)
Save retrieval hits into JSON first, then pass them to compose_llm:
Step 1: query (Chroma)
flowfoundry indexing chroma_query \
--kwargs '{"query":"What is people'\''s budget?","path":".ff_chroma","collection":"docs","k":8}' > hits.json
Step 2: rerank (BM25)
flowfoundry rerank bm25_preselect \
--kwargs "{\"query\":\"What is people's budget?\",\"hits\":$(cat hits.json),\"top_k\":5}" > hits_top5.json
Step 3: compose answer with OpenAI
export OPENAI_API_KEY=...
flowfoundry compose llm \
--kwargs "{\"question\":\"What is people's budget?\",\"hits\":$(cat hits_top5.json),\"provider\":\"openai\",\"model\":\"gpt-4o-mini\",\"max_tokens\":400}"
```1
Project details
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 flowfoundry-1.1.0.tar.gz.
File metadata
- Download URL: flowfoundry-1.1.0.tar.gz
- Upload date:
- Size: 25.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d452189326e364ec1253a406485bf30bbcbcab378bac3c0b62604602d8c072a
|
|
| MD5 |
3fb009c4001ec4e8bed560a5caf69e4e
|
|
| BLAKE2b-256 |
658b71f22fc011d9aff7bb327b06c5ad4cf9957758b9508a3b13b219b2c3a6a8
|
File details
Details for the file flowfoundry-1.1.0-py3-none-any.whl.
File metadata
- Download URL: flowfoundry-1.1.0-py3-none-any.whl
- Upload date:
- Size: 31.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8f18fb8653f3acca03ef354eb2dbdfb42ef756cdbc80b4e241d23d47e9c6d0d
|
|
| MD5 |
0786c9d8112aba522d019b11bb57e7f6
|
|
| BLAKE2b-256 |
1f178bc20224053c7893754c225572c261cd58ed97061316085436990add356e
|