Guardrails for AI agents that call tools

Agents that call tools can change records, send messages and move money when a prompt goes wrong. This page covers the controls, evidence and self-hosted platform choices that limit that action.

On this page

Why guardrails for AI agents that call tools need their own design

When an agent can reach internal systems through tools, a prompt injection or a confused plan stops being a bad answer and becomes a real action: a ticket closed, a record changed, a file sent outside. The answer is to limit tool execution at the boundary where the call is made, not only in the prompt. Chat guardrails that screen text for toxicity or leaked identifiers do not stop an agent from calling a tool it should not call, with arguments it should not send. Once the model can act, the control point moves to the tool call itself: execution rails that validate the tool name, arguments and target before anything runs.

In practice the short answer on platforms is three layers. NeMo Guardrails supplies execution rails for custom actions and tools, configured in Colang. An AI gateway such as LiteLLM or Apache APISIX sits between the agent and its model and tool endpoints, so enforcement does not depend on every application team wiring checks correctly. Langfuse or Phoenix records each proposed and executed action for review. Before choosing, confirm the current path for NeMo Guardrails: NVIDIA has sunset the NeMo Microservices container, and its archived documentation points existing users to NeMo Platform and to their NVIDIA account team. The library itself is at release 0.25.0 (published November 19, 2026) under Apache-2.0, and the NeMo Guardrails repository is the place to confirm which release and deployment model your team can support.

Decide early which layer owns each control, because a rail that only runs inside one application can be bypassed by another client calling the same model. Ask the implementation partner to show, for each tool, where the allowlist lives, which identity the call uses, and where a blocked call is logged. Confirm with the vendor that any version you pick supports the tool and gateway integrations you need, and test that a blocked action stays blocked when the prompt is adversarial.

Requirements an agent guardrail design must meet

This table lists the requirements a guardrail design for tool-calling agents should satisfy, the source behind each one, and what it means for the build. Read each row as a question to answer before choosing a framework, since the source determines who sets the requirement and what evidence they will ask for. The main takeaway is that logging and approval duties are the requirements most likely to be missed when a guardrail library is treated as the whole control.

RequirementSource of the requirementWhat it means for the build
Per-tool allowlist for every action an agent can takeOrganization's own security policy and the control owner for each connected systemDefine named tools and permitted arguments before the agent runs. Execution rails in NeMo Guardrails or validators in Guardrails AI can enforce checks, but the allowlist itself must be written and approved by the owner of each system.
Human approval for risky actionsOrganization's own security policy and business owner of the affected processClassify actions such as payments, deletions, external messages and permission changes as risky. Route them to a person before execution, and record who approved what and when.
Scoped credentials for each toolOrganization's own security policy and identity teamGive each tool its own service identity with the least privilege needed for that tool. Do not let the agent reuse a broad user or admin token. Confirm how your identity platform issues and revokes these credentials.
Logging every tool call, input and outputEU AI Act Article 12(1) for high-risk systems, which requires automatic event logging over the system lifetimeRecord the prompt context, the proposed tool call, the guard decision, the approval outcome and the result. Store logs outside the agent process so they survive failures.
Log retention periodEU AI Act Article 19(1), which requires providers to keep logs for at least six months unless other law provides otherwiseSet retention to at least six months for in-scope high-risk systems, or longer where sector law requires it. Confirm the applicable period with legal counsel.
Kill switch for agents and individual toolsOrganization's own incident response policy and control owner for the affected systemProvide an operator control that disables a tool or the whole agent without a redeploy. Test the switch during rollout, and log each activation.
Versioned guard policies with change controlOrganization's own change management policyKeep guard configurations in version control with reviews before release. Record which policy version handled each logged action so incidents can be traced.
Testing that each guard blocks what it shouldControl owner's expectation and internal assurance or audit teamsMaintain adversarial test cases for prompt injection and misuse of each tool, and rerun them after every policy or model change. Tooling such as NeMo Guardrails and Guardrails AI does not replace this testing.

How a tool call passes through the guardrail boundary

The flow starts with a user prompt that enters the input rails inside the organization's network before it reaches the model endpoint. When the model proposes a tool call, the call returns to the gateway, where execution rails check it against the tool allowlist and validate its arguments. Risky actions pause for human approval, and only then does the tool run with its own scoped credential. Every decision and action should be written to the action log, which is the artifact to review: confirm that blocked and approved calls are both recorded.

Trust boundaries between the organization network, model endpoint and external tools.

Execution rails, allowlists and approvals for each action type

