learning-it by example

Back to the video

Wrap Legacy APIs for AI Agents: OpenAPI to Checked Tools

Seven operations in the old API, four tools for the agent, and only two of six test calls got through.

Video #240 ยท Enterprise architecture and AI agents

Steps in the video

  1. 0:00 Seven operations, four tools, and two calls that reached the old system
  2. 0:32 The idea
  3. 1:18 Setup
  4. 1:41 The description
  5. 2:13 From description to tools
  6. 2:41 From a call to a request
  7. 3:44 What this does not show
  8. 4:20 Mistakes to avoid
  9. 4:47 My take and next steps
  10. 5:18 Recap

Files

  • compare.py (24 lines)
  • convert.py (46 lines)
  • legacy.py (7 lines)
  • spec.py (28 lines)

Download the code (zip)

Tested with

Python 3.12.15

What this does not show

A made-up API with seven operations and six hand-written calls; no model or agent runs. The checks cover missing, unknown, wrong type and one maximum, so a negative refund still passes. No nested bodies, headers, authentication, user identity or approval step.

Sources

Learning IT by Example.