- Does any agent serve the requested model?
- Is the agent and its backend healthy?
- Does it serve the required workload capability?
- Does its metadata match the policy?
- Has it already failed this request within the current step?
- Does it have free declared capacity?
- Does it pass the configured live metric thresholds?

Ranking happens after the seven gates. The current
least-loaded strategy orders only the agents that survive the entire funnel.Gate summary
The first six gates always apply.
Gate 7 applies only when the policy step contains:
Gate 1: Model filter
The model filter creates the initial candidate pool. Hivenet Router loads agents registered for the exact model name supplied by the client:When the gate drains the pool
Gate 1 fails when no local agent is registered for the requested model. Later local fallback steps cannot recover by selecting a different model. The requested model remains fixed throughout the local policy chain. An external provider fallback may still run for an eligible language-model chat request because it can deliberately substitute its configured provider model.Diagnose it
List the operator model catalog:Fix it
- Start an agent for the requested model.
- Correct the client’s model name.
- Pin the intended model with the agent’s
--modelsetting. - Give several backend implementations the same public model name when they should participate in one fallback chain.
Gate 2: Health
An agent passes the health gate only when both of these states are healthy:When the gate drains the pool
Gate 2 fails when every agent serving the model is:- disconnected
- marked unhealthy by the router
- reporting an unhealthy inference backend
- or some combination of these states
Diagnose it
Check the health summary:Fix it
- Check the agent process and logs.
- Test the inference backend’s health endpoint locally.
- Confirm that the agent can reach the router’s gRPC and libp2p ports.
- Confirm that the agent can reach the router’s advertised libp2p address.
- Check firewall, NAT, container, and network-policy changes on the outbound agent-to-router path.
- Verify that the router and agent use the same JWT secret.
Gate 3: Capability
Each agent registers one capability:When the gate drains the pool
Gate 3 fails when agents exist for the model name, but none serve the required workload type. For example, an agent registered as:Diagnose it
Fix it
- Start the agent with the correct
--capability. - Use
llm,embedding, orrerankerexactly. - Send the request to the endpoint that matches the agent capability.
- Use distinct public model names when one set of weights is exposed for different workload types.
Gate 4: Static match
Thematch gate applies the policy step’s static metadata filters.
Supported fields
For tags, the agent must contain every tag listed by the policy. It may contain additional tags.
When the gate drains the pool
Gate 4 fails when no remaining agent satisfies every configured field. A common cause is incomplete agent metadata. For example, a policy may require:Diagnose it
Thepolicy_exhausted log includes the actual and required values.
For example:
vllm.
Inspect live metadata:
Fix it
- Correct the policy value.
- Correct the agent metadata.
- Check capitalization and punctuation.
- Remove a filter that does not express a real operational requirement.
- Add a later fallback step with deliberately relaxed filters.
Gate 5: Previous failures
The previous-failures gate removes agents that already produced a forwarding failure during the current policy step. This prevents Hivenet Router from repeatedly choosing the same unsuccessful agent while other candidates remain.Scope of the exclusion
The failed-agent set belongs to one request and one policy step. It resets when Hivenet Router advances from:When the gate drains the pool
Gate 5 drains the pool when every otherwise eligible agent has already failed during the current step. This can happen beforemax_tries is reached when the number of eligible agents is smaller than the configured attempt budget.
For example:
Diagnose it
Search router logs using the request ID. Look for forwarding errors before the final exhaustion line:Fix it
This gate normally describes the result of earlier failures rather than a configuration problem. Investigate:- backend errors
- agent disconnections
- backend overload
- network failures
- request incompatibility across engines
Gate 6: Capacity
The capacity gate compares the agent’s active request count with its declared capacity. An agent passes when:When the gate drains the pool
Gate 6 fails when every remaining agent has used all its declared slots. This does not necessarily mean the backend is broken. It may be healthy and serving its current workload normally.Queue behavior
When eligible agents exist but are full, Hivenet Router can place the request in the per-model capacity queue before advancing to a fallback step. The default queue depth is:Diagnose it
Inspect active requests and capacity:Fix it
- Add more agents for the model.
- Increase
--capacityonly when the backend and hardware can support more concurrency. - Lower request duration or backend queue pressure.
- Configure a fallback step with additional infrastructure.
- Disable or reduce queueing when fast failover is preferable.
For streaming responses, Hivenet Router releases the capacity slot when response headers arrive, while backend generation can continue. Gate 6 therefore limits routing admission rather than the complete lifetime of active streams.
Gate 7: Dynamic metric thresholds
Theexclude_if gate evaluates live operational metrics.
Operators
Each field must define exactly one operator:
Valid:
Available gate fields
Universal signals
Engine signals
Hardware signals
For multi-GPU agents, Hivenet Router evaluates the highest reported GPU temperature, compute utilization, and VRAM utilization.
Missing metrics pass
A gate is skipped when the selected metric is unavailable for an agent. For example:Metrics that begin without history
Some values are unavailable when an agent first registers. These include:success_ratesrttconsecutive_failures- TTFT and ITL values before the backend has completed requests
Practical gate patterns
Preserve headroom
Use the live capacity ratio before the hard capacity limit:Avoid backend queues
Protect the KV cache
Route away from high latency
Protect response quality during instability
Avoid hot GPUs
Avoid VRAM pressure
Combine system pressure signals
Strict and relaxed steps
A useful fallback design starts with protective gates and relaxes them deliberately.- healthy vLLM agents with low pressure
- vLLM agents under moderate pressure
- any healthy local agent serving the model
Diagnose policy exhaustion
Hivenet Router writes onepolicy_exhausted warning when the entire local policy chain is exhausted.
It does not emit that warning when an earlier step fails but a later fallback succeeds.
An example log resembles:
reason follows this shape:
- the primary step lost two agents because their engine metadata did not match
- the relaxed step lost two agents because their region metadata did not match
- the last-resort step lost two agents because their KV-cache use violated the configured gate
The
tried=3/3 field refers to exhausted policy steps recorded in the diagnostic, not to three backend forwarding attempts.Correlate a request
Supply a UUID request ID:Monitor exhausted policies
Inspect the policy-exhaustion counter:- missing or incorrect model registrations
- unhealthy agents
- capability mismatches
- incorrect metadata
- insufficient capacity
- overly strict metric gates
- repeated backend failures
Test gates safely
Test one rule at a time in a controlled environment. A practical process is:- Record the current value through
/admin/routing-table. - Add one gate with a threshold that should pass.
- Reload the policy.
- Send a request and confirm normal routing.
- Change the threshold so the test agent should fail.
- Confirm that a fallback agent serves the request.
- Inspect the exhaustion diagnostics when no fallback is available.
- Restore the intended threshold.
Common mistakes
Using percentage values from 0 to 100
Incorrect:Treating SRTT as seconds
Incorrect for a 500-millisecond threshold:Depending on an unavailable metric
This rule does not protect an Ollama pool:Setting several operators
Invalid:Making the primary policy too strict
A policy that combines many narrow filters and gates may drain under normal variance. Use fallback steps to express what can be relaxed and in what order.Using health gates as alert thresholds
A routing threshold decides whether an agent receives the current request. It is not automatically the right threshold for paging an operator. For example, routing away from a GPU at 82°C may be sensible without treating every short 82°C reading as an incident. Keep routing policy and alerting policy separate.Next steps
Prometheus metrics
Observe the live metrics used by routing gates.
Hardware metrics
Understand GPU, CPU, and memory values reported by agents.
Engine metrics
Review cache, queue, TTFT, ITL, and throughput signals from supported engines.

