AUTONEX

Policy Engine

The policy engine is the core security component of AUTONEX. It evaluates every agent intent against configured rules before execution, ensuring autonomous agents operate within predefined boundaries.

Architecture

The policy engine consists of three main components:

1. Rule Registry

A registry of all available policy rule types. Rules are implemented as Solana program instructions, ensuring they cannot be bypassed through client manipulation.

2. Policy Sets

Collections of configured rules assigned to specific agents or agent groups. Each agent operates under one or more policy sets that define its allowed behaviors.

3. Evaluation Engine

The runtime that loads applicable policies, evaluates rules against intents, and returns combined results. The engine provides deterministic evaluation with detailed pass/fail reasoning.

Rule Implementation

Policy rules are implemented as Solana programs with a standard interface:

// Example policy rule implementation
pub struct TransactionLimitRule {
    pub amount: u64,
    pub token: Pubkey,
    pub period: Period,
    pub agent: Pubkey,
}

impl PolicyRule for TransactionLimitRule {
    fn evaluate(&self, intent: &Intent, ctx: &Context) -> Result<bool> {
        let spent = ctx.get_spent_amount(
            self.agent,
            self.token,
            self.period
        )?;
        
        Ok(spent + intent.amount <= self.amount)
    }
}

Rule Properties

  • Deterministic: Same inputs always produce same outputs
  • Stateful: Can query on-chain state for evaluation
  • Composable: Multiple rules combine to form complete policies
  • Upgradeable: Rules can be updated through governance

Built-in Rule Types

Financial Rules

  • transaction_limit: Maximum amount per transaction
  • daily_limit: Maximum spending per 24-hour period
  • position_size: Maximum position in any single asset
  • portfolio_cap: Maximum total portfolio value

Risk Management Rules

  • slippage_protection: Maximum allowed slippage
  • price_deviation: Maximum price deviation from oracle
  • volatility_gate: Halt trading during high volatility
  • correlation_limit: Limit exposure to correlated assets

Protocol Rules

  • whitelist_programs: Only approved programs allowed
  • blacklist_accounts: Prevent interaction with specific accounts
  • cpi_restriction: Limit cross-program invocation depth
  • account_validation: Validate account ownership and state

Temporal Rules

  • trading_hours: Only execute during specified hours
  • rate_limit: Minimum time between actions
  • cooldown_period: Pause after losses or errors
  • time_lock: Scheduled activation of permissions

Evaluation Process

When an intent is submitted, the policy engine follows this process:

  1. Load Policy Set: Retrieve all policies applicable to the agent
  2. Sort Rules: Order rules by priority (critical first)
  3. Evaluate Rules: Execute each rule's evaluation logic
  4. Aggregate Results: Combine individual rule results
  5. Generate Report: Create detailed evaluation report
  6. Return Decision: Pass (execute) or Fail (reject)

Policy Configuration

Policies are configured through governance proposals or authorized administrators:

Creating Policy Sets

  1. Define the policy set name and description
  2. Add rules with their configuration parameters
  3. Assign policy set to specific agents
  4. Test in simulation before activating

Updating Policies

Policy updates require governance approval for production agents:

  • Propose policy change with justification
  • Community review and discussion period
  • Governance vote on approval
  • If approved, policy update activated on-chain

Best Practices

  • Defense in Depth: Use multiple complementary rules
  • Start Strict: Begin with conservative limits, relax gradually
  • Test Extensively: Use simulation to verify policy behavior
  • Monitor Continuously: Track policy violations and near-misses
  • Update Regularly: Evolve policies based on agent performance