Capability routing
Match calls to upstreams by tool name, tags, region or custom metadata, with weighted splits for canaries.
// 002 / 006Core · Routing
Route calls across tools and agents by context, capability and load, with no hand-wired glue code per integration.
The problemReal agent traffic is uneven: one tool is hammered, another is slow, a third has three replicas in two regions. Hard-coding which server handles which call leaves you with hot spots, cascading timeouts and no graceful degradation.
With PbjPbj routes every call through a policy-driven router. It picks a healthy upstream by capability, weight and live latency, retries idempotent calls, trips circuit breakers on failing backends and can chain multiple tools into one server-side workflow.
Match calls to upstreams by tool name, tags, region or custom metadata, with weighted splits for canaries.
Round-robin, least-connections, latency-aware (EWMA) or consistent hashing for session affinity.
Per-route timeouts, retries with jittered backoff for idempotent tools, and circuit breakers with half-open probing.
Declare multi-step workflows that run server-side and return one result, cutting agent round trips.
The router evaluates rules top to bottom against the tool, caller and request metadata.
Among matching upstreams it drops unhealthy or open-circuit targets and applies the balancing strategy.
The call runs with its route's timeout and retry budget; streaming results pass straight through.
Latency and error outcomes feed back into health scores that inform the next selection.
Everything is declarative. Check the file into Git, validate it in CI with Pasti Bahagia Jaya config check, and roll it out like any other change.
1routes:2 - match: { tool: "search.*" }3 upstreams:4 - { server: search-eu, weight: 90 }5 - { server: search-next, weight: 10 } # canary6 strategy: latency7 timeout: 5s8 retry: { attempts: 3, backoff: 200ms, idempotent_only: true }9 circuit_breaker: { error_rate: 0.5, window: 30s, cooldown: 15s }Shift 10% of calls to a new server version, watch error rates, then promote.
Keep EU data in EU upstreams while sending everything else to the lowest-latency region.
Collapse a three-call lookup into one chain the agent invokes as a single tool.