Expand description
Agent integration module for Grapsus proxy.
This module provides integration with external processing agents for WAF, auth, rate limiting, and custom logic. Agents communicate using the v2 binary protocol with bidirectional streaming, capabilities, health reporting, metrics export, and flow control.
§Architecture
AgentManager: Coordinates all agents, handles routing to appropriate agentsAgentV2: Agent with bidirectional streaming and connection poolingAgentDecision: Combined result from processing through agentsAgentCallContext: Request context passed to agents
§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 grapsus_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
Call Context - Agent call context.
- Agent
Decision - Agent decision combining all agent responses.
- Agent
Manager - Agent manager handling all external agents.
- Agent
Metrics - Agent metrics collector.
- AgentV2
- Protocol v2 agent with connection pooling and bidirectional streaming.
Enums§
- Agent
Action - Agent action types.