Multi-Agent Systems and Proxy Infrastructure: Architecture Patterns
Last updated: April 2026 | Author: Hex Proxies Team
Multi-agent systems represent the next evolution of AI-powered automation. Instead of a single AI agent performing a task, teams of specialized agents collaborate — one researches, another analyzes, a third verifies, and a fourth synthesizes results. When these agents interact with the web, the proxy infrastructure must scale with the number of agents while maintaining isolation between them.
This is fundamentally different from traditional proxy use cases. A web scraper uses proxies to rotate IPs across sequential requests to the same target. A multi-agent system uses proxies to give each concurrent agent its own identity on the web. The architecture patterns are different, the failure modes are different, and the cost dynamics are different.
Why Multi-Agent Systems Need Specialized Proxy Architecture
The Cross-Contamination Problem
When multiple agents share an IP pool without session isolation, one agent's behavior affects all others. If Agent A triggers a CAPTCHA on a target site, Agents B through Z on the same IP are also blocked. In a multi-agent system where each agent has a different task, this cross-contamination can cascade into system-wide failures.
The Identity Problem
Some multi-agent workflows require agents to maintain distinct identities. A competitive intelligence system might have one agent monitoring your own brand, another monitoring Competitor A, and a third monitoring Competitor B. If these agents share IPs, the target site may correlate their activities and infer the monitoring pattern.
The Cost Attribution Problem
In a multi-agent system, different agents consume different amounts of bandwidth. Without per-agent proxy accounting, you cannot optimize costs — you do not know which agents are expensive and which are efficient. Proxy session isolation enables per-agent cost tracking.
Five Architecture Patterns
Pattern 1: Dedicated Session Per Agent
The simplest pattern assigns each agent a unique sticky session through the proxy gateway. All requests from a given agent use the same IP for the session's duration.
import uuid
from dataclasses import dataclass
@dataclass(frozen=True)
class AgentProxyConfig:
agent_id: str
session_id: str
country: str
proxy_url: str
def create_agent_proxy(
agent_id: str,
country: str = "us",
base_user: str = "USER",
password: str = "PASS"
) -> AgentProxyConfig:
"""Create an isolated proxy config for a single agent."""
session_id = f"{agent_id}-{uuid.uuid4().hex[:8]}"
username = f"{base_user}-country-{country}-sessid-{session_id}"
proxy_url = f"http://{username}:{password}@gate.hexproxies.com:8080"
return AgentProxyConfig(
agent_id=agent_id,
session_id=session_id,
country=country,
proxy_url=proxy_url
)
# Each agent gets its own isolated session
research_agent = create_agent_proxy("research-01", country="us")
verification_agent = create_agent_proxy("verify-01", country="gb")
monitoring_agent = create_agent_proxy("monitor-01", country="de")
Best for: Systems with fewer than 50 concurrent agents where each agent needs a consistent identity.
Pattern 2: Pool-Per-Team Isolation
In hierarchical multi-agent systems, agents are organized into teams. Each team shares a proxy pool, but pools are isolated between teams. This provides a balance between full isolation and resource efficiency.
from dataclasses import dataclass, field
from typing import Dict, List
import uuid
@dataclass
class ProxyPool:
team_id: str
country: str
base_user: str
password: str
max_sessions: int = 10
_sessions: Dict[str, str] = field(default_factory=dict)
def get_session(self, agent_id: str) -> str:
"""Get or create a session for an agent within this pool."""
if agent_id not in self._sessions:
if len(self._sessions) >= self.max_sessions:
oldest = next(iter(self._sessions))
del self._sessions[oldest]
session = f"{self.team_id}-{uuid.uuid4().hex[:8]}"
self._sessions[agent_id] = session
session = self._sessions[agent_id]
username = f"{self.base_user}-country-{self.country}-sessid-{session}"
return f"http://{username}:{self.password}@gate.hexproxies.com:8080"
def rotate_session(self, agent_id: str) -> str:
"""Force IP rotation for a specific agent."""
if agent_id in self._sessions:
del self._sessions[agent_id]
return self.get_session(agent_id)
# Create isolated pools per team
research_pool = ProxyPool("research", "us", "USER", "PASS", max_sessions=20)
verification_pool = ProxyPool("verify", "gb", "USER", "PASS", max_sessions=10)
monitoring_pool = ProxyPool("monitor", "us", "USER", "PASS", max_sessions=5)
Best for: Large systems with 50-500 agents organized into functional teams.
Pattern 3: Dynamic Proxy Routing
In this pattern, a central proxy router examines each agent's request and selects the optimal proxy type and configuration based on the target domain, required geography, and current proxy health.
from dataclasses import dataclass
from typing import Optional
@dataclass(frozen=True)
class ProxyRoute:
proxy_url: str
proxy_type: str # 'residential' or 'isp'
reason: str
class DynamicProxyRouter:
ISP_DOMAINS = {
"api.linkedin.com", "api.crunchbase.com",
"sec.gov", "clinicaltrials.gov"
}
GEO_REQUIRED_DOMAINS = {
"amazon": True, "google": True, "ebay": True
}
def __init__(self, base_user: str, password: str, isp_ips: list):
self.base_user = base_user
self.password = password
self.isp_ips = isp_ips
def route(self, target_url: str, agent_id: str,
country: Optional[str] = None) -> ProxyRoute:
"""Select optimal proxy for a given request."""
domain = extract_domain(target_url)
# Use ISP for known API endpoints and stable sources
if domain in self.ISP_DOMAINS:
ip = self.isp_ips[hash(agent_id) % len(self.isp_ips)]
return ProxyRoute(
proxy_url=f"http://USER:PASS@{ip}:8080",
proxy_type="isp",
reason=f"ISP proxy for stable API access to {domain}"
)
# Use geo-targeted residential for location-sensitive sites
geo = country or "us"
session = f"{agent_id}-{hash(target_url) % 10000}"
username = f"{self.base_user}-country-{geo}-sessid-{session}"
return ProxyRoute(
proxy_url=(
f"http://{username}:{self.password}"
f"@gate.hexproxies.com:8080"
),
proxy_type="residential",
reason=f"Residential proxy for {domain} in {geo}"
)
Best for: Systems where agents browse diverse targets with varying proxy requirements.
Pattern 4: ISP Proxy Grid for Platform Agents
When agents interact with specific platforms continuously (monitoring dashboards, tracking prices on specific e-commerce sites), static ISP proxies provide the most reliable solution. Each agent gets a dedicated ISP IP.
| Agent | Dedicated ISP IP | Target Platform | Monthly Cost |
|---|---|---|---|
| price-monitor-01 | IP-A | Amazon | $0.83 |
| price-monitor-02 | IP-B | Walmart | $0.83 |
| brand-monitor-01 | IP-C | Google Ads | $0.83 |
| review-tracker-01 | IP-D | Trustpilot | $0.83 |
| seo-monitor-01 | IP-E | Google SERP | $0.83 |
| Total (5 agents) | $4.15/month |
Best for: Monitoring agents with stable, long-running tasks on specific platforms. ISP proxies at $0.83/IP with unlimited bandwidth eliminate bandwidth cost uncertainty.
Pattern 5: Hybrid Mesh with Failover
Production multi-agent systems combine multiple patterns with automatic failover. Primary requests go through ISP proxies for stability; if blocked, the system falls back to residential proxies with a fresh session.
import httpx
from dataclasses import dataclass
from typing import Optional
@dataclass(frozen=True)
class RequestResult:
success: bool
response: Optional[httpx.Response]
proxy_type: str
attempts: int
class HybridProxyMesh:
def __init__(self, isp_ips: list, resi_user: str,
resi_pass: str):
self.isp_ips = isp_ips
self.resi_user = resi_user
self.resi_pass = resi_pass
def request(
self, url: str, agent_id: str, country: str = "us"
) -> RequestResult:
"""Try ISP first, fall back to residential."""
# Attempt 1: ISP proxy
isp_ip = self.isp_ips[hash(agent_id) % len(self.isp_ips)]
try:
resp = httpx.get(
url,
proxies=f"http://USER:PASS@{isp_ip}:8080",
timeout=15.0
)
if resp.status_code == 200:
return RequestResult(True, resp, "isp", 1)
except httpx.RequestError:
pass
# Attempt 2: Residential proxy with fresh session
import uuid
session = f"{agent_id}-{uuid.uuid4().hex[:6]}"
username = (
f"{self.resi_user}-country-{country}-sessid-{session}"
)
try:
resp = httpx.get(
url,
proxies=(
f"http://{username}:{self.resi_pass}"
f"@gate.hexproxies.com:8080"
),
timeout=20.0
)
if resp.status_code == 200:
return RequestResult(True, resp, "residential", 2)
except httpx.RequestError:
pass
return RequestResult(False, None, "none", 2)
Best for: Production systems requiring high availability and resilience to individual proxy failures.
Observability and Cost Management
Multi-agent proxy usage requires observability to control costs and diagnose issues. Key metrics to track:
Per-Agent Metrics
- Bandwidth consumed: Track GB per agent per day to identify expensive agents
- Success rate: Monitor per-agent request success rates to detect when specific agents need proxy rotation
- Latency distribution: P50, P95, P99 latency per agent identifies performance outliers
- Block rate: Track how often each agent's proxy gets blocked to inform rotation strategy
System-Level Metrics
| Metric | Healthy Range | Action if Exceeded |
|---|---|---|
| Total bandwidth/day | Within budget | Throttle low-priority agents |
| System success rate | >90% | Rotate proxy sessions, check targets |
| Concurrent sessions | Within pool limits | Queue excess agents |
| ISP proxy uptime | >99.5% | Replace affected IPs |
| Cost per task | Stable or decreasing | Optimize agent browsing patterns |
Scaling Considerations
Scaling from 10 to 100 Agents
At 10 agents, the Dedicated Session pattern works perfectly. At 100 agents, you need Pool-Per-Team isolation to manage session complexity. The key transition points:
- 10-50 agents: Dedicated sessions, manual proxy configuration, simple monitoring
- 50-200 agents: Pool-per-team, dynamic routing, automated session management
- 200+ agents: Hybrid mesh with failover, real-time cost monitoring, adaptive throttling
Cost Scaling
Multi-agent proxy costs scale linearly with agent count and task volume:
- 10 agents, light browsing: ~50 GB/month residential + 5 ISP IPs = $89/month
- 50 agents, moderate browsing: ~300 GB/month residential + 20 ISP IPs = $527/month
- 200 agents, heavy browsing: ~1.5 TB/month residential + 50 ISP IPs = $2,591/month
At every scale, proxy costs remain a fraction of LLM API costs for the same agent workloads. Visit our pricing page for current rates and volume options.
Framework Integration Examples
CrewAI Integration
CrewAI is one of the most popular multi-agent frameworks in 2026. Integrating proxy isolation with CrewAI agents:
from crewai import Agent, Task, Crew
def create_proxied_agent(role, goal, agent_id, country="us"):
proxy = create_agent_proxy(agent_id, country)
return Agent(
role=role,
goal=goal,
tools=[create_web_tool(proxy.proxy_url)],
verbose=True
)
# Each agent gets isolated proxy infrastructure
researcher = create_proxied_agent(
"Market Researcher",
"Find competitor pricing data",
"crew-research-01"
)
analyst = create_proxied_agent(
"Data Analyst",
"Verify pricing accuracy",
"crew-verify-01"
)
writer = create_proxied_agent(
"Report Writer",
"Compile findings into report",
"crew-report-01"
)
crew = Crew(
agents=[researcher, analyst, writer],
tasks=[research_task, analysis_task, report_task]
)
result = crew.kickoff()
Frequently Asked Questions
How many concurrent proxy sessions can I run?
There is no hard limit on concurrent sessions through the Hex Proxies gateway. Each unique session identifier in the username parameter creates a separate sticky session. Hundreds of concurrent sessions are supported for production multi-agent deployments. The practical limit is your bandwidth budget, not the session count.
Do I need different proxy types for different agents?
Yes, in most cases. Agents that browse broadly across diverse websites should use rotating residential proxies ($1.70/GB). Agents that interact with specific platforms repeatedly should use ISP proxies ($0.83/IP) for session stability. The Dynamic Proxy Router pattern (Pattern 3) automates this selection. See our residential and ISP pages for details.
What happens when an agent's proxy session gets blocked?
Implement automatic session rotation. When an agent receives a 403 or CAPTCHA response, generate a new session ID to get a fresh IP. The Hybrid Mesh pattern (Pattern 5) handles this by falling back from ISP to residential proxies on failure. This failover typically takes under 2 seconds and is transparent to the agent.
How do I track per-agent proxy costs?
Include the agent ID in the session parameter when configuring proxies. This enables per-agent bandwidth tracking through the Hex Proxies dashboard. Tag each agent's requests with identifiable session prefixes (e.g., -sessid-research01) and correlate bandwidth usage through your monitoring system.
Can I run multi-agent systems on a small budget?
Absolutely. A 5-agent system with 3 using residential proxies (~30 GB/month, $51) and 2 using ISP proxies (2 IPs, $1.66) costs under $53/month. Start small with the Dedicated Session pattern and scale to more sophisticated patterns as your agent count grows. Check our pricing page for pay-as-you-go rates with no minimums.