Organizations constructing AI brokers face a typical problem: Each request, whether or not a routine standing verify or complicated evaluation, sometimes will get routed to a single giant, costly mannequin. This one-size-fits-all method can drive up API prices, introduce unpredictable latency, and take away the potential for offline operation. Even routine queries that would resolve regionally find yourself requiring a full community round-trip to a cloud-hosted giant language mannequin (LLM).
The Adaptive Agentic Intelligence Framework (AAIF), constructed with Strands Brokers, takes a special method. As a substitute of routing all requests to a single giant mannequin, AAIF makes use of small language fashions (SLMs) to deal with routine duties regionally. Extra complicated requests are routed to cloud-hosted fashions by Amazon Bedrock. This method builds on the analysis place from Belcak et al. at NVIDIA. They argue that small language fashions are “sufficiently highly effective, inherently extra appropriate, and essentially extra economical for a lot of invocations in agentic methods.” Constructed on Strands Brokers, the framework demonstrates how clever mannequin orchestration may help cut back prices whereas sustaining low latency for native operations.
On this publish, we stroll by the important thing parts of AAIF utilizing Strands Brokers with native SLMs by Ollama and cloud fashions by Amazon Bedrock. We use an Web of Issues (IoT) monitoring situation as a reference implementation.
Resolution overview
AAIF organizes AI processing into three layers, every optimized for various process varieties, as Determine 1 reveals:
- Good orchestration makes use of a light-weight SLM (llama3.2:1b) because the decision-making layer. This orchestrator classifies incoming requests and routes them to the suitable processing layer with out hardcoded guidelines.
- Native processing handles routine duties like gadget telemetry retrieval and picture evaluation utilizing SLMs operating on native {hardware} by Ollama. These duties full with low latency and no cloud dependency.
- Cloud processing handles complicated sample evaluation and strategic suggestions by frontier fashions in Amazon Bedrock. These requests want broader context and multi-step reasoning that SLMs can not reliably present.
Determine 1: The three AAIF processing layers for sensible orchestration, native processing, and cloud processing
Determine 1 reveals the entire AAIF system structure. On the middle sits the Strands agent, which connects to an Ollama runtime internet hosting each the 1B-parameter orchestrator mannequin and the imaginative and prescient mannequin. The agent exposes three instruments: get_device_telemetry for native sensor information retrieval, analyze_camera_feed for on-device imaginative and prescient processing by llama3.2-vision, and get_expert_insights which calls Amazon Bedrock by boto3 for complicated evaluation. Incoming consumer requests stream by the SLM orchestrator, which classifies every request and dispatches it to both a neighborhood software or the cloud endpoint primarily based on process complexity.
Determine 2: Full AAIF system structure exhibiting the Strands agent, Ollama runtime, software integrations, and Amazon Bedrock connectivity
The framework adapts to your deployment constraints somewhat than requiring you to restructure your infrastructure round it. This structure runs on edge units like a Raspberry Pi with 8 GB of reminiscence, in full cloud deployments the place all inference hits Amazon Bedrock, or in hybrid configurations that mix native velocity with cloud reasoning. The pliability comes from separating the routing logic (the SLM orchestrator) from the processing instruments, which you’ll swap or reconfigure independently relying on obtainable {hardware} and community connectivity.
Stipulations
For this walkthrough, you must have the next conditions:
Arrange the setting
Create a undertaking listing and begin the Ollama server:
Pull the required fashions:
Create a file known as aaif_agent.py and add the next parts.
Strands Brokers makes use of the @software decorator to outline capabilities that brokers can invoke. Begin by creating instruments for native processing.
The primary software retrieves gadget telemetry information. In a manufacturing setting, this could hook up with precise IoT sensors. For this walkthrough, it makes use of simulated gadget information:
The second software performs imaginative and prescient evaluation utilizing a neighborhood SLM. The llama3.2-vision mannequin runs totally on native {hardware}, which implies delicate digital camera feeds don’t go away the gadget:
Implement cloud processing
For complicated evaluation that requires broader reasoning, create a software that calls Amazon Bedrock. This software is invoked solely when the orchestrator determines that native fashions can’t deal with the request:
Configure the Strands agent with sensible orchestration
The core of AAIF is the Strands agent configuration. The agent makes use of a neighborhood SLM (llama3.2:1b) as its orchestrator. Strands Brokers helps a number of mannequin suppliers, and right here we use the Ollama supplier to run the orchestrator regionally:
The SLM-powered orchestrator analyzes every request and routes it to the suitable software with out hardcoded key phrase matching. The routing occurs by the mannequin’s understanding of the request:
| Request | Routing | Latency |
| “Examine gadget standing” | Native SLM | Low (native inference) |
| “Analyze this picture” | Native imaginative and prescient AI | Low (native inference) |
| “What optimization methods do you suggest?” | Cloud (Amazon Bedrock) | Increased (community round-trip) |
Desk 1: Request, routing, and latency estimates for native in comparison with cloud inference
Run the agent
With the agent configured, you may work together with it immediately:
The agent mechanically classifies every request and routes it to the suitable processing layer. No express routing guidelines are wanted.
Adapt to completely different deployment eventualities
The AAIF structure adapts to completely different infrastructure necessities by altering the mannequin configuration:
When your workload runs totally within the cloud and no edge {hardware} is out there, substitute the Ollama mannequin configuration with Amazon Bedrock for all processing. This routes each request by managed cloud inference, providing you with auto scaling with out requiring native GPU sources. Groups with dependable low-latency connectivity and no information residency constraints profit most from this configuration:
The hybrid configuration retains the native SLM orchestrator intact whereas including cloud fashions for requests that exceed native mannequin capabilities. That is the default AAIF configuration proven on this walkthrough. It fits environments the place most requests are routine sufficient to resolve regionally, however some require the broader reasoning of a bigger mannequin. Price financial savings can come from the roughly 80 p.c of site visitors that doesn’t hit a paid API endpoint.
For environments which are totally air-gapped or have strict information sovereignty necessities, substitute the cloud software with a bigger native mannequin and run all processing on-device. A 3B-parameter mannequin operating on {hardware} with satisfactory reminiscence can deal with reasonably complicated duties that the 1B orchestrator would in any other case escalate. The trade-off is diminished reasoning depth on the toughest queries, however the profit is information not leaving the premises:
The implementation on this publish makes use of native software calls outlined immediately within the agent code. For manufacturing deployments with a number of brokers sharing instruments throughout companies, expose these instruments as Mannequin Context Protocol (MCP) servers. MCP gives a standardized interface for software discovery and invocation, so you may centralize software administration and reuse instruments throughout completely different brokers and environments. In Determine 3, we present the best way to convert AAIF instruments into MCP servers for distributed, centralized software calling.
Within the distributed configuration as proven in Determine 3, Gadget 1 acts because the orchestrating hub, operating the Strands agent with the SLM router and a neighborhood telemetry software. It connects by the MCP protocol to Gadget 2, which runs an edge imaginative and prescient processing server with llama3.2-vision. Gadget 3 serves as a cloud analytics gateway linked to Amazon Bedrock. From the orchestrator’s perspective, all distant instruments seem as native operate calls as a result of the MCP transport layer handles serialization and community communication transparently.
Cleansing up
To keep away from incurring future prices, full the next cleanup steps:
- Disable Amazon Bedrock mannequin entry: Open the Amazon Bedrock console, select Mannequin entry, and revoke entry for Amazon Nova Lite. For detailed steps, see Handle mannequin entry within the Amazon Bedrock Consumer Information.
- Cease the Ollama server and take away fashions to free native disk house (roughly 2 GB):
- Delete the undertaking listing in case you not want the pattern code:
Conclusion
We confirmed the best way to construct cost-effective AI brokers utilizing the Adaptive Agentic Intelligence Framework with Strands Brokers. By routing routine requests to native SLMs and reserving cloud fashions on Amazon Bedrock for complicated evaluation, AAIF may help cut back API prices whereas sustaining low latency for routine operations.
Earlier than you run this sample in manufacturing, add accountable AI controls to the cloud inference path, since these requests carry software outputs, retrieved information, and consumer enter. You may connect Amazon Bedrock Guardrails to the Strands BedrockModel with a guardrail ID and model. It then applies content material filters for dangerous classes, immediate injection filters, and contextual grounding checks that block responses not supported by the supply information. To use the identical insurance policies to the native SLM tier, name the standalone ApplyGuardrail API on its inputs and outputs. This fashion, each request follows one security customary regardless of which mannequin handles it.
This architectural sample applies past IoT monitoring. A healthcare group may run affected person monitoring regionally whereas routing prognosis help to cloud fashions. A monetary companies agency may course of transactions on-premises and reserve cloud capability for danger evaluation. A producing workforce may run high quality management imaginative and prescient fashions on the edge whereas sending optimization requests to the cloud.
To be taught extra about constructing brokers with Strands Brokers, go to the Strands Brokers documentation. For details about obtainable basis fashions, see Amazon Bedrock.
In regards to the authors


