Virtuals Protocol Integration
Safety validation for AI agents built with the GAME SDK.
Installation
pip install sentinelseed[virtuals]
Components
| Component | Description |
|---|---|
SentinelConfig | Configuration for validation rules |
SentinelValidator | Core THSP validation engine |
SentinelSafetyWorker | Worker for agent validation |
sentinel_protected | Decorator for executables |
Quick Start
Add Safety Worker to Agent
from game_sdk.game.agent import Agent
from sentinelseed.integrations.virtuals import (
SentinelConfig,
SentinelSafetyWorker,
)
config = SentinelConfig(
max_transaction_amount=500.0,
require_confirmation_above=100.0,
block_unsafe=True,
)
safety_worker = SentinelSafetyWorker.create_worker_config(config)
agent = Agent(
api_key=api_key,
name="SafeAgent",
workers=[safety_worker, your_other_worker],
)
Decorator Usage
from sentinelseed.integrations.virtuals import sentinel_protected
@sentinel_protected(config=SentinelConfig(max_transaction_amount=100))
def my_transfer(recipient: str, amount: float):
return (FunctionResultStatus.DONE, "Success", {})
Configuration
SentinelConfig(
block_unsafe=True,
max_transaction_amount=1000.0,
require_confirmation_above=100.0,
require_purpose_for=["transfer", "swap", "withdraw"],
blocked_functions=["drain_wallet", "export_private_key"],
memory_integrity_check=False,
memory_secret_key=None,
)
THSP Gates
| Gate | Blocks When |
|---|---|
| TRUTH | Context manipulation, misleading names |
| HARM | Blocked functions, key exposure |
| SCOPE | Amount exceeds limit |
| PURPOSE | Sensitive actions without purpose |
Memory Content Validation
Protects against memory injection attacks:
config = SentinelConfig(
memory_integrity_check=True,
memory_secret_key="your-secret-key",
memory_content_validation=True,
)
Fiduciary Validation
from sentinelseed.integrations.virtuals import (
SentinelValidator,
UserContext,
RiskTolerance,
)
context = UserContext(
goals=["maximize profits", "minimize fees"],
constraints=["max 10% per trade"],
risk_tolerance=RiskTolerance.HIGH,
)
validator = SentinelValidator(user_context=context)