Skip to main content

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 Command when 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/frankstate is the reusable pattern layer. It contains the assembly utilities and contracts used to structure LangGraph projects with consistent design rules.
  • src/core_examples is the repository's importable reference package. It demonstrates one concrete way to organize layouts, state models, components, YAML configuration and prompt assets on top of frankstate.
  • src/services is 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.
  • research is 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

Choose one of these two installation paths depending on what you need.

Option A. Install the published package frankstate

Use this option when you only want the reusable public package published on PyPI.

  • With pip installer: pip install frankstate
  • With uv installer: python -m uv pip install frankstate

(Optional) examples extra dependencies:

  • With pip installer: pip install frankstate[examples]
  • With uv installer: python -m uv pip install frankstate[examples]

This option installs only the published frankstate wheel. It does not install the repository reference package under src/core_examples, the service layer under src/services, or the repository tests. The examples extra only adds optional dependencies; it does not install the repository example code.

Option B. Clone and install the repository

Use this option when you want the full mono-repo, including src/core_examples, prompt assets, tests and local development tooling.

  1. Clone the repository.

  2. Create a virtual environment:

    python -m venv .venv
    
  3. Activate the virtual environment:

    • On Windows: .venv\Scripts\activate
    • On macOS and Linux: source .venv/bin/activate
  4. Install the repository in editable mode:

    python -m uv pip install -e .
    
  5. If you also want the repository examples and development dependencies:

    python -m uv pip install -e .[examples,dev]
    
  6. (Optional) System packages for the example/document-processing stack:

    sudo apt update
    sudo apt-get install poppler-utils
    sudo apt install tesseract-ocr
    

Running the Project Locally

To run the project locally:

  1. Choose an LLM Services backend

    Choose one of the following options:

    1.1 Using a local model with Ollama

    Start the Ollama service: ollama run ministral-3:8b

    1.2 Using Azure AI Foundry Deployment

    Configure your model variables in .env: cp .env.example .env

  2. Compile Graph Layouts with WorkflowBuilder

    The minimal example below uses the reference package under src/core_examples to show how src/frankstate is 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:

    • WorkflowBuilder is part of the reusable pattern in src/frankstate.
    • SimpleOakConfigGraph and SharedState are concrete reference classes from src/core_examples.
    • In your own project, those src/core_examples imports would be replaced by your own layouts and state schemas.

    For exploratory examples and experimentation, refer to the research/demo...ipynb notebooks.

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()

The graph is still a LangGraph graph object produced through LangGraph's own runtime.

Running Tests

  • Using the pytest CLI: pytest -q
  • Using pytest as a Python module: python -m pytest -q

Local Functions Apps Container

  • src/services/functions/function_app.py is 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

Contributing

See CONTRIBUTING.md for repository boundaries, local setup, documentation conventions and pull request expectations.

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

frankstate-0.0.4.tar.gz (21.4 kB view details)

Uploaded Source

Built Distribution

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

frankstate-0.0.4-py3-none-any.whl (19.7 kB view details)

Uploaded Python 3

File details

Details for the file frankstate-0.0.4.tar.gz.

File metadata

  • Download URL: frankstate-0.0.4.tar.gz
  • Upload date:
  • Size: 21.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for frankstate-0.0.4.tar.gz
Algorithm Hash digest
SHA256 bf3666306a8158ae493452fea4fdd45b605c5a670241505efb03999a0b11ce28
MD5 10c180455e398feb43b206f4e4d1fd5b
BLAKE2b-256 05cab839d3e92a07ea26c6e8f3acc95a2f50a58db84cb81fda553b459faab5f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for frankstate-0.0.4.tar.gz:

Publisher: release.yml on EiinGeeeL/frankenst-ai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file frankstate-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: frankstate-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 19.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for frankstate-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8ccd66c2d3040c4f3a16c5879d9cacde44df67e838f0b622d3d732ed3b986991
MD5 fa9957f6a3202143e2f5aa43eb1331d8
BLAKE2b-256 a123d8def02567d2a169a78deae19608b75c7a65da5b7fd418b7d85ac41f6cb9

See more details on using hashes here.

Provenance

The following attestation bundles were made for frankstate-0.0.4-py3-none-any.whl:

Publisher: release.yml on EiinGeeeL/frankenst-ai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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