Skip to main content

Module agents

Module agents 

Source
Expand description

Agent integration module for Sentinel proxy.

This module provides integration with external processing agents for WAF, auth, rate limiting, and custom logic. It implements the SPOE-inspired protocol with bounded behavior and failure isolation.

§Architecture

  • AgentManager: Coordinates all agents, handles routing to appropriate agents
  • Agent: Protocol v1 agent with connection, circuit breaker, and metrics
  • AgentV2: Protocol v2 agent with bidirectional streaming and pooling
  • AgentConnectionPool: Connection pooling for efficient connection reuse (v1)
  • AgentDecision: Combined result from processing through agents
  • AgentCallContext: Request context passed to agents

§Protocol Versions

  • V1: Simple request/response protocol (backwards compatible)
  • V2: Bidirectional streaming with capabilities, health reporting, metrics export, and flow control

§Queue Isolation

Each agent has its own semaphore for queue isolation, preventing a slow agent from affecting other agents (noisy neighbor problem). Configure concurrency limits per-agent via max_concurrent_calls in the agent configuration.

§Example

use sentinel_proxy::agents::{AgentManager, AgentCallContext};

// Each agent manages its own concurrency limit (default: 100)
let manager = AgentManager::new(agent_configs).await?;
manager.initialize().await?;

let decision = manager.process_request_headers(&ctx, headers, &["waf", "auth"]).await?;
if !decision.is_allow() {
    // Handle block/redirect/challenge
}

Structs§

Agent
Individual agent configuration and state.
AgentCallContext
Agent call context.
AgentConnectionPool
Agent connection pool for efficient connection reuse.
AgentDecision
Agent decision combining all agent responses.
AgentManager
Agent manager handling all external agents.
AgentMetrics
Agent metrics collector.
AgentV2
Protocol v2 agent with connection pooling and bidirectional streaming.

Enums§

AgentAction
Agent action types.