Polyaxon v3 is coming →

Build and evaluate AI agent guardrails in Polyaxon

Use Polyaxon to version guardrail experiments, compare case-level outcomes, constrain execution, and require evidence before promoting an agent release.

February 20, 2026by Polyaxon
Three silver gates along an isometric path, with the middle gate outlined in amber.

An agent guardrail is useful when the team can explain what it controls, how it behaves on a failure, and what happened when it was evaluated. Polyaxon brings those questions into the same workflow used for model experiments: version the candidate, run a fixed case set, track outcomes, compare alternatives, and promote the release with the required evidence.

Consider an agent that diagnoses failed ML jobs. It can read an approved report, recommend a configuration change, and request a retry. Each step has a different boundary. Data authorization controls which report it receives, tool validation controls which job it can retry, and runtime settings constrain any code it executes.

Polyaxon manages the experiments and execution workflow. Your application supplies the business rules and tool authorization logic; cluster policies provide the underlying network and container restrictions.

Assign each guardrail to the component that enforces it

Write down the control and its owner before comparing prompts:

DecisionEnforcement locationEvidence to retain in Polyaxon
Which reports may be retrieved?Application authorization and data serviceCase identifier and authorization outcome
Is a retry request valid?Tool gateway checking identity and argumentsProposed action and redacted denial or receipt
May generated code reach a private endpoint?Cluster networking and execution runtimeApproved network-check report
Did the agent return a usable result?Schema checks and application evaluatorCase-level validation result
Is the candidate eligible for release?Qualification component and release workflowThreshold results and reviewer disposition

This division also helps interpret failures. An input classifier can detect suspicious text, but it cannot remove permissions from a database credential. A model-based evaluator can assess a response, but it should not grant the agent authority to execute the next tool.

Version the guardrail experiment

Create a component version for the evaluation procedure. Keep the agent revision, guardrail configuration, tool schemas, and case-manifest revision as explicit inputs. Include ordinary tasks, ambiguous requests, unauthorized resources, malformed arguments, indirect prompt injection, and failures of the guardrail service itself.

Give each case an expected result and prohibited effects. For the retry agent, an unauthorized job identifier should produce a denial and no retry. A correct explanation followed by an unauthorized side effect is still a failed case.

Separate training or tuning examples from held-out qualification cases. When a production incident becomes a regression case, record the case-set revision so a later comparison does not silently use a different denominator.

Record case outcomes and metrics together

Have the evaluation harness write a redacted guardrail-results.json file containing one record per case. The following reporting code assumes each record contains the boolean fields shown below. Run it inside your Polyaxon evaluation job after the harness completes:

import json
from pathlib import Path

from polyaxon import tracking

tracking.init()
report = Path("guardrail-results.json")
cases = json.loads(report.read_text())
if not cases:
    raise ValueError("Guardrail qualification produced no cases")

unsafe = [case for case in cases if case["unsafe_request"]]
ordinary = [case for case in cases if not case["unsafe_request"]]
if not unsafe or not ordinary:
    raise ValueError("Qualification needs unsafe and ordinary cases")

tracking.log_metrics(
    case_count=len(cases),
    unsafe_action_rate=sum(case["unsafe_action"] for case in unsafe) / len(unsafe),
    false_refusal_rate=sum(case["refused"] for case in ordinary) / len(ordinary),
    ordinary_success_rate=sum(case["task_succeeded"] for case in ordinary) / len(ordinary),
)
tracking.log_artifact(path=str(report), name="guardrail-results")

These are application-defined measurements recorded with the tracking API. The harness must establish whether an unsafe action occurred from tool receipts or equivalent evidence, rather than trusting the agent's own summary. Add separate latency, token cost, and human-review measurements where they affect the release decision.

In the comparison dashboard, compare candidates evaluated against the same manifest. Inspect case-level artifacts when a lower unsafe-action rate comes with more false refusals. Aggregate metrics alone cannot show whether a critical category has disappeared from the evaluation.

Constrain execution and release separately

Use scheduling presets to make execution settings consistent across candidates: selected service account, required connections, resources, and deadlines. Keep the underlying credential permissions narrow and enforce mandatory restrictions through your cluster policies. This reduces variation in the environment while you evaluate guardrail changes.

Make qualification a distinct operation in the release DAG. It should fail if required reports are missing or policy thresholds are violated. Use dependency triggers to require successful qualification before deployment, and manual approval when a reviewer must examine the evidence.

That approval pauses the Polyaxon operation. It does not authorize every later action taken by the deployed agent. For consequential tool calls, the application still needs approval tied to the actual target and parameters.

Keep production failures in the evaluation loop

Record denial patterns, review frequency, useful-task completion, and policy-service errors with the release identifier. Convert representative failures into sanitized regression cases and rerun the baseline alongside the candidate.

With Polyaxon, the guardrail becomes a maintained part of the engineering workflow: a versioned configuration with measured tradeoffs, reproducible evidence, and an explicit path to deployment. The team can explain both what the agent is allowed to do and why the current controls were selected.