Read-only tools return information such as account status, document search results or ticket history. The main risk is not that the tool changes anything, but that a manipulated prompt makes the agent query records it should not see or return data it should not disclose. Controls here focus on scope rather than approval. NeMo Guardrails execution rails can sit in front of each custom action or tool so that only approved actions run, and Guardrails AI validators can check the arguments the model supplies, such as identifiers and date ranges, before the call is made.

  • Tool allowlist: Register only the lookup functions the use case needs, and reject any tool name the model proposes that is not on the list.
  • Argument validation: Check identifiers against expected formats and reject wildcards or bulk queries that the business task does not require.
  • Scoped read credentials: Give each tool a service identity limited to the tables, indexes or API scopes it needs, so a bad query cannot reach beyond that scope.
  • Output filtering: Apply output rails to the returned data so personal or confidential fields are masked before the model sees them or the user reads them.
  • Logging: Record the tool name, arguments, row counts and the user or session that triggered the call.

Confirm with your security team which records count as confidential for each lookup, and whether the agent's identity can reach data that its user could not access directly.

Which open-source platforms fit agent tool guardrails and why

An agent guardrail stack usually needs controls in three places: inside the agent runtime before a tool runs, at the gateway that carries model and tool traffic, and in the trace record that shows what happened. The platforms below each cover one of those points, and none of them replaces the others, so the choice depends on where your agents call tools and who needs to review the evidence.

NeMo Guardrails for execution rails

NeMo Guardrails supports execution rails, which check custom actions and tools before they run, and it configures rails in the Colang language. It is licensed under Apache-2.0, and release 0.25.0 was published on November 19, 2026. NVIDIA has sunset the NeMo Microservices container, so a server deployment should not rely on that artifact. NVIDIA directs existing users to NeMo Platform, and the repository now resolves to NeMo Helix, which runs NeMo Guardrails as a gateway plugin. Confirm with NVIDIA which path is supported for your environment and whether Python 3.11 to 3.13 fits your image build.

NeMo Guardrails docs

Guardrails AI for argument validation

Guardrails AI runs validators from Guardrails Hub on inputs and outputs, and it can generate structured output that matches Pydantic models. For agents, this fits checks on tool arguments before a call, such as regex limits on identifiers, value ranges on amounts, or schema conformance of the call payload. It is Apache-2.0 licensed. Confirm which validators you need are published on the Hub, whether you must write custom validators, and how validator failures are returned to the agent loop.

Latest release
v0.11.0
Guardrails AI repository

LiteLLM for gateway enforcement

LiteLLM sits between agents and model providers, so it can apply guardrails, budgets and key scoping to every model call the agent makes. Because it sees traffic outside the agent code, it gives a control point that a compromised or misconfigured agent cannot skip by default. It is MIT licensed except for the enterprise directory. Confirm which guardrail hooks you need are in the open source tier, how virtual keys map to individual agents, and whether logs are complete enough for review.

Latest release
v1.105.1

Apache APISIX for tool traffic

Apache APISIX is a cloud-native API gateway and AI gateway, licensed under Apache-2.0. Where agents call internal REST services or MCP-style tool endpoints, APISIX can enforce route-level authentication, rate limits and request inspection in front of those tools. This fits organizations that already run APISIX for APIs and want one policy plane for agent tool calls. Confirm whether the AI gateway features you need are present in your version and how tool permissions are expressed per consuming agent.

Latest release
3.19.0

Langfuse for action traces

Langfuse records traces of agent runs, including the prompts, model calls and tool invocations behind each action, so reviewers can reconstruct what an agent did. Its core features are MIT licensed except the ee directories. Self-hosted features that security teams often need, including audit logs, project-level RBAC and data retention policies, require an Enterprise license key. Confirm which of these controls you need before you plan the deployment, and confirm the infrastructure it requires, which includes PostgreSQL, ClickHouse, Redis or Valkey, and S3-compatible storage.

Latest release
v4.63.0
Langfuse license key docs

How scoped credentials limit damage from a hijacked agent

Each tool should hold its own least-privilege identity, and that identity should be short-lived wherever the tool supports it. When a prompt injection succeeds, the attacker inherits whatever the agent can reach. If every tool shares one administrative key, a single hijacked session can read a CRM, write to a ticketing system and export a file store in one run. Give each tool a separate service account limited to the specific operations and resources it needs, and confirm with each vendor which token lifetimes, rotation and scope restrictions their API supports. Keep credentials out of the system prompt, out of tool descriptions and out of anything the model can echo back. A key placed in the prompt is effectively disclosed to the model, and from there to any output the model produces.

