Skip to main content

🧟 frankstate

release pypi license downloads versions

frankstate is a lightweight pattern layer for assembling LangGraph workflows with clearer structure, stronger boundaries, and less duplicated graph wiring.

It does not replace LangGraph and it does not introduce a separate runtime. The compiled result is still a native LangGraph graph built with official LangGraph primitives.

What The Package Provides

The published package focuses on reusable workflow assembly contracts:

  • WorkflowBuilder to compile a graph from a layout class, and to_mermaid() to render it. Its constructor and compile() take LangGraph's own StateGraph and StateGraph.compile options as **kwargs.
  • GraphLayout to separate runtime dependency construction from graph declaration.
  • SimpleNode, CommandNode, ToolGraphNode, SimpleEdge, and ConditionalEdge to model graph structure.
  • StateEnhancer, StateEvaluator, and StateCommander to keep node and routing logic aligned with LangGraph concepts.
  • RunnableBuilder with PromptMixin and RetrieverMixin to assemble LCEL chains inside a layout.
  • NodeManager and EdgeManager to normalize layout declarations into LangGraph registration calls.

Public API

The package root intentionally exports only:

from frankstate import WorkflowBuilder

All other reusable contracts should be imported from subpackages, usually from their concrete modules:

from frankstate.entity.graph_layout import GraphLayout
from frankstate.entity.node import SimpleNode, CommandNode, ToolGraphNode
from frankstate.entity.edge import SimpleEdge, ConditionalEdge
from frankstate.entity.statehandler import StateEnhancer, StateEvaluator, StateCommander
from frankstate.entity.runnable_builder import RunnableBuilder, PromptMixin, RetrieverMixin
from frankstate.managers.node_manager import NodeManager
from frankstate.managers.edge_manager import EdgeManager

Installation

With pip:

pip install frankstate

With uv:

uv pip install frankstate

Optional example dependencies:

pip install frankstate[examples]

The published wheel contains only frankstate. Repository-level reference code, service integrations, notebooks, and tests are not part of the base package.

Minimal Example

from frankstate import WorkflowBuilder
from langgraph.checkpoint.memory import InMemorySaver
from my_project.layouts.simple_graph import SimpleGraphLayout
from my_project.state import GraphState

workflow_builder = WorkflowBuilder(
    config=SimpleGraphLayout,
    state_schema=GraphState,          # **kwargs go to StateGraph: context_schema, input_schema, output_schema
)

graph = workflow_builder.compile(      # **kwargs go to StateGraph.compile
    checkpointer=InMemorySaver(),
    interrupt_before=["review"],
)
print(workflow_builder.to_mermaid())   # the topology as a Mermaid diagram

graph is a native LangGraph CompiledStateGraph. frankstate adds no option of its own: anything StateGraph(...) or StateGraph.compile(...) accepts is passed by its LangGraph name, so a new LangGraph option works without a frankstate release. A name StateGraph would silently swallow (its deprecated aliases such as config_schema) raises TypeError at the constructor; compile() lets LangGraph raise its own.

Migrating from 0.2: checkpointer, input_schema and output_schema are no longer constructor parameters of their own. checkpointer moves to compile(checkpointer=...); the two schemas keep working as constructor **kwargs. Handler keyword arguments must now be declared by a class annotation on the handler subclass.

LangGraph Alignment

frankstate keeps the official LangGraph execution model:

  • StateEnhancer wraps node logic that returns partial state updates.
  • StateEvaluator wraps the callable used by conditional edges.
  • StateCommander wraps nodes that return official LangGraph Command objects.

The compiled graph still relies on LangGraph's own StateGraph, add_node(), add_edge(), add_conditional_edges(), and Command.

Handlers are configured from the layout line. StateEnhancer and StateEvaluator take a runnable_builder plus keyword arguments that become attributes, and the subclass declares each accepted keyword with a class annotation; an undeclared name raises TypeError where the layout passed it, not at the first node run that reads a missing attribute.

class RetrieveContext(StateEnhancer):
    retriever: MyRetriever            # declares the `retriever=` keyword
    strict: bool = False              # optional, with its default

    async def enhance(self, state):
        return {"context": self.retriever.get_context(state["question"])}

RetrieveContext(retriever=my_retriever, strict=True)   # in the layout

Repository Boundaries

If you are browsing the repository instead of the published package:

  • src/frankstate is the reusable package.
  • src/core_ai_examples is the repository reference layer.
  • src/services contains repository integrations and deployment entrypoints.

Those repository layers help demonstrate how frankstate can be consumed, but they are not the stable public API of the base wheel.

Runnable Builders

RunnableBuilder is a recommended way to organize LangChain LCEL builders inside a layout. Optional capabilities can be added through cooperative multiple inheritance using mixins:

Mixin Adds
PromptMixin Enforces a _build_prompt(**kwargs) hook
RetrieverMixin Lazily initialized retriever from a vectordb or pre-built retriever

Mix and match to get exactly the capability each builder needs — no base class carries attributes it does not use:

ChatBuilder   → PromptMixin, RunnableBuilder                   # prompt + model
RAGBuilder    → RetrieverMixin, PromptMixin, RunnableBuilder   # retriever + prompt + model
AgentBuilder  → PromptMixin, RunnableBuilder                   # prompt + tools (tools stored in subclass)

Working examples live in the repository under src/core_ai_examples/components/runnables/.

Metadata

Release files for frankstate 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for frankstate 0.3.0
File Size Uploaded Provenance Actions
frankstate-0.3.0.tar.gz 22.0 kB With provenance Details for frankstate-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for frankstate 0.3.0
File Interpreter ABI Platform Actions
frankstate-0.3.0-py3-none-any.whl Python 3 none any Details for frankstate-0.3.0-py3-none-any.whl

Total release size: 41.9 kB

Release files / frankstate-0.3.0.tar.gz

Download URL frankstate-0.3.0.tar.gz
Size 22.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b5cb5d4a0b35bd0f68c0b2411bd7d6e9cbee40888fbb2bc5900b58254a4a675b
BLAKE2b-256 checksum
How to use checksums
90e54667652a7da967f72d6ff0dccbbd90647398d77cd68fc0efd9e2320ffff0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 2, 2026.

Transparency log

Release files / frankstate-0.3.0-py3-none-any.whl

Download URL frankstate-0.3.0-py3-none-any.whl
Size 19.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1cb8f8b2f5ad692bad44caf34da77740363361e75896fadfc24f61dfa08dc061
BLAKE2b-256 checksum
How to use checksums
e1c23426f9c902f9b4dad0571de043e5e46dd6d4bbc72d6dab44a9f296add1f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 2, 2026.

Transparency log

Security for frankstate 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for frankstate-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page