> ## Documentation Index
> Fetch the complete documentation index at: https://docs.formal.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Control AI Agents

> Limit what coding agents on laptops and in cloud sandboxes can push, merge, install, and reach

## Overview

Coding agents run commands with the same access as the person who started them.
Formal identifies the agent behind each connection and applies policies to that agent alone.

## How Formal helps

The [Endpoint](https://docs.formal.ai/docs/guides/client-apps/desktop-app.md) runs on the laptop or sandbox where the agent runs.
[Network rules](https://docs.formal.ai/docs/guides/network-rules.md) match traffic by [process identity](https://docs.formal.ai/docs/guides/network-rules.md#process-identity), so a rule can target Claude Code and leave your browser alone.
[Policies](https://docs.formal.ai/docs/guides/policies/introduction.md) then block, rewrite, or log each request.

## Roll it out

**1. Install the Endpoint where agents run**

Use [MDM](https://docs.formal.ai/docs/guides/integrations/mdm.md#endpoint-rollout) for laptops. For sandboxes, see [Prevent Cloud Agents from Auto-Merging PRs](https://docs.formal.ai/docs/guides/example-use-cases/formal-endpoint-cloud-agents.md).

**2. Turn on Transparent Mode**

See [Transparent Mode](https://docs.formal.ai/docs/guides/client-apps/transparent-mode.md).

**3. Intercept agent traffic**

Write a [network rule](https://docs.formal.ai/docs/guides/network-rules.md) that matches the agents and destinations you care about.

**4. Write a policy**

Start from a guide below, and test it in [dry-run mode](https://docs.formal.ai/docs/guides/policies/operations.md#2-dry-run-mode) first.

**5. Verify in the logs**

Trigger the action from the agent, then find the blocked request in [Logs](https://docs.formal.ai/docs/guides/observability/logs.md).

## Guides

> [card] [Block agent Git pushes](https://docs.formal.ai/docs/guides/example-use-cases/block-agent-git-pushes.md)
>
> Stop pushes to sensitive repositories over SSH and HTTPS

> [card] [Prevent cloud agents from auto-merging PRs](https://docs.formal.ai/docs/guides/example-use-cases/formal-endpoint-cloud-agents.md)
>
> Cover Cursor and Devin cloud agents

> [card] [Restrict Codex Desktop to LLM and MCP](https://docs.formal.ai/docs/guides/example-use-cases/restrict-codex-desktop-egress.md)
>
> Allow only LLM and approved MCP egress

> [card] [Block malicious package downloads](https://docs.formal.ai/docs/guides/example-use-cases/block-malicious-package-downloads.md)
>
> Block installation packages (npm, pypi) that Socket.dev flags

> [card] [Protect Git tokens in command lines](https://docs.formal.ai/docs/guides/example-use-cases/protect-git-tokens-in-command-lines.md)
>
> Block tokens on command lines and encrypt them in logs

> [card] [Install the Endpoint on Grok Bot](https://docs.formal.ai/docs/guides/example-use-cases/formal-endpoint-grok-bot.md)
>
> Cover Grok Bot computers and block Gmail

## Recipes

[Recipes](https://docs.formal.ai/docs/guides/getting-started/recipes.md) create this configuration for you in the Control Plane.

* **Block agent Git pushes:** blocks pushes to protected GitHub repositories.
* **Prevent Merges by Cloud Agents:** blocks merges while agents can still prepare changes.
* **Block AI Agents:** blocks specific agents, unapproved agents, or agents running without human confirmation.

## Next Steps

> [card] [Keep credentials from agents](https://docs.formal.ai/docs/guides/use-cases/keep-credentials-from-agents.md)
>
> Inject secrets outside the agent's reach

> [card] [Govern AI usage](https://docs.formal.ai/docs/guides/use-cases/govern-ai-usage.md)
>
> Discover and approve AI harnesses


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.