API Patterns & Practices: APIs for Agents & LLMs
Build APIs that an AI agent or LLM consumes, not a human browsing Swagger UI. You reshape REST and GraphQL endpoints into MCP tools, wake agents up on Kafka events, wire identity and traffic guardrails around every tool call, and trace agent traffic in Grafana. Every pattern states a stack-neutral contract first, so it transfers to Python/FastAPI and Strawberry GraphQL.
The parts
Each pattern chapter states the problem, shows the Quarkus and Camel code that solves it, and ends with an invitation to build the same contract in your own stack. Later parts package the tool surface, test it, ship it, and run it in production.
Foundations
The two stacks, why an agent-facing API differs from a human-facing one, and how to read the catalog that follows.
Build: synchronous APIs
Build the request/response surface: REST and GraphQL endpoints shaped so an agent can call them as MCP tools.
Build: MCP packaging
Build the tool surface itself: packaging an API as MCP tools, progressive discovery, and securing what an agent can call.
Build: asynchronous APIs
Build the event-driven surface: waking an agent on a Kafka event, coordinating several agents, and gating the ones that need a human.
Consume
Consume what Part 1 to 3 built: calling an MCP server and its async side from Claude Code and from a langchain4j agent.
Test and automate
Prove the contract holds: manifest conformance, agent-behaviour evals, scripted non-interactive runs, and async and human-in-the-loop test flows.
Ship
Publish the tool surface and gate its drift in CI before an agent ever calls it in production.
Run in production
Run agent-facing APIs in production: observability, auditing AI-using code, identity and traffic guardrails, Kubernetes, and the final project.
Appendices
Reference material: llms.txt in depth, OpenShift Local, a streaming comparison, the pattern map and glossary, building a consuming skill end to end, deterministic decisioning behind an agent tool, and structured outputs for typed agent I/O.