Route agent requests between local SLMs and Amazon Bedrock with Strands Agents
An AWS blog walkthrough shows how to build an Adaptive Agentic Intelligence Framework with Strands Agents. A small local model handles routine requests, and complex analysis goes to cloud models on Amazon Bedrock. An IoT monitoring scenario serves as the reference implementation.
The problem
Teams building AI agents often send every request, from simple status checks to complex analysis, to one large and costly model. This can raise API costs, make latency unpredictable and rule out offline operation. Routine queries that could be solved locally still need a network round-trip to a cloud LLM.
Steps
- Install Python 3.10+, Ollama, Strands Agents, boto3 and the AWS CLI, and enable Amazon Bedrock model access.
- Start the Ollama server and pull llama3.2:1b (orchestrator) and llama3.2-vision (vision).
- Define local tools with the @tool decorator: get_device_telemetry (simulated IoT data) and analyze_camera_feed (local vision model).
- Add a get_expert_insights tool that calls Amazon Bedrock through boto3 for complex questions.
- Configure a Strands Agent using OllamaModel with llama3.2:1b and a system prompt that maps request types to tools.
- Run the agent with telemetry, image and strategy prompts, and let the orchestrator choose the local or cloud path.
From the official docs
from strands.models.ollama import OllamaModel
model = OllamaModel(
model_id="llama3.2:1b",
host="http://localhost:11434",
params={"max_tokens": 300, "temperature": 0.3},
)
Results
- Routine requests such as device status checks and image analysis run locally with low latency and no cloud dependency.
- Only complex requests reach Amazon Bedrock, and the article says cost savings can come from the roughly 80 percent of traffic that doesn't hit a paid API endpoint.
- The same design can run on a Raspberry Pi with 8 GB of memory, fully in the cloud, or in a hybrid setup, according to the AWS blog.
As reported by the source (AWS Machine Learning Blog tutorial); AgentGid did not measure these figures.
This suits a small team comfortable with Python and the AWS CLI that wants to prototype hybrid routing, since Strands Agents is Free (OSS) and Ollama runs locally. Watch the "roughly 80 percent" savings figure: it comes from the AWS article's IoT scenario, so your own traffic mix may differ, and a 1B router can misroute requests. LangGraph (Free (OSS)) is an alternative if you want more explicit routing control.
The agent used here
Similar use cases
How Cornerstone OnDemand cut database diagnosis time with Strands Agents on Amazon Bedrock
Cornerstone OnDemand's three-person Enterprise DataOps team built Orion AI, a multi-agent system on Amazon Bedrock and Strands Agents, in six months. It speeds up database inciden…
As reported by AWS, database diagnosis time dropped from 45 minutes to 10 minutes, a 78% reduction.
How Deda.Tech automates ITSM provisioning and server lifecycles with n8n
Italian IT service provider Deda.Tech uses n8n as middleware between its internal ITSM system and customers' tech stacks. It automates VM provisioning and server lifecycle tasks, …
Delivery time improved from 2 days to 30 minutes, as reported by n8n (vendor case study).
How Incarna let agents pay BlockRun per inference with AgentCore payments
Incarna, which gives AI agents a persistent identity, used Amazon Bedrock AgentCore payments so its agents can pay BlockRun for model inference one request at a time over x402. Th…
As reported by AWS, the Incarna team finished the full integration in three days (one to build, two to test), against two to three months originally …