The gateway or tool broker, not the agent, should hold the keys. In a design where the model requests a tool call and a component you operate executes it, the secret lives in that component's secret store, and the model only sees the tool name and result. Decide what the agent may see in tool responses before you build the tools. Strip session tokens, internal hostnames, personal data not needed for the next step and stack traces from results, because anything returned to the model can be quoted, summarized or exfiltrated in the next answer. Where the platform supports it, pair the gateway with an audit trail that records which identity executed each call. LiteLLM and Apache APISIX are open-source gateways that can sit in this position, but whether either one manages your specific credential flows is a question to confirm in your own environment.

Test the credential model the way an attacker would. Use a red-team exercise to ask whether a hijacked session can reach a tool it should not use, whether a leaked token works outside its intended window, and whether a tool error exposes a secret. Record the results as evidence for your security review. Scoped credentials do not replace input and output rails, and they do not stop an agent from misusing permissions it legitimately holds, so treat them as the limit on damage, with the guardrails as the first line of defense. Ask any implementation partner to show how each tool's identity was created, how its secret is stored and rotated, and what the agent receives back from each call.

How an agent guardrail rollout runs, phase by phase

The sequence moves from knowing exactly what an agent can reach to proving, in staging and then production, that its tool calls stay within policy and can be stopped. Each phase ends with a named artifact that the security, platform and compliance teams can review.

  1. Inventory every tool and its permissions

    List every tool, connector, MCP server and API the agent can call, along with the systems behind each one, the operations it exposes (read, write, delete, send, pay) and the credentials it currently uses. Platform engineering and application owners do this together, because the people who built a tool often know its write paths better than the documentation does. The phase is done when the tool register lists each tool, its owner, its data sensitivity and its permissions, and every entry has been checked against the live configuration rather than a design document.

  2. Classify actions by risk

    Sort each tool operation into risk tiers, for example read-only, reversible write, irreversible or financial action, and actions touching regulated or personal data. The classification decides which calls run automatically, which need a human approval and which are never allowed for an agent. Security and business owners sign off on the tiers. The output is a risk matrix that maps every operation to a tier and an owner, and it becomes the reference for the allowlists and approval rules in the next phase.

  3. Set allowlists and scoped identities

    Write allowlists that name the exact tools, operations and argument patterns the agent may call, and deny everything else by default. Create a separate service identity for each tool with the narrowest scope the business function needs, rather than sharing one broad token across the agent. Credentials stay in the organization's secrets store, not in prompts or agent configuration. The phase is complete when policy files are kept under version control with a named reviewer for each change, and a test shows that an unlisted call is refused with the identity the agent was given.

  4. Add execution rails and approvals in staging

    Attach execution rails to the tool calls, so each call is checked against the allowlist and argument rules before it runs, and route tier-three actions to a human approval step that shows the requested action, its parameters and the context. NeMo Guardrails supports execution rails for custom actions and tools, and Guardrails AI validators can check tool arguments, so confirm which fits the agent framework in use. Run all of this in a staging environment with copies of the tools, not live systems. The output is a staging build with configured rails, an approval workflow with its tested escalation path, and recorded results for normal, blocked and approved calls.

  5. Enable action logging

    Log every tool call with the user or session, the prompt reference, the requested action, the arguments after redaction, the policy decision, the approver where one applied, and the result. Send these records to storage the security team controls, separate from the agent's own runtime. Observability platforms such as self-hosted Langfuse can record traces, though its core is MIT licensed while some features such as audit logs and data retention need an Enterprise license key, so confirm that requirement before choosing it. Check the logging scope against the record-keeping duties of the EU AI Act where they apply. The phase is done when a test call produces a complete, queryable record in the security store.

  6. Run injection and tool-misuse tests

    Test the staged agent with prompt injection attempts placed in user input and in retrieved content, attempts to make the agent call tools outside its allowlist, attempts to pass unsafe arguments such as broad queries or mass deletions, and attempts to reuse credentials. A security testing team can run this and record each attempt, expected result and actual result. Failed cases become fixes to policy or rails, followed by a retest. The output is a findings report with a retest record that shows each control blocked or escalated the attempt, with the remaining gaps listed and owned.

  7. Roll out with a kill switch and runbook

    Release the agent to production for a limited user group first, with tier-three actions still behind approval. Confirm that a kill switch can disable tool access for the whole agent, or for a single tool, without a redeploy, and test it under real conditions. Write a runbook covering who can trigger the switch, how to review blocked calls, how to change policy through version control and how incidents are reported. The rollout is complete when the kill switch has been exercised, the runbook has been accepted by the operations and security owners, and the policy files, test results and logs are filed as the evidence for the system.

