A language model call starts from nothing. A multi-turn conversation that must collect data, follow a set flow and decide the same way every time needs structure around the model. FSM-LLM is a Python framework for chatbots and agents that follow a fixed structure: you describe the conversation as a finite state machine in JSON, and the language model does the language work inside each state.
It is one package, fsm_llm, with a small core and seven subpackages on top: reasoning strategies, a workflow engine, 18 agent patterns, a monitoring dashboard, an evaluation harness, runtime FSM synthesis and public test doubles. Every subpackage is built from the same parts as the core (stacked FSMs, message-free steps, one LLM layer), so there is one way to run a model, not five.
Table of Contents
- Key Features: What is in the box.
- Why FSM-LLM?: Where it fits and where it does not.
- Installation:
pip install llm-fsm, extras, picking a model. - Quick Start: A conversation, a fake model, a builder, an agent, a workflow.
- How It Works: The two-pass turn, the state kinds, the layers.
- In-Depth Documentation: The docs site, the guides and per-package READMEs.
- Examples and Command-Line Tools: 100 runnable examples and the CLIs.
- Quality, CI and Release: Offline tests, import contracts, supply-chain checks.
- Project Structure: A short tour of the repository.
- Contributing: Where the rules live.
- Status: Maturity and things to know.
- License
- Acknowledgments
- References: The work this library builds on.
Key Features
The library is organized into five pillars. Each one is a collapsible section.
1. The Core: Finite State Machines Driven by an LLM
- Two-pass turns: every message goes through Pass 1 (extract data) and Pass 2 (write the reply from the state you ended up in). Transition rules are JsonLogic evaluated in plain Python, so they are predictable and unit-testable. The LLM is asked to choose only when two rules tie at the lowest priority.
- Three state kinds:
conversation(the default),completion(one native tool-calling or JSON-schema call per turn, over a transcript you own) andsynthesize(a goal that a model turns into a child FSM, behind gates). Each kind is a spec plus an executor, so a new kind is an addition, not a rewrite. - Handlers: your functions run at 8 points (start, before and after processing, before and after a transition, context update, end, error), built with
create_handler, with acontinueorraiseerror mode. - Intent classification:
classification_extractionson a state, plusClassifier,HierarchicalClassifierandIntentRouter. - FSM stacking: hand a conversation to a sub-FSM and come back with its results (
push_fsm/pop_fsm). - Streaming:
converse_stream()yields reply tokens as they arrive. - Steps without a user message:
advance()runs one turn and returns anAdvanceResult;run_until_terminal()repeats it within a step and time budget and raisesRunBudgetExceededErrorwhen the budget is spent. Agents, workflow agent steps and the reasoning engine run on these loops. - Sessions and memory:
save_session/restore_sessionwithFileSessionStore, andWorkingMemorybuffers. - Static checks and diagrams: a validator and data-flow and liveness analyses for FSM definitions, a versioned schema (4.0 to 4.2) with
fsm-llm-validate --upgrade, andbuild_fsm_graph(),to_mermaid(),to_dot()with thefsm-llm-visualizecommand.
2. Reasoning, Workflows, Agents and Synthesis
fsm_llm.reasoning: a solver that picks one of 9 reasoning strategies, runs it as stacked FSMs inside one message-free core run, validates the answer and retries up to 3 times.ReasoningEngine.solve_problem(problem)returns the solution and a trace.fsm_llm.workflows: an async in-memory engine with 11 step types and a Python DSL (create_workflow_builder,auto_step,condition_step). It runs without an LLM unless you add LLM steps.fsm_llm.agents: 18 agent patterns (react,rewoo,reflexion,plan_execute,prompt_chain,self_consistency,debate,orchestrator,adapt,evaluator_optimizer,maker_checker,reasoning_react,parallel_react,verified_react,auto_memory,native_fc,swarm,meta_builder) plusAgentGraph.- Tools done properly: the
@tooldecorator, annotations, enforced timeouts, MCP and A2A support, tools loaded from folders of Python files, and standard operating procedures. - Human approval as a security boundary: a gated tool runs only with a driver-only grant bound to that exact call, which a caller's initial context can never set.
- A meta-builder that designs FSMs, workflows and agents by chat (
fsm-llm-meta). fsm_llm.synthesis: a host FSM names a goal in asynthesizestate, a model writes a child FSM for it, static checks, a bounded simulation and an optional approval decide whether it may run, a file-backed library stores it and a runner pushes it as a child of the host conversation (FSMSynthesizer,ProcedureRunner,FSMLibrary,create_procedure_tools).verifiedmeans those checks passed over a model-written spec, not that the procedure is correct. Bench status: blockss0,s1ands2were run on one model; all three verdicts are INCONCLUSIVE. See the synthesis guide.
3. Knowledge Bundles and Agent Skills
- Open Knowledge Format (OKF):
fsm_llm.okfreads, searches, validates and writes OKF bundles (a directory of markdown files with YAML frontmatter).fsm_llm.engine.okf_bridge.create_okf_handler()puts capped concept summaries into a plain FSM's context.fsm_llm.agentsadds read-only OKF tools, a read-only memory backend and bundle exporters.fsm-llm-okfruns it from the shell. This follows OKF v0.2 (pre-1.0 and mutable). - Agent Skills:
fsm_llm.skillsreads folders with aSKILL.mdfrom the paths you name (the open standard at agentskills.io, unversioned and mutable).fsm_llm.agents.create_skill_toolsgives an agent three read-only tools (skill_list,skill_load,skill_read), andfsm-llm-skillsvalidates, lists and shows them. - Untrusted by design: bundle and skill text reaches a model only as capped, control-stripped tool output (or labelled summaries), never as a tool description, instruction or persona. Nothing in a bundle or skill folder is executed, and
allowed-toolsis reported, not enforced.
4. Monitoring, Evaluation and Testing
fsm_llm.monitor: a FastAPI dashboard (REST, WebSocket, vanilla-JS single-page app) to launch, watch and chat with FSMs, agents and workflows, with optional OpenTelemetry export.fsm_llm.eval: scores the examples 0 to 4, or runs scripted conversations N times and reports pass rates with Wilson confidence intervals (EvalConfig,run_examples,run_cases,run_dataset,wilson_ci).fsm_llm.testing: public test doubles for your own code: fakeLLMInterfaceimplementations (ScriptedLLM,MockLLM2Interface,PromptGroundedLLM), reply builders, aScriptedUserthat drives a conversation, and the assertionsassert_state,assert_context,assert_pathandassert_result. It never imports pytest.- Pre-registered benches:
scripts/agents_bench.py,scripts/skills_bench.pyandscripts/synthesis_bench.pyrecord blocks that are run once at a fixed n and never edited, so a number in the repository can be recounted from its rows.
5. One LLM Layer, Safe Defaults and Reliability
- One LLM layer: litellm is imported in exactly one module,
src/fsm_llm/llm/providers/litellm.py.LLMInterface.complete(CompletionRequest)is the single primitive for tool calling, plain and structured completion, with per-interface call and token counters (usage()) and an embedder (LiteLLMEmbedder). Any litellm model string works. - No hidden configuration: there is no built-in default model (
model=, thenLLM_MODEL, elseModelNotConfiguredError), importingfsm_llmloads no.envfile (you callload_env()or pass--env-file), and the library logs nothing until you ask. - Cut-off replies are visible: a reply that stops at
max_tokensis flagged (truncated, a WARNING, a named cause in extraction errors) and never shown as an unreadable half envelope. - Context security: internal keys (prefixes
_,system_,internal_,__) and secret-looking entries are kept out of prompts. The compromised litellm 1.82.7 and 1.82.8 are below the required version, andmake auditscans for malicious.pthfiles. - Enforced layering: a layer package imports only the layers below it, written as import contracts (
.importlinter) that a test and CI run, so the architecture cannot drift unnoticed. - Assured reliability: an offline-by-default suite (a fake model, no network) covering the core, every subpackage, packaging, regressions, and the 100 examples.
Why FSM-LLM?
FSM-LLM splits the work three ways:
- The LLM handles language: understanding the user, pulling out facts, writing replies.
- The state machine handles flow: which state you are in and where you go next is a rule, not a mood. The LLM breaks a tie between two equal rules and nothing else.
- The framework handles state: what has been collected, history, your own hooks, and saving and restoring sessions.
Use it when the conversation has steps: forms and intake, onboarding, support triage, tutoring flows, anything where "what must happen next" is a rule.
Do not use it for open-ended chat with no structure (a plain LLM call is simpler), or when you need a hosted, production-hardened agent platform. The project is young, and one subpackage is explicitly experimental (see Status).
Installation
Note: This library requires Python 3.11 or newer (tested on 3.11 to 3.15). It is published on PyPI as
llm-fsm; the import package isfsm_llm.fsm-llmon PyPI is a different, unrelated project: if you installed it by mistake, runpip uninstall fsm-llmfirst.
-
Create an environment and install:
python -m venv .venv && source .venv/bin/activate pip install llm-fsm
-
Optional extras:
import fsm_llmloads only the core, and every subpackage ships in every install. An extra only adds third-party dependencies.Extra Adds reasoning,agents,workflows,eval,synthesis,testingNo third-party packages (the code ships in every install) monitorfastapi, uvicorn, jinja2 mcpmcp otelopentelemetry-api, opentelemetry-sdk a2ahttpx allEvery extra above devThe test, lint and type tools (for contributors, see CONTRIBUTING) pip install "llm-fsm[monitor]" pip install "llm-fsm[all]"
The core install needs loguru, litellm, pydantic, python-dotenv and pyyaml (which parses OKF and Agent Skills frontmatter).
-
Pick a model:
export LLM_MODEL=ollama_chat/qwen3.5:4b # or openai/gpt-4o-mini with OPENAI_API_KEY set
The model is the
model=argument, thenLLM_MODEL; there is no built-in default, and with neither set the call raisesModelNotConfiguredError(a CLI prints its message and exits 1). No.envfile is read unless you ask: callfsm_llm.load_env()(orfsm_llm.load_env("path/to/.env")) in Python, or pass--env-file PATHto a CLI that needs a model (fsm-llm,fsm-llm-eval,fsm-llm-meta,python -m fsm_llm.reasoning,fsm-llm-monitor); a variable the process already has is not replaced unlessoverride=True, except an empty or whitespace-only one, which counts as unset and is filled when the file gives it a value. -
Verify the installation:
python -c "import fsm_llm; print('Installation successful!')"
Quick Start
1. Define and Run a Conversation
Define the conversation (greeter.json). It asks for a name, then moves to a final state:
{
"name": "Greeter",
"description": "Learns the user's name, then says goodbye",
"initial_state": "ask_name",
"persona": "A friendly assistant",
"states": {
"ask_name": {
"id": "ask_name",
"description": "Find out the user's name",
"purpose": "Learn the user's name",
"extraction_instructions": "Extract the user's name if they gave it",
"response_instructions": "Greet the user and ask for their name if you do not know it yet",
"required_context_keys": ["name"],
"transitions": [
{
"target_state": "goodbye",
"description": "The name is known",
"conditions": [
{
"description": "A name was collected",
"requires_context_keys": ["name"],
"logic": {"has_context": "name"}
}
]
}
]
},
"goodbye": {
"id": "goodbye",
"description": "Say goodbye",
"purpose": "Wrap up the conversation",
"response_instructions": "Say a short goodbye to the user by name. Do not ask a question"
}
}
}
Run it:
from fsm_llm import API
api = API.from_file("greeter.json") # no model given: env LLM_MODEL, else ModelNotConfiguredError
conv_id, opening = api.start_conversation()
print("bot:", opening)
print("bot:", api.converse("Hi, I'm Alice.", conv_id))
print(api.get_data(conv_id))
print(api.get_current_state(conv_id), api.has_conversation_ended(conv_id))
A real run against a local Ollama qwen3.5:4b (the wording differs on every run):
bot: Hello! How do you do? I'm here to get to know you better. What's your name?
bot: Nice meeting you, Alice! It was a pleasure getting to know you.
{'name': 'Alice'}
goodbye True
To use a hosted model, pass model= (for example API.from_file("greeter.json", model="openai/gpt-4o-mini")) and set the provider key (OPENAI_API_KEY).
A state with no transitions (goodbye) is terminal. required_context_keys only tells Pass 1 what to extract; it never blocks a transition, so the transition above carries its own condition (requires_context_keys plus logic).
2. Try It Without a Model
Pass your own llm_interface and nothing touches the network. fsm_llm.testing ships a scripted double, the one the repository's own tests use:
from fsm_llm import API
from fsm_llm.testing import ScriptedLLM
llm = ScriptedLLM(
extraction_data={"name": "Alice"},
responses={"ask_name": "What is your name?", "goodbye": "Goodbye, Alice!"},
)
api = API.from_file("greeter.json", llm_interface=llm)
conv_id, opening = api.start_conversation()
print(opening) # What is your name?
print(api.converse("I am Alice", conv_id)) # Goodbye, Alice!
print(api.get_data(conv_id), api.get_current_state(conv_id)) # {'name': 'Alice'} goodbye
API refuses model=, temperature= and similar settings next to llm_interface=, because the interface owns them.
A scripted user and the assertions turn the same bot into a test in a few lines:
from fsm_llm import API
from fsm_llm.testing import (
ScriptedLLM, ScriptedUser, assert_context, assert_path, assert_state,
)
llm = ScriptedLLM(extraction_data={"name": "Alice"}, responses={"goodbye": "Bye!"},
default_response="Hi!")
run = ScriptedUser(["I am Alice"]).run(API.from_file("greeter.json", llm_interface=llm))
assert_state(run, "goodbye")
assert_context(run, name="Alice")
assert_path(run, ["ask_name", "goodbye"])
print("the bot passes", run.states) # the bot passes ('ask_name', 'goodbye')
3. Assemble It Step by Step
Anything with more than a couple of settings can be put together by chaining calls. While you chain, nothing is checked; the final .build() checks everything at once and hands back a private copy, so one recipe can make many independent objects.
from fsm_llm import APIBuilder, HandlerTiming, create_handler
audit = (
create_handler("audit")
.at(HandlerTiming.POST_TRANSITION)
.do(lambda context: {"audited": True})
)
api = (
APIBuilder()
.set_definition("greeter.json")
.set_model("ollama_chat/qwen3.5:4b")
.set_temperature(0.2)
.add_handler(audit)
.build()
)
Mistakes come back together: build() raises one BuildError (a ValueError) that lists every problem in .errors. The result is a private copy, and the plain constructors and from_file still work everywhere. The same shape builds conversations, agents of any pattern, workflows, agent graphs and handlers (see the API reference).
4. Create an Agent in One Line
from fsm_llm.agents import AgentConfig, create_agent, tool
@tool
def add(a: int, b: int) -> int:
"""Add two integers."""
return a + b
agent = create_agent("react", [add], config=AgentConfig(model="ollama_chat/qwen3.5:4b")) # or set LLM_MODEL
result = agent("What is 19 + 23? Use the add tool.")
print(result.answer, result.success, result.stop_reason) # 19 + 23 equals 42. True answered
success is True only when the run reached its goal. A forced stop still returns its last answer, with success=False and a stop_reason.
5. Run a Workflow (No LLM Needed)
This prints WorkflowStatus.COMPLETED:
import asyncio
from fsm_llm.workflows import WorkflowEngine, auto_step, condition_step, create_workflow_builder
wf = (
create_workflow_builder("orders", "Order check")
.set_initial_step(auto_step("load", "Load order", next_step_id="route",
action=lambda ctx: {"amount": 1500}))
.add_step(condition_step("route", "Big order?", condition=lambda ctx: ctx["amount"] >= 1000,
true_step_id="review", false_step_id="done"))
.add_step(auto_step("review", "Manual review", next_step_id="done"))
.add_step(auto_step("done", "Finish", next_step_id=""))
.build()
)
async def main():
engine = WorkflowEngine()
engine.register_workflow(wf)
instance_id = await engine.start("orders")
print(engine.get_status(instance_id))
asyncio.run(main())
6. Solve a Problem with the Reasoning Engine
from fsm_llm.reasoning import ReasoningEngine
engine = ReasoningEngine(model="ollama_chat/qwen3.5:4b")
solution, trace = engine.solve_problem("If all cats are mammals and Tom is a cat, what is Tom?")
print(solution)
print(trace["summary"])
More (handlers, streaming, sessions, every builder) is in the Quick Start guide.
How It Works
Every user message goes through two LLM passes:
user message
|
v
Pass 1: extract data (LLM) --> update context
|
v
transition rules (JsonLogic, plain Python, no LLM)
|
+-- one rule wins ----------------> new state --+
+-- several tie at the lowest ----> LLM picks one -> new state --+
+-- none passes ------------------> stay in state ---------------+
|
v
Pass 2: write the reply from the final state (LLM)
- The context is a dictionary of everything collected so far in one conversation.
- Transition rules use JsonLogic, for example
{">=": [{"var": "age"}, 18]}. If several transitions pass, the lowestprioritynumber wins outright. The LLM is asked only when two or more tie at that lowest priority. If none pass, the conversation stays put. - Pass 2 runs after the transition, so the reply comes from the state the conversation is actually in. A state with empty
response_instructionsmakes no LLM call, replies with""and adds nothing to the history.
State kinds
| Kind | Pass 1 does | Use it for |
|---|---|---|
conversation |
Extracts fields and classifications from the user message, then Pass 2 writes the reply | Forms, intake, support flows (the default) |
completion |
One complete call with tools or a JSON schema over a transcript you own; the result {kind, text, calls} lands in the context |
Tool calling and structured turns; your handlers run the tools |
synthesize |
Core only loads and validates the field; fsm_llm.synthesis.ProcedureRunner has a model write a child FSM for the goal and runs it behind the gates |
A sub-conversation that cannot be written ahead of time |
The layers
The core is built in layers, and a layer imports only the rows below it (the contracts are in .importlinter). The seven subpackages sit on top and are imported by name, so import fsm_llm loads only the core:
monitor eval agents synthesis workflows reasoning testing <- subpackages: from fsm_llm.agents import ...
---------------------------------------------------------------
engine API, FSMManager, the turn pipeline, state kinds, classifier, sessions
handlers HandlerSystem, create_handler
policy approval vocabulary, HumanInTheLoop
tools ToolRegistry, @tool, timeouts
context okf skills independent siblings
llm LLMInterface, LiteLLMInterface: the one litellm import
core definitions, JsonLogic expressions, validator, diagrams
kernel constants, logging, security, text, env, frontmatter, memory
Maturity differs by subpackage: reasoning, agents and synthesis are tested offline against scripted models, so live behavior depends on the model; the eval scores are a heuristic that overstates quality; monitor needs the monitor extra. Each per-package README lists its known limits.
Evaluation honesty. The examples scorer reads each run's output with simple rules and gives 0 to 4. It overstates quality, and runs from before and after the 2026-09-29 restructure are not comparable. The method and the run log are in EVALUATE.md. Offline tests (the default) replace the model with a fake, so they say nothing about model quality.
In-Depth Documentation
- Documentation site: https://nikolasmarkou.github.io/fsm_llm/ (the guides below, built with MkDocs on every pull request and versioned per release).
- Start here, in this order: Quick Start (zero to a running conversation, then builders, an agent, a workflow and the reasoning engine), Concepts (what is in the box, where it fits), FSM Design (states, transitions, priorities, classification,
completionandsynthesize) and Handlers (the 8 hook points). - Going deeper: Architecture (the pipeline, the layers, the step driver), Testing (test your own bot offline), Runtime FSM synthesis, API Reference and the command-line tools.
- Per-package READMEs: core, reasoning, workflows, agents, monitor, eval, synthesis and testing.
- Project records: CHANGELOG, EVALUATE (method and run log), CONTRIBUTING, SECURITY and the 2026 roadmap.
Examples and Command-Line Tools
Examples
100 runnable examples in 8 categories. Each is a folder with run.py and its FSM JSON. They are in the repository, not in the installed package, so get them from a checkout of the source and run one:
python examples/basic/simple_greeting/run.py # needs a model: an OpenAI key, or a local Ollama
| Category | Count | Highlights |
|---|---|---|
| Basic | 14 | simple_greeting, form_filling, multi_turn_extraction |
| Intermediate | 3 | book_recommendation, product_recommendation, adaptive_quiz |
| Advanced | 17 | e_commerce (FSM stacking), support_pipeline, concurrent_conversations |
| Classification | 4 | intent_routing, smart_helpdesk, multi_intent |
| Reasoning | 1 | math_tutor |
| Workflows | 8 | order_processing, parallel_steps, conditional_branching |
| Agents | 48 | react_search, plan_execute, reflexion, debate, orchestrator |
| Meta | 5 | build_fsm, build_workflow, build_agent |
The examples are evaluation baselines: fsm-llm-eval examples runs them in parallel and scores each. The list with links is the examples page.
Command-Line Tools
| Command | Description |
|---|---|
fsm-llm --fsm <path.json> [--model M] [--env-file PATH] |
Chat with an FSM interactively (--mode validate and --mode visualize also exist) |
fsm-llm-visualize --fsm <path.json> [--format ascii|mermaid|dot] |
Draw an FSM |
fsm-llm-validate --fsm <path.json> [--upgrade] |
Check an FSM definition for problems; --upgrade rewrites an older schema version after validating |
fsm-llm-monitor |
Web dashboard at http://127.0.0.1:8420 (--host, --port, --no-browser, --api-key, --otel, --env-file) |
fsm-llm-meta [--model M] [--env-file PATH] [--output FILE] |
Build FSMs, workflows or agents by chatting |
fsm-llm-okf <validate|list|show|search|export> |
Check, browse, search and export Open Knowledge Format bundles |
fsm-llm-skills <validate|list|show> PATH... |
Check (--strict for API portability), list and read Agent Skills folders |
fsm-llm-eval examples [--category C] [--fail-under PCT] [--env-file PATH] |
Score every example 0 to 4 |
fsm-llm-eval run <dataset.json|.jsonl> [--trials N] [--env-file PATH] |
Run scripted conversations and report pass rates |
python -m fsm_llm.reasoning "problem" [--type T] [--model M] [--env-file PATH] |
Solve a problem with the reasoning engine (no console script) |
The CLIs that call a model need one: --model/-m NAME, else LLM_MODEL in the environment, else the file given with --env-file PATH (the process environment wins over the file); with none they print one Error: line and exit 1. fsm-llm-monitor starts without a model, and its launch routes answer 400 until one is set. The commands that call no model (fsm-llm-okf, fsm-llm-skills, fsm-llm-validate, fsm-llm-visualize) have no --env-file. Exit codes: 0 ok, 1 failure, 130 Ctrl-C; fsm-llm-eval exits 2 below --fail-under. Every option is on the command-line page.
Quality, CI and Release
- Offline by default, enforced by contracts. The default test run needs no network and no model (live tests skip without a local Ollama). Import contracts, a module-size guard, a public-API snapshot, a documented-count check and a decision-anchor gate run as tests or CI steps.
- A seven-leg CI matrix.
python-package.ymlrunslint(ruff, mypy, the.pthaudit, the import contracts, the workflow linters),supply-chain(pip-auditover the installed environment, with a canary that must fail),dependency-reviewon pull requests, andteston Linux with Python 3.11 to 3.15 and on Windows with 3.11 and 3.15. Runners and actions are pinned, and a coverage ratchet guards the Linux 3.12 leg. - Pinned dependencies.
constraints.txtpins every direct dependency exactly; a weekly job proposes a newer litellm or mcp only when it is stable, at least 7 days old and green on the suite, and never merges by itself. - Releases come from a tag. One pushed tag
vX.Y.Zbuilds the package once, writes an SBOM, publishes to PyPI by trusted publishing with attestations and creates the GitHub release; nothing publishes from a developer machine. The same tag deploys the docs site.
Project Structure
One distribution (llm-fsm, setuptools, src layout): the directory src/fsm_llm/ is the import package fsm_llm. Beside it: tests/ (one folder per subpackage), examples/ (100 runnable examples, the evaluation baselines), docs/ (the pages of the site), evaluation/ (datasets and recorded runs), scripts/ (supply-chain audit, benches, doc-count check) and .github/workflows/ (CI, docs, pin refresh, release). The full tree, one line per package, is in CONTRIBUTING.
Contributing
Contributions are welcome, from a typo fix to a new agent pattern. Setup, the test, lint and type commands, the rules for new code, the release procedure and the open items worth picking up are in CONTRIBUTING. Report vulnerabilities as described in SECURITY.
Status
- Version 0.13.0. Most tests are offline and use a fake model, so they check logic and wiring, not model quality. Evaluation scores are a heuristic and overstate quality; the recorded runs in EVALUATE.md used a 4B local model.
- The library logs nothing until you call
setup_logging()orenable_debug_logging(); both also replace loguru's default handler, so a library record prints once. - One conversation handles one message at a time: a second
converseon a conversation that is mid-turn raisesFSMError.
License
This project is licensed under the Apache License 2.0.
- Permissive: you may use, modify and distribute the library, including in commercial and closed-source products.
- Attribution: redistributions must retain the copyright notice and a copy of the license, and modified files must carry a notice stating that they were changed.
- Patent grant: contributors grant an express patent license covering their contributions.
See the LICENSE file for complete details.
Acknowledgments
FSM-LLM stands on open-source work: litellm for the provider layer, Pydantic for the models, loguru for logging, JsonLogic for transition rules, and Ollama for the local models the evaluation runs used. Thanks to everyone who has reported issues and run the examples against other models.
References
The agent patterns, reasoning strategies and standards in this library follow published work and open specifications. Each pattern's module documents how it differs from the original.
Agent Patterns, Reasoning and Evaluation
- ReAct: Synergizing Reasoning and Acting in Language Models: Yao, S., et al. (2022). ICLR 2023.
- ReWOO: Decoupling Reasoning from Observations for Efficient Augmented Language Models: Xu, B., et al. (2023).
- Reflexion: Language Agents with Verbal Reinforcement Learning: Shinn, N., et al. (2023). NeurIPS.
- Plan-and-Solve Prompting: Improving Zero-Shot Chain-of-Thought Reasoning by Large Language Models: Wang, L., et al. (2023). ACL.
- Self-Consistency Improves Chain of Thought Reasoning in Language Models: Wang, X., et al. (2022). ICLR 2023.
- Chain-of-Thought Prompting Elicits Reasoning in Large Language Models: Wei, J., et al. (2022). NeurIPS.
- Improving Factuality and Reasoning in Language Models through Multiagent Debate: Du, Y., et al. (2023).
- Building Effective Agents (prompt chaining, orchestrator-workers, evaluator-optimizer): Anthropic (2024).
- Probable Inference, the Law of Succession, and Statistical Inference: Wilson, E. B. (1927). Journal of the American Statistical Association. The source of the Wilson confidence interval used by
wilson_ci.
Standards and Specifications
- Model Context Protocol (MCP): the protocol behind the
mcpextra. - Agent2Agent (A2A) Protocol: the protocol behind the
a2aextra. - Open Knowledge Format (OKF) v0.2: pre-1.0 and mutable.
- Agent Skills (agentskills.io): the
SKILL.mdfolder standard, unversioned and mutable. - JsonLogic: the rule format used for transition conditions.
- OpenTelemetry: the telemetry format behind the
otelextra.
Metadata
Release files for llm-fsm 0.13.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| llm_fsm-0.13.0.tar.gz | 1.4 MB | With provenance | Details for llm_fsm-0.13.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| llm_fsm-0.13.0-py3-none-any.whl | Python 3 | none | any | Details for llm_fsm-0.13.0-py3-none-any.whl |
Total release size: 2.8 MB
Release files / llm_fsm-0.13.0.tar.gz
| Download URL | llm_fsm-0.13.0.tar.gz |
|---|---|
| Size | 1.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
971a0f52e5b0e037825917611617b09f904e55685cbd24156a73740d423ae729
|
|
BLAKE2b-256 checksum How to use checksums |
a0257ead4c9178ff0fd900ec44402c83d62702fd099b1682d6785329dd84f781
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 17, 2026.
Transparency logRelease files / llm_fsm-0.13.0-py3-none-any.whl
| Download URL | llm_fsm-0.13.0-py3-none-any.whl |
|---|---|
| Size | 1.4 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b459f8dd410f5669cd7269972d403b051d91f731b8223e7038bf95124fa5d076
|
|
BLAKE2b-256 checksum How to use checksums |
00e0fd6eaedb68d3257c49b2de43f7cc11805e39715d019a90848966c86518f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 17, 2026.
Transparency logSecurity for llm-fsm 0.13.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.
Attestation for llm_fsm-0.13.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 Nov 17, 2026.
Transparency logA 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.