Get in touch

Using AWS Bedrock Agents to Control Third-Party APIs

How to use AWS Bedrock Agents with OpenAPI specifications to build AI agents that autonomously chain API calls to fulfil complex requests.

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:

  1. User submits a natural language request to the Bedrock Agent
  2. Agent analyses the OpenAPI spec and returns suggested API call details
  3. Client authenticates and executes the call against the target system
  4. Response returns to the agent for further processing
  5. 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:

  1. Query available zones via GET request
  2. Retrieve current temperatures for the bedroom
  3. Calculate the adjusted value (+3 degrees)
  4. 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 TSTALIASID alias 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

If you’re building AI integrations and have OpenAPI specs for your target systems, Bedrock Agents offer a compelling approach.