Evidence reviewers ask for and which component produces it

This table maps each piece of evidence a security or compliance reviewer typically asks for on an agent that calls tools to the component that produces it. Read it as a checklist: if a row has no named owner in your design, the evidence will likely be missing at review time. The main takeaway is that no single product produces the whole evidence set, so the tool inventory, policy versions, approvals and logs must be designed together.

EvidenceProduced byWhat the reviewer checks
Tool inventoryGateway or agent configuration export, reviewed against the tool registryEvery tool an agent can call is listed, with its owner, data sensitivity and whether it writes or only reads
Policy versionsNeMo Guardrails or Guardrails AI configuration kept in version controlWhich execution rails and validators were active on a given date, and who approved each change
Tool allowlist and scoped credentialsGateway routing rules and the secrets manager that issues per-tool credentialsEach agent identity can reach only its approved tools and no long-lived shared key is in use
Human approval recordsThe approval workflow system that holds risky actions until a person signs offWho approved which action, when, with what request details, and whether the approver differed from the requester
Per-action logs with user and tool identityLangfuse traces or OpenTelemetry spans exported from the agent runtime and gatewayEach tool call links to the end user, the agent identity, the arguments and the result
Blocked-action logsExecution rail and gateway deny events written to the same log storeRefused calls are recorded with the rule that fired, so the team can tune rules and show the control worked
Test resultsSecurity test reports for prompt injection and tool misuse, with retests after fixesInjected instructions were tested against each high-impact tool and the findings were closed or accepted
Retention settingsLog store configuration in the self-hosted Langfuse or SIEM deploymentRetention period meets the period the organization has set for the system and any Article 19(1) minimum

Questions buyers ask before hiring help with agent tool guardrails

What drives the effort and cost of guardrails for an agent that calls tools?

The effort follows the number of tools, how many of them change state (write to systems, send messages, move money, change access), and how many distinct approval paths the business needs. Each tool needs its own execution rule, credential scope and log fields, so a catalog of twenty tools with three risk classes costs more to design and test than five read-only tools. Recurring work includes reviewing approval queues, updating allowlists when tools change, rotating scoped credentials and re-running abuse tests after model or prompt changes. Ask any partner to price these items separately in the written scope: discovery of the tool inventory, rule design, implementation in the chosen framework, testing, and handover to your operators. Ask which items are one-time and which recur.

How long does a first phase of agent tool guardrails usually take?

No duration can be stated here from the supplied facts, so confirm it in the written scope rather than relying on a general figure. The main variables are how complete your tool inventory is, how many systems sit behind each tool, whether approvals must route through an existing workflow or ticketing tool, and how many owners must sign off on risk classes. A first phase is usually bounded to a defined set of agents and tools, with the remaining tools added in later phases. Ask for the phase boundary, the list of tools in it, the acceptance tests and the retest plan, and check that each is written down before work starts.

What must our organization supply before a partner can start?

Three inputs decide whether the work can start on schedule: a tool inventory, named owners for each tool and a risk class for each action. The inventory lists every tool an agent can call, the system behind it, the operations it allows (read, create, update, delete, send) and the data it can reach. Owners are the people who can approve a change to a tool's permissions and who answer for its actions in an incident. Risk classes group actions, for example read-only, reversible writes, and actions with external or financial effect, so each class can map to an execution rule and an approval step. You also need the identity provider, the existing logging destination and a test environment where agents can run without touching production data.

Can our internal engineering team build agent tool guardrails without a partner?

Often yes, if the team already runs the agent framework, owns the identity provider and can write and test policy code. The work is mostly engineering and testing, not new research: wrapping each tool with an execution check, issuing scoped credentials per tool, building an approval step and shipping action logs to a store that reviewers can query. Teams without recent security testing experience tend to find the gaps in testing hardest, because prompt injection and misuse of tool arguments need deliberate attack cases. Decide early who will maintain the rules after handover, who reviews the approval queue and who runs retests after each model change. A partner is useful when you want an independent test of the setup or a fixed-scope delivery with written acceptance criteria.

Do NeMo Microservices users have to move to a different product?

NVIDIA has retired the NeMo Guardrails microservice. Its NGC catalog page says NeMo microservices has been sunset as of October 1, 2026, that there will be no new releases and that the artifact is no longer supported. NVIDIA's archived documentation says new development has moved to NeMo Platform and asks existing users to contact their NVIDIA account team about next steps. The NeMo Guardrails library itself is a separate Apache-2.0 project, and its current release is 0.25.0, published on November 19, 2026. Confirm with your NVIDIA account team which path applies to your contract and deployment, and check whether your rails and configurations run on the library, the NeMo Platform, or both, before you choose the target.

