COUNT THE TRAPS IN YOUR AI AGENTS.
EXACTLY.
Multi-agent graphs hide retry loops with no exit, dead-end nodes, and approval paths nobody traced. SharpLogic compiles your workflow graph into a CNF formula and counts β exactly β the condition assignments that leave it stuck (#F). Sparse workflow graphs resolve in microseconds; dense formulas take longer (exact counting is exponential in the worst case, up to the 64-variable engine limit).
from sharplogic import AgentGuard
# Local guardrail: exact deadlock/livelock audit of your workflow graph
# (0 cloud calls; the analysis runs entirely on your machine).
WORKFLOW = {
"nodes": ["Tool_Executor", "Critic_Fallback", "Human_Approval_Gate"],
"terminals": ["Human_Approval_Gate"],
"edges": [
{"from": "Tool_Executor", "to": "Critic_Fallback",
"condition": "tool_timeout or execution_error"},
{"from": "Critic_Fallback", "to": "Tool_Executor",
"condition": "retry_prompt_generated and retry_count <= 3"},
{"from": "Critic_Fallback", "to": "Human_Approval_Gate",
"condition": "not retry_prompt_generated or retry_count > 3"},
],
}
guard = AgentGuard(token="YOUR_TOKEN", graph=WORKFLOW)
# Audit the whole graph: counts the condition assignments that trap it
report = guard.audit()
print(report["exact_count"]) # trap assignments (#F); 0 = no traps found
# Runtime check of one transition against the current conditions
guard.assert_safe("Critic_Fallback", "Tool_Executor",
state={"retry_prompt_generated": True}, retry_count=2)
Share your personalized invite code with colleagues to unlock the auto-patch tier and join the waitlist for upcoming tiers:
TRY IT IN YOUR BROWSER — NO SIGNUP, NO INSTALL
Paste a LangGraph / Dify style workflow graph (nodes, edges, guard conditions). The same exact #k-SAT engine behind the CLI audits it right here: it counts — exactly — the condition assignments under which your workflow deadlocks or livelocks (#F), and lists the structural issues.
The prefilled example has a real bug: the Critic may only exit while retry_count < 3 —
the very condition that keeps it looping. When the count hits 3, every exit is disabled. Run it and watch the engine catch it.
β Under these conditions the agent can bounce between the two nodes with no enabled exit.
Exhaustive 2βΏ Counting
A 20-variable formula has 1,048,576 assignments. 10,000 prompt evals sample under 1% of them. SharpLogic counts the satisfying assignments exactly β every one β with component decomposition and subproblem caching. Sparse workflow formulas resolve in microseconds; dense random formulas hit the exponential wall like every exact counter.
Exact Counterexamples
Instead of ambiguous probability scores, SharpLogic isolates the exact edge conditions where your agent crashes, loops infinitely, or bypasses human approval gates.
Self-Synthesizing Patch
Once a trap is detected, SharpLogic synthesizes blocking clauses from the solverβs own counterexample assignments, generalizes them literal by literal, and re-counts #F exactly after every round. The reported patched count is the engineβs real recount β and the loop stops when it reaches 0 or the round budget ends.
FREQUENTLY ASKED QUESTIONS
from sharplogic import AgentGuard, which audits your whole workflow graph exactly and checks individual transitions against the current conditions at runtime; and (2) Standalone CLI (install.py), which audits exported LangGraph/Dify workflow JSON offline β graphs with up to 16 distinct condition atoms by exact enumeration; larger graphs go through the CNF engine in the full package.
install.py script and the AgentGuard engine run 100% locally on your machine. Zero cloud API calls, zero prompt leaks, and $0 token cost.