A model router and a tool router solve different decisions in an agent system. The model router selects or accesses inference. The tool layer gives the agent access to external capabilities and tracks what those operations did. Using both lets a team change reasoning and execution independently.
That separation is useful when an agent needs more than text generation. A strong model can decide that a page should be extracted or an image created. The application still needs authorized service access, valid inputs, and a recoverable execution path.
The architecture is straightforward once the responsibilities are explicit: the model proposes work, the runtime applies the workflow, and the tool layer executes permitted operations under their own contracts.
Map the three layers before choosing products
The inference layer processes prompts and returns model output. The runtime manages conversation state, steps, stopping rules, and task-specific decisions. The execution layer handles external operations and their outcomes.
OpenRouter provides a common model API and documents provider selection and fallback controls. Its client-tool flow returns proposed tool calls for application code to execute and send back as results. That is one concrete way to connect inference with external execution. OpenRouter client tools.
| Layer | Owns | Should retain |
|---|---|---|
| Model access | Inference request and selected model/provider | Model identifier and usage evidence |
| Agent runtime | Task state, decisions, step limits | Plan, accepted tool intents, progress |
| Tool access | Authorized external operation | Account context, invocation state, result |
Products can span multiple layers. Use this table to understand their responsibilities rather than assuming a vendor belongs to only one category. An integration should make the boundary visible even when one product supplies several components.
Follow a complete agent turn
Take a question that requires current information: “Compare the current public pricing pages of these three products.” The runtime supplies the question and a small set of permitted capabilities to a tool-capable model.
The model proposes retrieval. The runtime validates the proposed URLs, checks the task’s remaining budget, and selects an approved extraction operation. The tool layer executes that operation under the configured account and returns an invocation receipt.
If the result is complete, the runtime converts the output into an evidence record with a source URL and retrieval time. If work is waiting, the runtime preserves the invocation identifier and resumes retrieval later. The model receives usable evidence or an explicit limitation, not a fabricated page summary.
The next model turn drafts the comparison from that evidence. The application checks whether every material pricing claim has support. It can finish with missing-data notes if one page remains unavailable.
This sequence has two separate success conditions: the model produced a useful answer, and each external operation has a known outcome. A coherent paragraph does not prove the retrieval succeeded.
Route models with feature constraints
A model choice affects more than fluency. The runtime may require tool calling, structured output, particular modalities, or a certain context size. Confirm the selected model and provider support the request’s required features.
OpenRouter’s provider-routing documentation includes controls for provider order, fallback behavior, and requiring support for supplied parameters. Those controls belong to the inference request; they do not authorize an external paid tool. OpenRouter provider routing.
Evaluate a model on the actual tool descriptions and task set. A cheap model that repeatedly selects the wrong operation can increase external-tool usage. An expensive model can also overuse tools if the workflow has no stopping condition.
Track model and tool performance separately before optimizing jointly. For example, distinguish malformed arguments from a supplier outage and distinguish poor source selection from an extraction failure. Those errors have different remedies.
The application should also preserve which model made a decision. If a routing change coincides with more unnecessary retrieval steps, the team needs that attribution to investigate instead of blaming the tool service by default.
Route tools with semantic constraints
Tool choice should begin with capability and acceptance criteria. If a task needs a company filing, a generic web result is not automatically equivalent. If it needs a source-backed answer, a provider summary without retrievable sources may be insufficient.
Define the minimum result your application can use. For web evidence, that might be a URL, extracted text, retrieval time, and explicit failure state. Then map each provider response into that contract without hiding missing fields.
Fallback needs special care. Switching inference providers before a model response can be a reasonable policy. Switching external operations after an uncertain purchase can duplicate work or charges. The tool lifecycle must be checked before a replacement is authorized.
For an asynchronous media job, a fallback should normally wait for a known failure or explicit replacement decision. The fact that the model can generate another prompt is not evidence that the first supplier stopped.
Our tool discovery guide covers candidate selection, while the asynchronous job guide explains how to preserve accepted work.
Keep budgets separate and comparable
A workflow can consume inference, external tools, storage, and engineering attention. One model account balance cannot represent all of those costs. Keep a model-usage record and tool-usage record linked by the application’s workflow identifier.
Before execution, allocate explicit authorization ceilings to external steps. During execution, track actual or pending settlement. After completion, compare total observed cost with whether the deliverable was useful.
For a hypothetical research workflow, the application might permit up to three retrieval operations and one optional narration operation. Those are workload limits, not claims about prices. A model step limit alone would not enforce them because one step may request several calls.
Separate customer-account charges from wallet-funded charges. A connected account may incur supplier usage even when the platform reports no wallet debit. Include both when calculating cost per accepted deliverable.
The decision metric should be useful output per complete workflow, with quality held constant. Lower token cost can be a false economy if a changed model causes repeated searches, unnecessary extraction, or unusable final results. Use the workflow cost model to capture the complete run.
Create an evidence boundary between tools and reasoning
External content should enter the runtime as evidence to evaluate. A scraped page, search result, or document can include instructions that are unrelated to the user’s task. Treating all returned text as trusted operating instructions gives outside content authority it should not have.
Preserve provenance and label source content. Keep secrets and execution controls outside that content. The application determines permitted tool operations from trusted configuration and the user’s authorized task, even if a retrieved page asks it to do something else.
This boundary also improves answer quality. Evidence records can be checked, deduplicated, and marked stale. A model can cite the original page rather than a transient provider job response. Failed extraction can remain a missing source instead of being paraphrased into apparent certainty.
The source-checking assistant guide develops a workflow where drafting and verification use the same retained evidence ledger.
A migration path without a rewrite
Start by keeping the current model integration and moving one external capability behind a typed application adapter. Give it a domain-specific input and output, such as extracting a public page with provenance. Leave the rest of the runtime unchanged.
Once that operation is reliable, introduce a second provider or shared gateway behind the adapter. Compare outputs using fixed fixtures and authorized live checks. Preserve the original path until behavior and recovery are understood.
Only then evaluate changes to model routing. Changing model selection and external execution together makes regressions harder to explain. Independent layers let the team improve one without making every failure ambiguous.
The reverse adoption order also works: standardize model access first, retain existing tools, then consolidate repeated supplier setup. The right order depends on where your team currently spends time.
Choose the boundary that keeps you flexible
Use the same application task identifier across model turns and tool calls, but keep their credentials, policies, and lifecycle records distinct. That produces a trace a developer can actually investigate.
The shared tool layer earns its place when it reduces repeated access work and makes execution clearer. Model routing earns its place when it improves inference access and selection. Neither removes the need for a well-defined workflow and acceptance criteria.
For a concrete implementation, continue with a custom agent adapter or a reusable tool layer. Those patterns let you keep productive agent behavior while changing the infrastructure behind it.





