Back office ops · Production

Agoda builds API Agent: a universal MCP server enabling natural language queries across any internal API via SQL post-processing

The problem

Agoda operates hundreds of internal services, each requiring its own custom MCP server integration to connect to AI tools — a bottleneck that meant any new API connection required bespoke code, and any ad hoc query required knowing the schema or asking an engineer to write a script.

Workflow diagram · grounded in source
1
Natural language question received
trigger
“You ask questions in natural language”
2
Schema introspection
ai_action
“API Agent introspects the schema automatically”
3
Query generation and execution
ai_action
“The agent generates the appropriate queries, executes them, and returns structured results”
4
SQL post-processing in DuckDB
ai_action
“API Agent stores each response in DuckDB and runs SQL against it. The LLM sees a small preview and a schema; the full dataset stays in DuckDB for querying. Where needed, the agent can join results from multiple endpoints inside DuckDB be…”
5
Recipe extraction and replay
feedback_loop
“Store recipe — parameterized template cached with original question Match future queries — new questions fuzzy-matched against stored recipes Replay instantly — on match, execute template directly, skip reasoning”
6
Result returned to client
output
“When set, API Agent skips LLM processing entirely and returns CSV directly.”
Reported outcome

A single API Agent deployment serves any number of target APIs simultaneously; repeated query patterns are parameterized as recipes and replayed at a fraction of the latency without full LLM reasoning.

Reported metrics
Query latency with recipe vs. full reasoningfraction of the latency
Direct-download query latencyfraction of the latency
Reported stack
FastMCPOpenAI Agents SDKDuckDBOpenTelemetryJaegerZipkinGrafana TempoArize Phoenix
Source
https://medium.com/agoda-engineering/how-to-convert-any-api-to-mcp-with-zero-code-and-zero-deployments-using-apiagent-fa494de8eaee
Read source ↗

Frequently asked questions

What did this team achieve with this AI workflow?

A single API Agent deployment serves any number of target APIs simultaneously; repeated query patterns are parameterized as recipes and replayed at a fraction of the latency without full LLM reasoning.

What tools did this team use?

FastMCP, OpenAI Agents SDK, DuckDB, OpenTelemetry, Jaeger, Zipkin, Grafana Tempo, Arize Phoenix.

What results were reported?

Query latency with recipe vs. full reasoning: fraction of the latency; Direct-download query latency: fraction of the latency (source-reported, not independently verified).

How is this back office ops AI workflow structured?

Natural language question received → Schema introspection → Query generation and execution → SQL post-processing in DuckDB → Recipe extraction and replay → Result returned to client.