Skip to main content

Overview

Guardrails in OrbitAI provide a safety and validation framework that ensures agents operate within defined boundaries. They act as automated checkpoints that validate inputs, filter outputs, enforce resource limits, and maintain compliance with content policies and regulations.

Input Validation

Validate and sanitize inputs before processing

Output Filtering

Filter harmful, sensitive, or inappropriate content

Content Safety

Block harmful, offensive, or inappropriate content

Compliance

Enforce regulatory requirements and policies

Resource Control

Limit token usage, rate limits, and resource consumption

Customizable

Create custom guardrails for specific requirements

Key Capabilities

Guardrails are automatically enforced during task execution. All agent outputs pass through guardrail validation before task completion, ensuring consistent safety without manual intervention.
Combine multiple guardrails for comprehensive protection. Stack content filtering, PII detection, token limits, and rate limiting to create defense-in-depth security.
Configure validation strictness from lenient (for development) to strict (for production). Partial approvals allow iterative refinement of agent outputs.
Implement domain-specific validation logic with custom guardrails. Extend the OrbitGuardrail protocol to enforce business rules, compliance requirements, or quality standards.

Guardrails Architecture

Built-in Guardrails

OrbitAI provides several built-in guardrails for common safety and compliance requirements:

Content Safety Guardrails

Guardrail: NoHarmfulContentGuardrailPrevents generation of harmful, offensive, or dangerous content.Configuration:
What it blocks:
  • Violence and graphic content
  • Hate speech and discrimination
  • Self-harm and dangerous activities
  • Illegal activities
  • Adult/NSFW content
  • Harassment and bullying
Example:
Use cases:
  • User-facing content generation
  • Educational content
  • Public communications
  • Customer interactions

Resource Control Guardrails

Guardrail: TokenLimitGuardrailEnforces maximum token limits for generated content.Configuration:
Parameters:
  • maxTokens: Maximum token count allowed
  • model: Model name for accurate token counting
  • action: What to do when exceeded (truncate, fail, warn)
Use cases:
  • Prevent excessive LLM costs
  • Ensure outputs fit within constraints
  • Control response sizes
  • Manage context window usage
Example with truncation:

Input Validation

Guardrails validate inputs before processing to prevent injection attacks, malformed data, and security issues.

Input Validation Guardrails

1

Parameter Validation

Validate task and agent parameters:
2

Input Sanitization

Sanitize user inputs to prevent injection:
3

Schema Validation

Validate structured inputs:
4

File Upload Validation

Validate file uploads:

Input Validation Best Practices

Validate Early

Validate inputs before they reach agents:

Whitelist Over Blacklist

Define allowed inputs rather than blocked ones:

Provide Clear Feedback

Help users understand validation failures:

Layer Validation

Use multiple validation layers:

Output Validation

Output guardrails filter and validate agent-generated content before returning results.

Output Validation Strictness

Configure how strictly outputs are validated:
Use case: Development, testing, experimentation
Behavior:
  • Partial approvals are accepted
  • Warnings don’t block output
  • Faster iteration
  • More permissive filtering
When to use:
  • Prototyping
  • Internal tools
  • Development environments
  • Creative exploration

Validation Results

Output passes all guardrails.
What happens:
  • Task completes successfully
  • Output returned to user
  • No retries needed
Output is acceptable but has minor issues.
What happens:
  • Lenient/Standard: Output accepted with feedback
  • Strict: Retry required
  • Feedback provided for improvement
Output has issues that must be fixed.
What happens:
  • Task retries if retries available
  • Feedback sent to agent for revision
  • Previous output discarded
Output cannot be validated (technical error).
What happens:
  • Task fails immediately
  • Error logged
  • No retries (technical failure)

Safety and Compliance

Content Safety

Implement comprehensive content safety with multiple layers:

Privacy Compliance

Ensure GDPR, CCPA, and privacy regulation compliance:

Industry-Specific Compliance

Regulations: PCI-DSS, SOX, GLBA

Custom Guardrails

Create custom guardrails for domain-specific requirements:

OrbitGuardrail Protocol

Custom Guardrail Examples

Enforce business logic and domain rules:

Best Practices

Guardrail Configuration

Layer Guardrails

Use multiple guardrails for defense-in-depth:

Environment-Specific

Adjust strictness by environment:

Monitor Violations

Track guardrail violations:

Test Guardrails

Unit test custom guardrails:

Performance Optimization

Cache expensive validation operations:
Run independent guardrails in parallel:
Stop on first failure for performance:

Security Best Practices

Critical: Guardrails are your last line of defense. Always enable guardrails in production environments.

Troubleshooting

Common Issues

Symptom: Tasks repeatedly fail guardrail validation.Causes:
  • Overly strict guardrails
  • Poorly configured thresholds
  • Agent generating inappropriate content
  • Conflicting guardrails
Diagnosis:
Solutions:
Symptom: Guardrails block legitimate content.Causes:
  • Overly sensitive detection
  • Pattern matching too broad
  • Context not considered
Solutions:
Symptom: Guardrail validation is slow.Causes:
  • Too many guardrails
  • Expensive operations (API calls, ML models)
  • Sequential validation
  • No caching
Solutions:
Symptom: Same content passes sometimes, fails other times.Causes:
  • Non-deterministic validation
  • Race conditions
  • Stateful guardrails
  • External API inconsistency
Solutions:

Next Steps

Tasks

Configure tasks with guardrails and validation

Agents

Set up agent-level guardrails for security

Compliance

Learn about regulatory compliance features

Security

Implement comprehensive security measures

Pro Tip: Start with lenient validation during development to iterate quickly, then gradually increase strictness as you refine your content. Always use strict validation in production environments to ensure safety and compliance.