guardrail array, the same pattern used for tool, mcp, and knowledge_base.
In the Studio
1
Open the agent
Open the agent you want to attach the guardrail to in app.trugen.ai, or start creating a new one.
2
Go to the Guardrails tab
In the agent’s configuration tabs, open Guardrails.
3
Select one or more guardrails
Pick from your workspace’s guardrail list. There’s no cap. Attach as many as the conversation needs.
4
Save
Save the agent. The change takes effect on the next session. See When updates take effect below.
Via API
Guardrail attachment goes through the same agent endpoints as everything else attached to an agent:{id, name}, the same shape as the agent’s tool and mcp keys. Add more objects to attach more guardrails in one call.
"guardrail" key in GET /v1/ext/agent/{id}, alongside tool, mcp, and knowledge_base.
Via a template
Attach guardrails to a template instead of individual agents when you want every agent built from that template to inherit the same safety checks:Detaching a guardrail
If you only have the guardrail’sid you want to remove, fetch the agent first (GET /v1/ext/agent/{id}), drop that entry from the returned guardrail array, then PUT the rest back.
When updates take effect
Guardrails are fetched and embedded into an agent’s dispatch config exactly once, at the moment a new conversation is created. They’re never re-fetched mid-call. Any attach, detach, or edit you make after a call has already started has zero effect on that running call. It only applies to the next session. If you need a change to apply immediately, end the active session explicitly withDELETE /v1/conversation/{conversationId} after your update lands.
What’s Next?
Runtime Behavior
What happens the moment a guardrail fires, and the webhook payload it sends.
Creating a Guardrail
Field reference and how to write a prompt the LLM will act on.