HomeGuidesAPI ReferenceRelease notes
Log In
Guides

Connect guardrails

Guardrail is an independent core service of the SUPERWISE® platform.

Connecting guardrails to your agent is a powerful tool to ensure your agents are production-ready and can act freely in their environment while complying with company regulations and maintaining strict activity boundaries.

Configuring guardrails via the UI

Your guardrails settings are part of what define an agent version. This means that if you want to change your guardrails configuration, you will need to publish a new version of your agent.

When used in your agents, if the guardrail service detects a violation of its policies (whether on the input or output), it will block the specific interaction and provide the user with a generic message indicating that the current interaction violates the agent's guardrails settings.

To read more about the available guardrail rules and how to configure them, please visit the dedicated guardrails guide.

📘

Test before you publish

It’s recommended to test your guardrails configuration before you publish. To do this, you can use the agent playground mode, which reflects how the guardrails will work in real life given the recent settings.

Configuring guardrails via SDK

Guardrails are added to the agent configuration as a list. To add guardrail rules to a given agent, publish a new version with guardrails configuration.

from superwise_api.models.agent.agent import BasicLLMConfig

# Your configured guardrails
guards = [guard for guard in guards]

agent_config = BasicLLMConfig(llm_model=model, prompt=prompt, guards=guards)

version = sw.agent.create_version(agent_id=agent.id,name="My Version name", description="My Version description", agent_config=agent_config)

Analyzing Guardrails Activity

Once guardrails are connected to your agent, our observability services (if enabled) will collect data about detected violations, allowing you to monitor your agent and keep track of any violations that occur. To read more about how to monitor your agent and related activities, please visit our "Monitor your agent" guide.