How do action logs help with EU AI Act record-keeping for agents?

Article 12(1) of the EU AI Act requires high-risk AI systems to technically allow for the automatic recording of events over the system's lifetime, and Article 19(1) requires providers to keep those logs for at least six months unless other law provides otherwise. For agents that call tools, the useful log records each tool call, its arguments (with personal data handled under your privacy rules), the rule that allowed or blocked it, any approval decision and its approver, the credential used and the outcome. Logs that cover only the chat transcript miss the actions that matter. Whether an agent is high-risk depends on its use case, so confirm the classification with your legal and compliance team. DeployOpen prepares systems and evidence for compliance assessments, but does not issue audit reports or certifications.

Does a guardrail framework stop an agent from misusing a tool it is allowed to call?

No single control does. Execution rails check each tool call against policy before it runs, allowlists limit which tools and arguments are permitted, and human approval covers actions with high impact. Scoped credentials limit what a compromised or misled agent can reach, and logs let reviewers see what happened. Together they reduce the damage a bad prompt can cause, but they do not make the model itself reliable. Ask any partner which failure cases its tests cover, how it tests prompt injection that arrives through documents or tool results, and what it will not cover. Confirm these in the written scope rather than assuming a framework covers them by default.

What to ask an implementation partner about agent tool guardrails

Start by asking how the partner tests prompt injection against the tools themselves, not only against the model. Ask for a test plan that feeds hostile instructions through every channel the agent reads (user messages, retrieved documents, tool outputs) and records whether each attempted call reaches an execution rail, a denied tool call or an approval request. Ask which tools were in the test scope, who wrote the injection cases, and how a failed case is reported and retested. A partner who only demonstrates a blocked prompt in a chat window has not tested the agent's permissions.

Next, ask how credentials are scoped. The partner should explain which identity each tool runs under, whether each agent has its own service account or token per tool, which permissions those carry, and how short-lived those credentials are. Ask where approval logic lives: in the guardrail configuration, in the gateway, in the workflow engine, or in the tool service itself. Each location has different failure modes, and the answer determines whether a bypass in one layer leaves the others in place. Ask who can approve a risky action, how approvers are authenticated, and what happens if no approver responds.

Then ask how policy changes are versioned, reviewed and retested before they reach production, and how the action log is structured. Request a sample record and check that it includes the agent and user identity, the tool and arguments, the policy version applied, the decision and its reason, the approver where one was involved, and the downstream result. Confirm how the log is protected from alteration and how long it is retained. For the NeMo Microservices sunset, ask the partner which NeMo Guardrails release and deployment path they recommend, given that NVIDIA's NeMo Microservices archived documentation says new development has moved to NeMo Platform, and ask them to confirm the support status of any component in writing before the work starts.

How DeployOpen scopes and supports agent tool guardrails

DeployOpen plans, implements, tests and documents guardrails for AI agents that call tools inside the client's own infrastructure. Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts, and ongoing support is available as a retainer.

How we scope

  • We inventory every tool, API and file path the agent can reach and record which ones write, delete or send data.
  • We agree which actions run automatically, which need allowlisting and which require a named human approver.
  • The written scope lists the agent platform, model endpoints, identity provider and logging targets in your environment.
  • We confirm with your security team which credentials each tool uses and who owns the approval workflow.

How we build

  • We configure execution rails and tool allowlists in the chosen framework, such as NeMo Guardrails or a gateway policy layer.
  • We issue a separate, narrowly scoped credential for each tool and remove standing administrative access from the agent.
  • We wire approval steps for risky actions and log each tool call, its arguments and the decision to your audit store.
  • We test prompt injection against tool use, including attempts to change permissions, exfiltrate files and bypass approvals.

How we hand over

  • You receive configuration files, permission matrices and deployment documentation for your own repositories and teams.
  • The findings report lists each failed test, the fix applied and the retest result, so reviewers can trace every decision.
  • We document how to add a tool, change a policy and roll back a guard change under your change management process.
  • Handover includes a walkthrough with the engineers and security staff who will run the agent day to day.

How we support

  • Retainers cover upgrades of the guardrail framework, the gateway and the logging stack as new versions are released.
  • Continuous testing repeats prompt injection and permission checks when new tools, agents or models are added.
  • We prepare control evidence, such as tool-call logs and approval records, for your compliance and audit teams.
  • Support requests follow the terms in the written agreement, and any change in scope is quoted and agreed before work starts.

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.