← Back to visual experience Alexey Vidanov

Why AI Agents Need Guardrails That Aren't Prompts

System prompts are suggestions. Shape is enforcement.

The Trust Problem

We're handing AI agents real tools — databases, APIs, payment systems, cloud infrastructure — and governing them with system prompts.

That's like giving an intern root access and saying "please be careful."

System prompts are suggestions. They can be ignored, overridden, or hallucinated around. When an agent has DELETE FROM users as a callable tool, "please don't delete anything important" is not governance. It's hope.

Tool Call ? Agent Outcome {Uncontrolled}

What Goes Wrong

Premature execution

The agent calls a write tool before it's finished reading. It sends an email based on incomplete data. It updates a record before checking if the update makes sense. There's no lifecycle — read and write are equally available at all times.

Partial failures

A 3-step workflow fails on step 2. Step 1 already executed. Step 3 never will. Your data is now in an inconsistent state that no one designed for. Databases solved this in 1978 with transactions. We still haven't solved it for AI agents.

Runaway costs

The agent makes 400 API calls in a loop. You find out when the bill arrives. By then, the damage — financial and operational — is done. Cost is a metric you check after the fact, not a control signal that changes behavior.

Invisible decisions

Something went wrong. You check the logs. You see what happened. You have no idea why the agent thought it was allowed to do it. Was it a governance gap? A misconfigured rule? A missing check? The logs don't say.

These aren't edge cases. They're the default behavior of every agent framework shipping today.

No governance Shape Governed

The Convergent Invention

Between December 2025 and March 2026, the industry converged on the same insight from different angles:

WhenWhoWhat
Dec 2025Shape v1Explore → Decide → Commit with tool mediation
Feb 2026Atomix (arxiv)Formal transactional model for agent tool calls
Mar 2026GalileoOpen-source agent governance (Apache 2.0)
Mar 2026AWS AgentCoreCedar-based policy enforcement
Mar 2026ForresterNames the category "Agent Control Plane"

Each solved part of the problem. None solved all of it.

The Four Missing Pieces

1. Phases

Agents should have an explicit lifecycle: Explore → Decide → Commit.

In EXPLORE, only read tools work. The agent gathers information. In DECIDE, it evaluates options and proposes actions — still read-only. In COMMIT, write tools unlock, but inside a transaction.

This isn't a convention. It's enforced. Call a write tool in EXPLORE and you get an exception, not a warning.

Why it matters

An agent that can write before it's done reading will eventually write something wrong. Phases make "read first, act later" structural, not aspirational.

2. Transactions

When an agent commits, its actions should be atomic. Either all steps succeed, or none of them stick.

Step 1: Update customer record  ✓
Step 2: Charge payment method    ✗ (fails)
Step 3: Send confirmation        (never runs)
→ Step 1 is automatically compensated (rolled back)

Why it matters

Partial failures create inconsistent state. Inconsistent state creates incidents. Incidents at 3 AM create regret.

3. Budget as a Control Signal

Most systems treat cost as a metric — something you observe after the fact. Shape treats it as a control signal that changes behavior in real time.

SpentWhat happens
< 50%Normal operation
≥ 50%DEGRADE — signal to reduce scope
≥ 75%FORCE_DECIDE — blocks COMMIT, forces re-evaluation
≥ 100%STOP — all tool calls blocked

Your agent doesn't just run out of money. At 75%, it's forced to stop and think.

Why it matters

A cost dashboard tells you what happened. A budget gate prevents what shouldn't happen.

4. Proof Traces

Every tool call should produce a structured record of why it was permitted. Not a log line. A decision chain:

Decision: ALLOWED
Tool: send_email
  ✓ Phase is COMMIT (required for irreversible tools)
  ✓ Transaction T1 is open (effects will be atomic)
  ✓ Budget: 12% spent (below all thresholds)
  ✓ Approval granted for irreversible tool
Executed in 0.003s

Why it matters

When something goes wrong — and it will — you need to know whether the system allowed it or failed to prevent it. That's the difference between a bug and a governance gap.

The Rule DSL

Writing governance rules shouldn't require learning Cedar, Rego, or Python evaluator classes. The people who define safety rules — product managers, compliance officers, team leads — don't write policy languages.

Shape uses a DSL that reads like English:

BLOCK send_email WHEN phase IS NOT commit
BLOCK * WHEN budget ABOVE 90%
REQUIRE APPROVAL FOR * WHEN tool IS irreversible
FLAG * WHEN time OUTSIDE 09:00-17:00

Parseable in ~100 lines of code. No LLM needed at runtime. Readable by anyone who needs to understand what the agent is allowed to do.

How It Looks in Practice

from shape import Agent, ToolEffect

agent = Agent("customer-service", budget=5.00)

agent.tool("lookup_customer", effect=ToolEffect.READ,         fn=lookup_fn)
agent.tool("update_record",   effect=ToolEffect.REVERSIBLE,   fn=update_fn)
agent.tool("send_email",      effect=ToolEffect.IRREVERSIBLE, fn=email_fn)

agent.rules("""
    BLOCK send_email WHEN phase IS NOT commit
    REQUIRE APPROVAL FOR * WHEN tool IS irreversible
""")

# EXPLORE — read only, safe
with agent.explore() as ctx:
    customer = ctx.call("lookup_customer", id="C-1234")

# DECIDE — evaluate, propose, no side effects
with agent.decide() as ctx:
    plan = ctx.propose(action="send_welcome", to=customer["email"])

# COMMIT — transactional, all-or-nothing
with agent.commit() as tx:
    tx.call("update_record", cost=0.01, id="C-1234", status="welcomed")
    tx.call("send_email",    cost=0.10, to=customer["email"])
    # if send_email fails → update_record is compensated

Three phases. One transaction. Full audit trail. The agent can't skip ahead.

The Design Philosophy

Governance should be external, not embedded. Shape wraps agents. It doesn't require agents to be built a certain way. LangGraph, CrewAI, Strands, raw Python — same pattern.

Rules should be readable by non-engineers. If the person responsible for compliance can't read the governance rules, the governance is theater.

Zero dependencies means zero excuses. One Python file. Copy it into your project. No package manager, no config server, no vendor lock-in.

Small is a feature. A single file is auditable in an afternoon. You can read every line of code that governs your agent. Try that with a managed service.

Who This Is For

Shape doesn't fix agent behavior.
It constrains it until only safe behavior survives.

GitHub → one file, zero dependencies