New Your team’s decisions, in one playbook every coding agent works from. Never answer your agent twice

What is Fail-Closed?

2 min read Updated

Fail-closed is a security posture where if PolicyLayer cannot evaluate a policy — due to a configuration error, crash, or unexpected condition — the tool call is denied by default, ensuring no unvalidated operations reach the MCP server.

WHY IT MATTERS

Every security system must answer the question: "What happens when things go wrong?" There are only two answers. Fail-closed denies access when uncertain. Fail-open allows it. In the context of AI agents calling external tools with real-world consequences — creating charges, modifying files, deploying code — the safe answer is almost always fail-closed.

The reasoning is straightforward: the cost of a false denial (agent cannot complete a task, human intervenes) is almost always lower than the cost of a false allowance (agent executes an unvalidated operation with potentially irreversible consequences). A denied tool call is an inconvenience. An uncontrolled tool call could be a security incident, a financial loss, or a compliance violation.

Fail-closed is the default in mature security systems for good reason. Firewalls fail-closed. Kubernetes admission controllers fail-closed. Certificate validation fails-closed. These systems prioritise safety over availability because the consequences of uncontrolled access are worse than the consequences of denied access. The same logic applies to AI agent governance.

Fail-Closed isn't theory — define it as policy in PolicyLayer and it's enforced on every tool call.

ENFORCE THIS WITH POLICY →

Enforced before the call runs. Nothing to install.

HOW POLICYLAYER USES THIS

PolicyLayer defaults to fail-closed behaviour. If the policy evaluation pipeline encounters an error — malformed policy, unexpected argument type, internal error — the tool call is denied with a descriptive error message. This extends to startup: if policy files cannot be loaded or validated, PolicyLayer refuses to start rather than operating without policies. Fail-closed behaviour is configurable per-server for development environments where fail-open may be preferred.

FREQUENTLY ASKED QUESTIONS

When should I use fail-open instead of fail-closed?
Only during development or policy prototyping, when you want agents to operate freely while you observe and build policies. In any environment where tool calls have real consequences — production, staging with real data — use fail-closed.
Does fail-closed mean my agent stops working if there is a bug in PolicyLayer?
If PolicyLayer crashes entirely, the MCP client cannot reach the server at all (the proxy is down). If PolicyLayer encounters an error during policy evaluation for a specific call, that call is denied but others may succeed. PolicyLayer is designed to isolate failures to individual evaluations.
How do I avoid false denials in fail-closed mode?
Thoroughly test policies using dry-run mode and policy testing before deploying to production. Monitor the decision log for unexpected denials. Use policy linting to catch configuration errors before they reach runtime.

FURTHER READING

// THE REGISTRY

Every MCP server your agents touch has a registry record.

Type a name, get the breakdown: verified identity, auth posture, risk grade, every tool classified, recommended policy. Re-checked continuously.

Teams ship this data inside their own products. See what a licence covers →

Take your agents live. Without losing control.

Route your MCP traffic through PolicyLayer. Every tool call is checked against your policy before it runs: allow, deny, or require approval. Per-identity grants. Full audit log. Live in minutes.

Instant setup, no code required.

46,500+ MCP servers and 515,000+ tools scanned and risk-classified.

// GET IN TOUCH

Have a question or want to learn more? Send us a message.

Message sent.

We'll get back to you soon.