Scan your whole stack
Are you using llm-fsm?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v0.14.0
llm-fsm was last scanned on 30 Nov 2026 at version 0.14.0. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 0.14.0 LATEST | 30 Nov 2026 | No rules fired |
| 0.13.0 | 17 Nov 2026 | No rules fired |
Findings for v0.14.0. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 0.14.0; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
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.
The split is simple. The model understands the user, pulls out facts and writes replies. The state machine decides where the conversation goes next, by rules evaluated in plain Python, so the same facts always lead to the same state. The framework keeps everything else: what was collected, the history, your hooks, sessions, budgets and an optional replayable log.
It is one package, fsm_llm, with a small core and subpackages on top: reasoning strategies, a workflow engine, 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 one per subpackage.
| You want | What FSM-LLM gives you | Look at |
|---|---|---|
| A form, intake or onboarding flow that never skips a required field | Per-state extraction, gates on the context (requires_context_keys plus a JsonLogic rule), correction handling |
form_filling |
| Triage that routes by intent, with a deterministic fallback | classification_extractions, Classifier, IntentRouter; the model only breaks a tie |
smart_helpdesk |
| A conversation that hands part of the job to a specialist and takes the result back | FSM stacking: push_fsm and pop_fsm, with only the keys you declare coming back |
e_commerce, multi_level_stack |
| Business logic around a chat: audit, analytics, lookups, side effects | Handlers at eight lifecycle points, with continue or raise error modes |
handler_hooks |
| A tool-using agent where a person approves risky calls | ReAct, ReWOO, Reflexion and more; human approval as a driver-only grant bound to one exact call | hitl_approval, react_search |
| A tree of agents with a manager and workers | orchestrator, AgentGraph, agents as tools of other agents |
hierarchical_orchestrator |
| A tutor that reasons in the middle of a chat | A reasoning engine that picks a strategy, runs it as a child FSM through a call state and validates the answer | math_tutor |
| Long-running processes with events, timers and branches | An async workflow engine with typed steps, a Python DSL, waits and parallel steps, no model needed | order_processing |
| A bot you can crash, replay and fork | An opt-in write-ahead event log, API.fork and API.resume (since 0.14.0) |
Durable runs |
| A bot you can unit test with no network | fsm_llm.testing: scripted models, a scripted user and state, path and context assertions |
Quick Start |
| An FSM, workflow or agent you describe in chat | The meta-builder (fsm-llm-meta) |
build_fsm |
pip install llm-fsm, extras, picking a model.Every transition is a rule over the collected context, written in JsonLogic and evaluated in plain Python. The operators cover comparison, boolean logic, arithmetic, in, contains, if, var with dot paths, and two additions for this library, has_context and context_length. The lowest priority among the passing transitions wins outright. Only a tie at the lowest priority asks the model, and then only to choose among the tied targets. If nothing passes, the conversation stays where it is.
{
"target_state": "adult_flow",
"description": "The user is an adult",
"priority": 10,
"conditions": [
{"description": "Age is known and at least 18",
"requires_context_keys": ["age"],
"logic": {">=": [{"var": "age"}, 18]}}
]
}
Numeric comparison coerces only plain decimal strings, so "21" passes >= 18 and "inf" does not. A key you list in handler_only_keys cannot be written by the model, which keeps gates such as is_admin out of its reach.
Pass 1 of each turn extracts the fields the state declares: from required_context_keys, from the keys the outgoing edges need, or from explicit field_extractions with validation rules, retries and a confidence threshold. classification_extractions turn free text into one of your named intents. A wrong correction leaves the stored value in place and tells Pass 2 it was rejected. context_scope limits which keys a state's prompts can see.
push_fsm (and its async twin apush_fsm) starts a sub-conversation, pop_fsm ends it and merges back only the keys you declared; a call state does the push and the pop for you. Stacks nest, each frame has its own history and turn budget, and an ended pushed FSM can be popped inside a message-free run so the parent continues on its own.
api.register_handler(audit) # a handler from create_handler, see Quick Start
api.push_fsm(conv_id, "address_form.json", shared_context_keys=["zip"])
reply = api.converse("90210", conv_id) # the child FSM collects the zip code
api.pop_fsm(conv_id) # back in the parent, with context["zip"]
Handlers run at START_CONVERSATION, PRE_PROCESSING, POST_PROCESSING, PRE_TRANSITION, POST_TRANSITION, CONTEXT_UPDATE, END_CONVERSATION and ERROR. A fluent builder targets them by state, by target state, by context keys or by a condition. Return a dict and it merges into the context. A critical handler always raises; the others follow the continue or raise error mode, and handler_timeout bounds a slow one.
advance(conversation_id) runs one turn with no incoming message and returns an AdvanceResult. run_until_terminal(conversation_id, max_steps=..., max_seconds=...) repeats it and raises RunBudgetExceededError when the budget is spent. Lifetime budgets on API(max_steps=, max_seconds=) are charged outside anything a model can write, so no extraction can reset them. Agents, workflow agent steps and the reasoning engine all run on these loops.
A state with the optional completion field makes its Pass 1 one complete call, with tool schemas or a JSON schema, over a transcript you own. The result lands in the context as {kind, text, calls} and your transitions read <result_key>.kind. Core runs no tool; your handlers or an agent loop do. Native function calling in the agents package is built on exactly this.
A turn that fails is rolled back to its snapshot. A reply cut off at max_tokens is flagged truncated, logged once and never shown as an unreadable half envelope. Dead or contradictory state configuration is refused when the definition loads, and FSMValidator reports what the loader would accept but you probably did not mean. fsm-llm-validate --upgrade moves an older schema version (4.0 to 4.2) forward.
Since 0.14.0. Pass event_log= and every turn of a conversation tree is appended to one JSONL file, with large payloads in a content-addressed blob store, fsynced before each model call. A log that cannot be written refuses the call.
from fsm_llm import API
api = API.from_file("greeter.json", event_log="logs")
conv_id, _ = api.start_conversation()
api.converse("Hi, I'm Alice.", conv_id)
branch_id, state = api.fork(conv_id, at_turn=0) # a new conversation from the state before turn 1
api.converse("Hi, I'm Bob.", branch_id) # a different answer; the original is untouched
# after a crash, in a new process, on the same log directory:
api = API.from_file("greeter.json", event_log="logs")
conv_id, state = api.resume(conv_id) # same id; an in-flight tool is reported, never re-run
fork and resume rebuild the whole stack of pushed FSMs from the log. Privacy is a setting: EventLog(root, privacy="values") is the default, "shape" keeps ids, names and outcomes with no text (and then the log cannot be forked), and a redact hook handles free text. EventLog.prune is explicit retention and deletes nothing by default. An EventLog keeps at most max_open_writers (default 64) idle writers open, two file descriptors each; a conversation whose writer was closed holds no lock across processes, so a host that needs the lock for every live conversation passes max_open_writers=None (see the Event Log section of the API reference). Usage totals can be folded back out of the log with fsm_llm.runtime.usage.
from fsm_llm import FSMValidator, build_fsm_graph, to_mermaid
from fsm_llm.core.loaders import load_fsm_definition
from fsm_llm.core.verify.flow import analyze_data_flow, analyze_liveness
definition = load_fsm_definition("greeter.json")
print(to_mermaid(build_fsm_graph(definition))) # a stateDiagram-v2 you can paste into a README
for finding in analyze_data_flow(definition) + analyze_liveness(definition):
print(finding) # for example shadowed-edge, permanent-tie, cycle-no-exit
The data-flow pass catches a state that reads a key nothing extracts. The liveness pass catches an edge a higher-priority edge always hides, a tie that can never resolve and a loop with no exit. fsm-llm-visualize draws any FSM as ASCII, Mermaid or Graphviz DOT.
create_agent(pattern, tools, config=...) builds an agent on the same FSM core. Most patterns are JSON files under fsm_llm/agents/patterns/ that one PatternAgent runs (see Executables): a file of your own in a directory, or a preset that extends a pattern, builds through create_agent(id, registry=...), and a file from a user directory is operator configuration, never a model's output. There is also AgentGraph for a DAG of agents and a meta-builder that designs FSMs, workflows and agents by chat.
fsm_llm.agents: the 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) plus AgentGraph.@tool decorator with annotations, enforced timeouts, tools loaded from folders of Python files (trusted sources only), presets (a task template and options over an existing pattern), retry and caching registries, and semantic tool selection.MCPToolProvider discovers and registers tools from a stdio or HTTP MCP server (the mcp extra). There is no MCP server in the package yet.AgentServer exposes an agent at /invoke, /stream, /health and /info with an optional API key, and RemoteAgentTool calls it as a tool. It is a small HTTP protocol, not the full A2A specification.Human approval is enforced by the driver, not the prompt:
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.