Quarkus ยท Apache Camel ยท Kafka ยท MCP ยท Keycloak ยท langchain4j ยท LGTM

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.

9Parts, from foundations to the final project
46Chapters and appendices published so far
2Stacks per pattern: this book's Quarkus and Camel, and your own
1Domain throughout: orders, stock, payments, shipments and notifications

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.

Part 0

Foundations

The two stacks, why an agent-facing API differs from a human-facing one, and how to read the catalog that follows.

3 chapters Explore โ†’
Part 1

Build: synchronous APIs

Build the request/response surface: REST and GraphQL endpoints shaped so an agent can call them as MCP tools.

10 chapters Explore โ†’
Part 2

Build: MCP packaging

Build the tool surface itself: packaging an API as MCP tools, progressive discovery, and securing what an agent can call.

4 chapters Explore โ†’
Part 3

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.

5 chapters Explore โ†’
Part 4

Consume

Consume what Part 1 to 3 built: calling an MCP server and its async side from Claude Code and from a langchain4j agent.

5 chapters Explore โ†’
Part 5

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.

4 chapters Explore โ†’
Part 6

Ship

Publish the tool surface and gate its drift in CI before an agent ever calls it in production.

2 chapters Explore โ†’
Part 7

Run in production

Run agent-facing APIs in production: observability, auditing AI-using code, identity and traffic guardrails, Kubernetes, and the final project.

6 chapters Explore โ†’
Appendices

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.

7 chapters Explore โ†’