# Inference and model routing

> A software factory should be able to call several models through several channels and pick the right one for each task. Model choice weighs heavily on cost and quality, as do the harness and the context the agent gets. Where inference runs decides where your data goes.

Inference means running the model. It can go through an AI lab’s API or a host for open models. It can also go through a major cloud such as AWS Bedrock, Google Vertex or Microsoft Foundry, or through fine-tuned models the company hosts itself. Going through your own cloud keeps traffic under an existing contract and in a known region.

Keeping models interchangeable limits your dependence on one provider and its pricing. It also protects you if a source becomes unavailable, for regulatory reasons for example. An LLM gateway helps: one API in front of several providers, with quotas, logs and region selection.

Routing decides which model and which harness handle which task. It is tuned on measurements. When the API bill jumps after a new model ships, the question gets concrete: can some workflows move to a cheaper model without losing quality? Only a benchmark on your own tasks can answer it.

Model and harness are separate choices to test together (see Agent harness).

**When**: Before picking a default provider, then whenever a new model ships or the bill climbs.

**Trade-offs**: More providers means more contracts, keys and logs to manage. A single provider is simpler to run but leaves you exposed to its pricing and outages.

## Where to start

- List tasks and the quality each one needs
- Test two or three models on an internal benchmark
- Route simple tasks to a cheaper model
- For repetitive tasks, run a simple check without a model first
- Check the region and contract for each inference channel
- Revisit routing whenever a new model ships

## Common mistakes

- Picking a model from a public leaderboard alone
- Depending on a single provider for the whole factory
- Losing track of where inference runs

## Metrics

- Cost per successful task, by model
- Quality graded by a scorer, by model

## Sources

- [Warp, The Factory Stack](https://www.warp.dev/blog/the-factory-stack)
- [Warp, Becoming a factory engineer](https://www.warp.dev/blog/factory-engineering-software-factories)
- [Anthropic, The AI-native SDLC playbook](https://claude.com/fr/resources/articles/the-ai-native-sdlc-playbook)
- [DoiT, Running Hermes Agent in the Enterprise](https://www.doit.com/blog/running-hermes-agent-in-the-enterprise)
