Frank brings order and helps you build complex LLM workflows using scalable, testable, and reusable components.
Project description
๐ง Frankenst-AI | LangGraph Patterns
Frankenst-AI is a project that introduces a modular and scalable structure based on design patterns and coding best practices, applied to LangGraph.
It is not a framework that replaces LangGraph. It is a reusable project layer that helps you organize components, layouts and runtime assembly so you can build LangGraph workflows with less duplication and stronger boundaries.
This project aims to improve scalability, reusability, testability, and maintainability through reusable, configurable, and highly decoupled components designed to assemble complex LLM workflows.
By leveraging a well-organized structure, the project enables the creation of composable and extensible AI systems (agent patterns, RAG patterns, MCPs, etc.) while still returning official LangGraph graphs at the end of the build process.
The project has been designed with the following goals:
-
Isolated logic and separation of concerns between conditional edges, nodes, tools, and runnables, encapsulated as reusable and independent components.
-
Key components like StateEnhancer, StateCommander, and StateEvaluator are designed to be reused across multiple workflows.
-
Use of YAML, centralized configurations, and explicit layout classes managed with builders and managers to define, modify, and scale different graph architectures without duplicating logic.
How Frankenst-AI Maps to LangGraph
Frankenst-AI keeps the official LangGraph runtime model and adds a small layer of project-specific naming around it:
- StateEnhancer wraps the async node callable that reads the current state and returns a partial update.
- StateEvaluator wraps the callable passed to conditional edges and returns the routing key used in the path map.
- StateCommander wraps nodes that return an official LangGraph
Commandwhen routing and state updates must happen in the same step.
These names are project abstractions, but the compiled graph still relies on
StateGraph, add_node(), add_edge(), add_conditional_edges() and
Command from LangGraph.
In other words, Frankenst-AI helps you structure and assemble LangGraph workflows; it does not introduce a separate graph runtime.
Runtime Support
Frankstate currently supports LangGraph as its implemented workflow runtime.
The abstractions in this repository are intentionally being shaped so they can grow beyond a single runtime, and Microsoft Agent Framework is a planned future integration direction. That future support does not exist yet in the published package, examples or tests.
Frankstate Public API
The root package frankstate intentionally exposes only one shortcut:
from frankstate import WorkflowBuilder
That root import is reserved for the main assembly entrypoint.
All other reusable contracts should be imported from their concrete modules,
not from frankstate.__init__. For example:
from frankstate.entity.graph_layout import GraphLayout
from frankstate.entity.node import SimpleNode, CommandNode
from frankstate.entity.edge import SimpleEdge, ConditionalEdge
from frankstate.entity.statehandler import StateEnhancer, StateEvaluator, StateCommander
from frankstate.entity.runnable_builder import RunnableBuilder
from frankstate.managers.node_manager import NodeManager
from frankstate.managers.edge_manager import EdgeManager
This keeps frankstate root stable and prevents it from turning into an absolute import bucket for every internal type.
Repository Shape
This mono-repo has four layers with different responsibilities:
src/frankstateis the reusable pattern layer. It contains the assembly utilities and contracts used to structure LangGraph projects with consistent design rules.src/core_examplesis the repository's importable reference package. It demonstrates one concrete way to organize layouts, state models, components, YAML configuration and prompt assets on top offrankstate.src/servicesis the service and integration layer. It contains runtime-specific entrypoints such as MCP servers, Azure Functions handlers and shared provider adapters used by the repository.researchis exploratory material. The notebooks are useful to understand how layouts are compiled and exercised, but they are not part of the project's contractual surface.
src/core_examples is supported as the repository reference package, but it is not the stable public API of the published base frankstate wheel. src/services is repository integration code, not an extension of the frankstate public API.
The published base wheel intentionally contains only frankstate. core_examples and services remain repository-level layers with different responsibilities.
If you are evaluating or reusing Frankenst-AI, start with src/frankstate, then move to src/core_examples for the concrete reference package, and only read src/services when you need repository runtime entrypoints or shared provider adapters.
Prerequisites
- Python 3.12.3 or higher
- Ollama 0.20.2 or higher (free); or an Azure Foundry Deployment (payment)
- pip (Python package manager)
- uv (install with pip)
Installation
-
Clone the repository
-
Create a virtual environment:
python3 -m venv .venv -
Activate the virtual environment:
- On Windows:
.venv\Scripts\activate - On macOS and Linux:
source .venv/bin/activate
-
Install the project:
Published package from PyPI:
pip install frankstate
Published package with optional dependency profile:
pip install 'frankstate[examples]'
Local editable install from the repository:
python3 -m uv pip install -e .
Local editable install with examples and development dependencies:
python3 -m uv pip install -e '.[examples, dev]'
frankstateis both the distribution name used bypipand the public import surface:from frankstate import WorkflowBuilder
In this first public packaging phase, the published wheel still contains only
frankstate. Theexamplesextra adds optional dependencies used by the reference assets in this repository; it does not makecore_examplesorservicespart of the base installed wheel from PyPI. -
(Optional) Install system packages for the example extras:
sudo apt update sudo apt-get install poppler-utils sudo apt install tesseract-ocr
Running the Project Locally
To run the project locally:
-
Choose an LLM Services backend
Choose one of the following options:
1.1 Using a local model with Ollama
Start the Ollama service by running:
ollama run ministral-3:8b1.2 Using Azure AI Foundry Deployment
Configure your model variables in
.env:cp .env.example .env -
Compile Graph Layouts with WorkflowBuilder
The minimal example below uses the reference package under
src/core_examplesto show howsrc/frankstateis consumed in a real project.Reference layouts now follow a two-step contract:
build_runtime()resolves runtime dependencies such as LLM services, runnable builders, embeddings or retrievers.- The keys returned by
build_runtime()are projected onto the layout instance and must be declared as annotated attributes in the layout class. layout()declares nodes and edges using those already-resolved attributes on the layout instance.
This keeps imports side-effect free while preserving a declarative layout file.
In that example:
WorkflowBuilderis part of the reusable pattern insrc/frankstate.SimpleOakConfigGraphandSharedStateare concrete reference classes fromsrc/core_examples.- In your own project, those
src/core_examplesimports would be replaced by your own layouts and state schemas.
For exploratory examples and experimentation, refer to the
research/demo...ipynbnotebooks.
Minimal WorkflowBuilder Example
from frankstate import WorkflowBuilder
from core_examples.config.layouts.simple_oak_config_graph import SimpleOakConfigGraph
from core_examples.models.stategraph.stategraph import SharedState
workflow_builder = WorkflowBuilder(
config=SimpleOakConfigGraph,
state_schema=SharedState,
)
graph = workflow_builder.compile()
graph is still a LangGraph graph object produced through LangGraph's own runtime.
Running Tests
Use the root pytest entrypoint:
pytest -q
python -m pytest -q should behave the same way, but pytest -q is the canonical local and CI command.
Local Functions Apps Container
-
src/services/functions/function_app.pyis an Azure Functions App Containers packaging artifact. It is not a reusable Python module from the source tree and is expected to load only after the container build reshapes the filesystem under/home/site/wwwroot. -
Start your Function App Container recipes:
docker build <build args -> build-and-push-acr.yml> mylocalfunction:0.1 .
docker run -d -p 8080:80 mylocalfunction:0.1
docker logs <container_id>
- Docker deep debug recipes:
docker exec -it <container_id> /bin/bash
apt-get update
apt-get install azure-functions-core-tools-4
apt-get install azure-cli
cd /home/site/wwwroot
az login
func start --verbose
Repository Structure
frankenst-ai/
โโโ main.py # Local entry point to assemble and compile graph layouts
โโโ app.py # Optional deployment-facing wrapper entry point
โโโ requirements.txt # Aggregate dependency set for the full repository environment
โโโ requirements-*.txt # Dependency profiles split into base frankstate, example backends and dev
โโโ .env # Environment variables for local configuration; .env.example for reference
โโโ README.md # Main project documentation
โโโ src/
โ โโโ services/ # Service entrypoints plus shared provider adapters used by the repository
โ โโโ core_examples/ # Importable reference package showing how to structure a real LangGraph project using `frankstate`
โ โ โโโ components/
โ โ โ โโโ nodes/
โ โ โ โ โโโ enhancers/ # StateEnhancers for simple node logic modifying StateGraph via runnables or custom modules
โ โ โ โ โโโ commands/ # StateCommander for routing and modifying state through LangGraph commands
โ โ โ โโโ edges/
โ โ โ โ โโโ evaluators/ # StateEvaluator for conditional edge logic
โ โ โ โโโ tools/ # Tool definitions and integrations
โ โ โ โโโ retrievers/ # Retrievers definitions, builders and integrations
โ โ โ โโโ runnables/ # Executable LangChain RunnableBuilder modules for invoke or ainvoke logic
โ โ โโโ config/
โ โ โ โโโ config.yml # Main runtime configuration file for the project
โ โ โ โโโ config_nodes.yml # Node registry used by the example graph layouts
โ โ โ โโโ layouts/ # Reference GraphLayout subclasses using build_runtime() + layout()
โ โ โโโ constants/
โ โ โโโ models/ # Structural models: StateGraph, tool properties, structured outputs, etc.
โ โ โโโ utils/
โ โโโ frankstate/ # Frankstate utilities for assembling and compiling LangGraph
โ โโโ entity/
โ โ โโโ graph_layout.py # Base GraphLayout contract: build runtime first, then declare nodes and edges
โ โ โโโ runnable_builder.py # Builder class for LangChain Runnable objects
โ โ โโโ statehandler.py # Core entities for handling StateGraph
โ โ โโโ node.py # Core node-related entities
โ โ โโโ edge.py # Core edge-related entities
โ โโโ managers/
โ โโโ workflow_builder.py # Workflow Builder to compile LangGraph from GraphLayout subclasses
โโโ research/ # Exploratory notebooks and experiments; useful as reference
โโโ tests/
โ โโโ integration_test/
โ โโโ unit_test/
โโโ artifacts/ # Generated artifacts, static files and outputs
โโโ logs/ # Log files and runtime logs
Notes For Contributors
- Prefer adding documentation close to the contract it explains: docstrings in
src/frankstate, comments in YAML and examples in layout classes. - When a component reads or writes new state keys, document that change in the state schema and in the component docstring.
- Keep project abstractions aligned with official LangGraph terminology to avoid confusion in new layouts.
- Treat
src/core_examplesas the repository's reference package for the project's pattern andresearchas exploratory support material. - Treat
src/servicesas repository integration code, not as an extension of the publicfrankstateAPI.
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 frankstate-0.0.2.tar.gz.
File metadata
- Download URL: frankstate-0.0.2.tar.gz
- Upload date:
- Size: 20.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ac81b95216d9de7c567559df144642cb8c865f8bfaab95218119aa08231c8be
|
|
| MD5 |
69a6b8a52485c10edcca3c5a15916c7d
|
|
| BLAKE2b-256 |
ffb88740a2889aaea65691144def80beb7b61b8797844059f19777ecf81da39a
|
Provenance
The following attestation bundles were made for frankstate-0.0.2.tar.gz:
Publisher:
release.yml on EiinGeeeL/frankenst-ai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
frankstate-0.0.2.tar.gz -
Subject digest:
1ac81b95216d9de7c567559df144642cb8c865f8bfaab95218119aa08231c8be - Sigstore transparency entry: 1247127300
- Sigstore integration time:
-
Permalink:
EiinGeeeL/frankenst-ai@063bac1157eedaab1ce2704eb334926564383db2 -
Branch / Tag:
refs/tags/0.0.2 - Owner: https://github.com/EiinGeeeL
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@063bac1157eedaab1ce2704eb334926564383db2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file frankstate-0.0.2-py3-none-any.whl.
File metadata
- Download URL: frankstate-0.0.2-py3-none-any.whl
- Upload date:
- Size: 18.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2fe6c31723c17bef5949da38ab22f3bc664aec94c8239e275413747e07e468ba
|
|
| MD5 |
2b8fa87d4cd1900de96b3ffcdde8abe0
|
|
| BLAKE2b-256 |
373146466d11b07fb99ab0ccccc5a463acd15aa2a169a01c419d7a33b6a00ab6
|
Provenance
The following attestation bundles were made for frankstate-0.0.2-py3-none-any.whl:
Publisher:
release.yml on EiinGeeeL/frankenst-ai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
frankstate-0.0.2-py3-none-any.whl -
Subject digest:
2fe6c31723c17bef5949da38ab22f3bc664aec94c8239e275413747e07e468ba - Sigstore transparency entry: 1247127310
- Sigstore integration time:
-
Permalink:
EiinGeeeL/frankenst-ai@063bac1157eedaab1ce2704eb334926564383db2 -
Branch / Tag:
refs/tags/0.0.2 - Owner: https://github.com/EiinGeeeL
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@063bac1157eedaab1ce2704eb334926564383db2 -
Trigger Event:
push
-
Statement type: