Principle:ANative Lab EvoAgentX LLM Configuration
| Knowledge Sources | |
|---|---|
| Domains | LLM, Configuration |
| Last Updated | 2026-10-21 00:00 GMT |
Overview
Method for abstracting LLM provider configuration behind a unified interface so agents and workflows can switch providers without code changes.
Description
LLM Configuration is the practice of separating model selection, authentication, and generation parameters into a declarative configuration object (subclass of `LLMConfig`) that is consumed by a model class (subclass of `BaseLLM`). This decoupling allows the same agent or workflow code to run against OpenAI, OpenRouter (multi-provider), LiteLLM (multi-provider + local), or other providers by simply swapping the config. Each provider config encapsulates API keys, model names, and provider-specific parameters (e.g., `enable_prompt_caching` for OpenRouter, `is_local` for LiteLLM).
Usage
Use this principle when designing agent systems that need to support multiple LLM providers. Pass a `LLMConfig` subclass to `CustomizeAgent(llm_config=...)` or any workflow component that requires an LLM. Choose the provider config based on your routing needs: `OpenAILLMConfig` for OpenAI-only, `OpenRouterConfig` for multi-provider via OpenRouter, `LiteLLMConfig` for multi-provider + local models.
Theoretical Basis
The configuration pattern decouples the what (which model, which parameters) from the how (API client instantiation, request formatting). A config object is a serializable representation of provider settings:
# Abstract pattern (not real implementation)
config = ProviderConfig(model="...", api_key="...")
llm = ProviderLLM(config=config)
# llm.generate() routes to the correct API based on config type
This enables:
- Provider portability: Swap configs without changing agent code
- Serialization: Configs can be saved to JSON and reloaded
- Cost tracking: Each LLM instance tracks token costs via LiteLLM
Related Pages
Implemented By
- Implementation:ANative_Lab_EvoAgentX_OpenAILLM
- Implementation:ANative_Lab_EvoAgentX_OpenRouterLLM
- Implementation:ANative_Lab_EvoAgentX_LiteLLM
- Implementation:ANative_Lab_EvoAgentX_LLMConfigs
- Implementation:ANative_Lab_EvoAgentX_AdditionalLLMs
- Implementation:ANative_Lab_EvoAgentX_WorkflowExamples