Guide — Custom model providers
Scope
This document summarises the steps and criteria for implementing custom model providers with the Strands Agents SDK inside Shell Sentinel. It serves as an internal checklist and complements the official documentation.
Prerequisites
- Know the
strands.models.Modelhierarchy (review examples such asBedrockModel). - Understand
Messages,StreamEventandToolSpectypes. - Python client for the proprietary LLM service (sync or async).
- Declarative configuration in
conf/and credentials via environment variables.
Implementation flow
- Define configuration: create a typed
ModelConfigand exposeget_config/update_config. - Initialise the client: resolve credentials securely, instantiate the remote client and register logging.
- Implement
stream(...): convert inputs, adapt toStreamEvent, handle errors; useasyncio.to_threadfor sync SDKs. - Support tools: reuse
streaminstructured_output(...)with PydanticToolSpecconversion. - Register the provider in
smart_ai_sys_admin.agentandconf/agent.conf.
Additional considerations
- Use
DEBUGlogging for troubleshooting. - Document new parameters in user manuals when operators are affected.
- Never hardcode tokens or endpoints.
- Run smoke tests before TUI integration.
Practical case: LM Studio
- OpenAI-compatible local server (
/v1/*); configurebase_url,api_keyandmodel_id. - Start with
lms server start; tuneclient_argsfor timeouts. - Native REST API (
/api/v0/*) exposes metrics andmax_context_length.
Practical case: Cerebras
- Integrate
cerebras_cloud_sdkwith SSE streaming. - Configure
providers.cerebraswithmodel_id,params,client_argsandapi_key_env. - Convert
ChatChunkResponseto native events withmetadatafor usage and timing.