Using AWS Bedrock Agents to Control Third-Party APIs
What if an AI agent could read your API documentation and figure out how to use it? That’s the promise of AWS Bedrock Agents combined with OpenAPI specifications.
The Concept
AWS Bedrock Agents can interpret OpenAPI specs and autonomously determine which API calls to make. Rather than hardcoding integration logic, you give the agent your API documentation and let it work out the rest.
This enables complex, multi-step workflows that would traditionally require significant integration code.
The Architecture
Our approach uses a thin client layer between Bedrock and the target API:
- User submits a natural language request to the Bedrock Agent
- Agent analyses the OpenAPI spec and returns suggested API call details
- Client authenticates and executes the call against the target system
- Response returns to the agent for further processing
- Process repeats until the request is fulfilled
This pattern keeps authentication credentials out of Bedrock while letting the agent orchestrate the workflow.
A Practical Example
We integrated Tado’s smart heating API to demonstrate the concept. A request like “increase bedroom temperature by 3 degrees” triggers the agent to:
- Query available zones via GET request
- Retrieve current temperatures for the bedroom
- Calculate the adjusted value (+3 degrees)
- Submit the change via PUT request with the appropriate JSON payload
The agent figured this out from the OpenAPI spec alone—no hardcoded workflow logic.
What Makes This Powerful
Tool Discovery — LLMs figure out required API endpoints from OpenAPI specs without explicit programming
Chain of Thought — Bedrock provides tracing showing the agent’s reasoning at each step
Multi-step Automation — Complex workflows requiring sequential calls happen automatically
Practical Tips
- Use
TSTALIASIDalias during development for rapid iteration - Optimise OpenAPI descriptions using common terminology the model understands
- Test multiple foundation models—Claude Sonnet 3.5 worked well for us
- Record user journeys to identify patterns worth productising
Resources
- Working demo: github.com/foyst/tado-bedrock-agent-app
- Built on the Vercel AI Chatbot template
If you’re building AI integrations and have OpenAPI specs for your target systems, Bedrock Agents offer a compelling approach.