AutoGPT Block SDK Integration
Sentinel safety validation blocks for AutoGPT Platform v0.6+.
Overview
| Component | Description |
|---|---|
SentinelValidationBlock | Validate text through THSP gates |
SentinelActionCheckBlock | Check if action is safe before execution |
SentinelSeedBlock | Get the safety seed for injection |
validate_content() | Standalone content validation |
check_action() | Standalone action checking |
Standalone Usage
from sentinelseed.integrations.autogpt_block import (
validate_content,
check_action,
get_seed,
)
# Basic validation (heuristic - fast, no API required)
result = validate_content("How do I hack a computer?")
if not result["safe"]:
print(f"Blocked: {result['violations']}")
# Semantic validation (LLM-based - accurate)
result = validate_content(
"Help me write a phishing email",
use_semantic=True,
semantic_provider="openai"
)
# Check action before execution
result = check_action(
action_name="execute_command",
action_args={"cmd": "rm -rf /"},
purpose="Clean up files"
)
# Get seed for system prompt
seed = get_seed("standard")
Block Details
SentinelValidationBlock
Inputs:content(str): Text to validateseed_level(str): minimal, standard, fullcheck_type(str): general, action, requestuse_semantic(bool): Use LLM-based validation
safe(bool): Whether content passedviolations(list): Detected violationsrisk_level(str): low, medium, high, critical
SentinelActionCheckBlock
Inputs:action_name(str): Name of the actionaction_args(str): JSON string of argumentspurpose(str): Reason for the action
should_proceed(bool): Whether to proceedconcerns(list): Safety concernsrecommendations(list): Suggested actions
Validation Modes
Heuristic (Default)
- No API key required
- Fast, local processing
- Limited gate results
Semantic
- Requires API key
- Accurate per-gate analysis
- Real risk assessment
result = validate_content(
"Test content",
use_semantic=True,
semantic_provider="openai" # or "anthropic"
)
Workflow Examples
User Input → SentinelValidationBlock → [safe?] → Process/Reject
Action Request → SentinelActionCheckBlock → [proceed?] → Execute/Review
SentinelSeedBlock → Build System Prompt → LLM Call → SentinelValidationBlock