Skip to content

Start building

Trust and control

AI agent security: guardrails, egress rules and audit

AI agent security is the set of controls that limit what an agent can read, what it can change, where it can connect and what it can spend, and that record everything it did. Because a model can be wrong or be tricked, those controls must sit in the software around the model, not in its prompt.

Updated · 6 min read

What are the main security risks of AI agents?

  • Prompt injection: instructions hidden in an email, a web page or a tool’s result that the model follows as if they came from you.
  • Too much access: an agent given every tool “just in case” can do every kind of damage.
  • Data leaks: sensitive data sent to a model provider, written to logs or returned to the wrong person.
  • Requests to internal systems: a tool that fetches addresses can be pointed at internal services, a problem known as server-side request forgery.
  • Runaway runs: loops that call the model or a tool again and again, and the bill that follows.
  • Changed tools: an outside tool or agent whose description changes after you approved it.
  • No record: when something goes wrong, nobody can say what the agent did, or why.

Why can’t the prompt keep an agent safe?

Instructions such as “never delete anything” are requests to a model, not rules. A well-crafted message in the agent’s input can talk the model out of them, and models also simply make mistakes. Write good instructions, but enforce every rule that matters somewhere the model cannot reach: in permissions, approvals, network rules, limits and logs.

What guardrails should an AI agent have?

Each risk has a control that works whatever the model decides. This is how MyDeepAgents answers each one:

  • Prompt injection

    Control
    Treat outside content as data; ask before writes
    In MyDeepAgents
    Tool results reach the model marked as data, not instructions; any tool can be set to ask a person first
  • Too much access

    Control
    Least privilege
    In MyDeepAgents
    Each agent gets only the tools listed for it; cloud connections start read-only, and database writes stay off until allowed
  • Data leaks

    Control
    Redaction and topic limits
    In MyDeepAgents
    Card numbers are always masked before the model; optional redaction of emails, phone numbers, IBANs, US Social Security numbers and IP addresses; optional blocked topics
  • Requests to internal systems

    Control
    Egress rules
    In MyDeepAgents
    HTTPS only, private and reserved addresses refused, each connector limited to its own hosts
  • Runaway runs

    Control
    Limits and budgets
    In MyDeepAgents
    Caps on model calls, active time and cost for every run, plus organization and workspace budgets
  • Changed tools

    Control
    Pinning
    In MyDeepAgents
    MCP tools and outside agents’ cards are pinned by a hash and stop when they change, until a person reviews them
  • No record

    Control
    Audit
    In MyDeepAgents
    An audit log the application can add to but never change

The personal data redaction swaps each value for a placeholder before the model sees it and puts the real value back afterwards, outside the model’s view. Detection is pattern-based and best effort: it lowers exposure, it is not a guarantee, which is why it sits beside approvals and limits rather than replacing them.

What are egress rules, and why do agents need them?

Egress rules decide where outbound connections may go. An agent that can call an HTTP tool or an outside server could otherwise be steered to your cloud’s internal metadata service or to a private network.

In MyDeepAgents every outbound call, from connectors, MCP servers, outside agents and workflow HTTP steps alike, passes the same checks in code:

  • HTTPS only, on port 443 unless a connector’s own server needs another port, and never on ports such as SSH, mail or database ports.
  • A raw IP address as the host is refused.
  • The host name is resolved once. If any of its addresses is private or reserved, the call is refused; otherwise the connection goes to the address that was checked, so a DNS answer cannot change between the check and the call.
  • Redirects are checked again at each hop, three at most.
  • Each connector reaches only its own hosts, the generic HTTP connector only the hosts you list, and a tenant can narrow the allowed hosts further.

How should an agent’s actions be audited?

An audit trail should answer who did what, when, on whose behalf, and whether it was allowed. In MyDeepAgents each audit entry records the actor, the tenant, any delegation in use, the action, the resource, the decision (allowed, refused by permissions or refused by policy), the reason, and the address and browser it came from. When something is changed, the entry names the fields, not their values.

The application can add audit entries and read them, but the database does not let it change or delete them. Entries can be exported as CSV, and the export is audited too. Each run also keeps its own record: every model call with its tokens and cost, and every tool call with its input and output, stored encrypted. Operational logs carry no customer content.

How do compliance profiles change an agent’s rules?

Each MyDeepAgents agent runs under one of three profiles: Standard, Privacy or HIPAA. The profile adds rules on top of everything above.

  • Privacy: website chats show a consent notice, notifications carry links instead of content, and webhooks that only check a static token are refused.
  • HIPAA: agents use only models on routes covered by a business associate agreement, which today are Claude models on Amazon Bedrock; every read of a person’s content is audited; console sign-in needs multi-factor authentication without text-message codes; and website chats need a signed-in visitor before tools that handle health data.

A profile is a set of technical rules, not a certificate. If you plan to process health data, talk to us first, so the right agreements are in place.

What does an AI agent security checklist look like?

  1. Give each agent only the tools it needs, and read-only access where that is enough.
  2. Set approvals on every action that changes data others will see or that is hard to undo.
  3. Keep credentials in the platform’s vault, never in instructions.
  4. Set limits on steps, time and cost for every agent, and budgets for every team.
  5. Restrict outbound calls to known hosts.
  6. Pin outside tools and agents, and review changes before trusting them again.
  7. Read the audit log and real runs regularly, especially in the first weeks.

Key points

  • Agent security means limiting what an agent can read, change, reach and spend, and recording what it did.
  • Rules in a prompt are requests; real rules live in permissions, approvals, egress rules, limits and logs.
  • Treat every tool result and outside message as data, never as instructions.
  • MyDeepAgents checks every outbound call, masks card numbers, can redact personal data and keeps an append-only audit log.
  • Compliance profiles add stricter rules per agent, from consent notices to BAA-covered models.

Questions people also ask

What is prompt injection?

Prompt injection is text written to make a model ignore its instructions, hidden in content the agent reads, such as an email, a web page or a tool’s result. The defence is to treat that content as data and to require a person’s approval for actions that matter.

Can an AI agent leak my API keys?

Not if the keys never reach it. In MyDeepAgents credentials are encrypted, opened only by the worker that makes the outbound call, and never put into a prompt or sent to a browser.

Are guardrails like personal data redaction perfect?

No. Pattern-based detection lowers exposure but can miss things. That is why redaction sits beside approvals, least privilege, limits and an audit log rather than replacing them.

Can anyone edit or delete the audit log?

Not through the application. In MyDeepAgents the database lets the application add and read audit entries but not change or delete them.

Early access

Put an agent to work

Build an agent, connect it to your tools, and decide what it may do on its own. Or tell us what you want it to do.