Why Agent Development Should Not Rely on a Single Model Provider

    This article explains three risks of building an AI agent on one model provider: concurrency limits, instability with complex prompts, and unannounced changes to versions, rate limits, or pricing. It also covers what agent workloads require from a model and an architecture that uses a model gateway with routing, retries, circuit breaking, and fallback.

    1. Three Risks of Depending on a Single Model

    When building an agent, many teams pick one model first and connect the entire workflow to its API. This is the easiest approach at the start. Once real business traffic arrives, problems appear one after another. They fall into three categories.

    Concurrency limits. Batch-processing agents send a large number of requests at once. Tasks such as contract review or cross-referencing multiple documents often split one set of materials into hundreds of text chunks and process them in parallel. If the provider’s concurrency limit is low, the tasks have to queue, and total processing time can multiply.

    Service stability. Some models perform normally with simple prompts but begin to stall in reasoning or truncate their output once role settings, output formats, and examples are added. Under high concurrency, timeouts can also occur. These problems usually do not show up in offline evaluations.

    Version and pricing changes. When a provider adjusts model versions, rate-limiting rules, or pricing, a workflow already in production may change its behavior without warning. If a team relies on only one provider, it has no alternative to switch to.

    The following hypothetical example shows the impact. A team runs a contract review workflow once a week. A single run originally finished in about four hours. After the provider changed its concurrency policy, the same task took more than 10 hours, and the weekly report could not be delivered on time. The loss here is that the entire workflow missed its time window.

    2. What Agents Require from a Model

    In conversational use, a model only needs to answer one question at a time. Agent workloads involve multi-turn calls, parallel requests, and long contexts running at the same time. When selecting a model, check each candidate against three requirements:

    1. Concurrency capacity: At your target concurrency, are the success rate and latency still within an acceptable range?
    2. Capacity for complex prompts: With a full set of roles, constraints, formats, and examples, does the model produce output that consistently follows the required structure?
    3. Operational transparency: Does the provider have a change notification mechanism, records of support ticket response times, and public explanations of parameter adjustments?

    The third requirement is often overlooked. If the official documentation does not state the conditions under which concurrency limits change, a team has difficulty determining whether a failure originates in its own system or with the provider. During selection, request written change notification rules from the provider, and keep records of actual support ticket response times.

    Evaluation should also use your own business prompts and traffic data rather than relying only on public leaderboards. A model that scores highly on general benchmarks does not necessarily handle your complex workflow well.

    3. Architecture Solutions

    1. Model gateway: unified interface with automatic switching

    Business code does not call any provider’s SDK directly. Instead, requests go through a gateway layer. The gateway handles routing, retries, circuit breaking, and fallback. To add a new provider, you only need to implement one adapter.

    The adapter must follow a unified contract. It provides a name attribute and implements a call(prompt, max_tokens) method that returns a string. Rate limits, timeouts, and server errors from the provider must be mapped inside the adapter to the exception types defined in the code below.

    1. import random
    2. import time
    3. class RateLimitError(Exception):
    4. """Raised when the provider returns a rate limit (e.g., HTTP 429). The adapter is responsible for the mapping."""
    5. class ProviderUnavailable(Exception):
    6. """Raised when the provider returns a 5xx error or the connection fails. The adapter is responsible for the mapping."""
    7. class Provider:
    8. """Adapter contract: subclasses must set name and implement the call method."""
    9. name = "base"
    10. def call(self, prompt: str, max_tokens: int) -> str:
    11. raise NotImplementedError
    12. class ModelGateway:
    13. def __init__(self, providers, max_retries=3, base_delay=0.5,
    14. breaker_threshold=5, breaker_cooldown=60):
    15. self.providers = providers # Sorted by priority
    16. self.max_retries = max_retries
    17. self.base_delay = base_delay
    18. self.breaker_threshold = breaker_threshold
    19. self.breaker_cooldown = breaker_cooldown
    20. self.failures = {p.name: 0 for p in providers}
    21. self.opened_at = {p.name: 0.0 for p in providers}
    22. def _is_open(self, provider):
    23. name = provider.name
    24. if self.failures[name] < self.breaker_threshold:
    25. return False
    26. if time.time() - self.opened_at[name] >= self.breaker_cooldown:
    27. # Half-open state: allow one trial request