Field noteOct 31, 20265 min read1 source

stategate: open-source library enforces agent tool-call rules with trusted state and a tool dependency graph

In one minute

stategate is a new MIT-licensed Python library that places deterministic checks in front of AI-agent tool calls. Builders define state and per-tool requirements in code, so a prompt cannot by itself authorize an action such as issuing a refund before identity and order checks pass.

What changed: Stategate adds a distinct open-source guardrail design: trusted code-controlled state plus a tool-dependency graph, rather than safeagents’ local proxy or Concordat’s typed session protocols.

What happened

The public GitHub repository describes stategate as deterministic tool guardrails for agents, built around trusted state and a tool dependency graph. Its central distinction is between instructions the model receives and facts the application controls. Developers declare state variables such as identity_verified, order_id, or order_status; the agent may read them but cannot write them. State changes only through application code or configured effects triggered by a tool's result.

Each tool can declare preconditions on trusted state, checks on its own arguments, prerequisite tools, and a maximum call count. In the repository's example, issue_refund requires verified identity, a found order, a matching order ID, and an amount no greater than the recorded total. It also has a one-call limit. These are code-enforced conditions rather than a request in the system prompt.

A guard sits in front of the tool function. If a requirement fails, the function is not called. The agent instead receives an explanation of the unmet conditions and suggested tools or order of operations that could satisfy them. The example blocks a refund until identity verification and order lookup have succeeded. This gives the model a recovery path without allowing the rejected operation to run.

The dependency graph is derived from requirements and effects rather than drawn manually. The project says it can detect circular dependencies, misspelled references, and tools that can never run, and can render the graph for human review. The README describes installation from GitHub using pip; the core needs Pydantic and PyYAML. Optional extras are provided for OpenAI Agents SDK and Claude Agent SDK adapters, and the README says the library works with those SDKs or other frameworks. It is an early repository, and the supplied material gives no published performance measurements or independent security evaluation.

What the archive adds

This is a new release in a recurring runtime-control thread, rather than a restatement. safeagents checks agent tool calls before execution, while JevAct describes a compiled-policy decision gate. stategate adds a distinct mechanism: application-owned state, argument conditions, call limits, and a dependency graph.

Trend signal

The release supports agent security moves to runtime boundaries: its guard checks conditions at the point an agent tries to invoke a tool, rather than relying on prompt compliance. It is one small library, however, not evidence that runtime guards are becoming a standard or that they remove other security risks.

Why now

The repository's rationale is that prompt rules can be forgotten, overridden by user input or injected content, and fail to prevent incorrect tool arguments. Its proposed response is to make authorization conditions executable and inspectable. The source does not explain a market trigger or a broader release timeline.

Connections to other events

An earlier Telegram post described treating every tool call as a transaction with an actor, permission, context, and a rollback or appeal path. stategate addresses part of that idea with pre-call conditions and trusted state, but the repository does not describe rollback or appeal mechanisms. The archive's broader metadox, Reusable agents spread faster than trust does, frames the same tension between reusable agent workflows and the controls needed around them.

Why it matters

For teams building agents that can spend money, disclose data, or take hard-to-reverse actions, prompts alone are a weak place to enforce mandatory sequencing and argument constraints. stategate offers a way to make those constraints explicit at the tool boundary, keep authorization-relevant state outside the model's direct control, and let rejected calls explain how to proceed. The graph can also make dependencies easier for developers to review.

That is useful as a design pattern even before this particular library is adopted: define which facts must be established, which code may establish them, and exactly which arguments a consequential action can accept. Teams still need to decide whether the guard is correctly integrated with every tool and whether its policy matches business rules. The library's README demonstrates a mechanism, not a complete security architecture.

Limits and uncertainty

The supplied repository material does not establish that stategate has been independently audited, tested against a defined prompt-injection suite, or used in production. It gives no comparative evaluation, reliability numbers, or evidence that its adapters cover every behavior of the named SDKs. A guard can enforce only the policies configured and the calls routed through it; the source does not show protection against unsafe application code, compromised tools, or incorrect effects. The project is very new, so its maintenance, adoption, and compatibility over time are unknown.

Skill to build now

For one consequential workflow, write down the trusted facts required before each tool can run, who or what is allowed to set those facts, and the argument invariants the tool must enforce. Then test blocked cases as well as the successful path: missing verification, mismatched record IDs, excessive amounts, and repeated calls. This exercise is directly applicable whether or not a team adopts stategate.

Reader takeaway

stategate turns tool-use rules into executable preconditions: state is controlled by code, calls can be blocked before execution, and dependencies can be inspected. Treat it as a concrete runtime-guard pattern to evaluate, not as evidence that an agent is secure by default.

Evidence / sources

  1. 1github.com/MBoustani/stategate
All Field Notes

Next reads

Read next

Open the graph
  1. 01topicClaudeExplore the claude topic hub.
  2. 02topicGithubExplore the github topic hub.
  3. 03archiveField NotesOpen the latest editorial analysis.
  4. 04source ledgerSource LedgerInspect the public source evidence graph.
Who read this page?Machine requests, hidden until opened

Loading the privacy-safe route aggregate...

Open the JSON contract