Inferensys

Glossary

AsyncAPI

AsyncAPI is an open-source specification for describing asynchronous, event-driven APIs (e.g., using Kafka, MQTT, WebSockets) to define message formats, channels, and operations for machine-readable documentation and code generation.
Stylish WeWork-like workspace with hot desks and document wall, professional searching through enterprise knowledge base on a mounted ultrawide display, warm industrial pendants overhead.
API SCHEMA INTEGRATION

What is AsyncAPI?

AsyncAPI is an open-source specification for describing asynchronous, event-driven APIs, enabling machine-readable documentation and code generation for systems using message brokers like Kafka, MQTT, or WebSockets.

AsyncAPI is a machine-readable specification, inspired by the OpenAPI Specification (OAS), designed to define asynchronous APIs and event-driven architectures. It provides a standardized format to describe message formats (using JSON Schema), communication channels, operations (publish/subscribe), and server configurations. This allows tools to automatically generate documentation, client code, server stubs, and perform validation, similar to how OpenAPI works for RESTful APIs.

The specification is foundational for API schema integration within AI agent systems, enabling dynamic invocation of event-based services. By ingesting an AsyncAPI document, an AI agent can understand available message brokers, the structure of events it can consume or produce, and the necessary authentication. This facilitates secure, structured interaction with real-time data streams and backend systems as part of tool calling and API execution workflows, ensuring agents operate within a well-defined contract.

API SCHEMA INTEGRATION

Core Components of an AsyncAPI Document

An AsyncAPI document is a machine-readable specification that defines an asynchronous, event-driven API. It is structured as a single JSON or YAML object containing several required and optional sections.

01

Info Object

The Info Object provides metadata about the API. This is the root-level info field and contains essential identification details.

  • title: A human-readable title for the application/API.
  • version: The version of the AsyncAPI document (not the API implementation).
  • description: A rich text description of the API.
  • contact and license: Optional objects for maintainer and usage rights information.

This section is analogous to the info object in an OpenAPI document and is crucial for documentation and tooling.

02

Servers Object

The Servers Object defines the network locations where the application's channels are hosted. It is a map of server definitions under the servers field.

Each server definition includes:

  • url: The network address (e.g., mqtt://broker.example.com:1883, kafka://cluster.prod:9092).
  • protocol: The communication protocol (e.g., mqtt, kafka, amqp, ws).
  • description: A human-readable explanation.
  • variables: For parameterized server URLs.
  • security: An array of required security schemes.

Servers provide the runtime connection context for channels.

03

Channels Object

The Channels Object is the core of the specification, describing the available event pathways. It is a map under the channels field where each key is a channel name, often representing a topic, queue, or event name.

A channel item defines:

  • address: A runtime expression for the full channel path (often derived from the key).
  • description: Explains the channel's purpose.
  • publish and/or subscribe Operation Objects: Describe the messages that can be sent or received on this channel.
  • parameters: For channels with variable path segments (e.g., user/{userId}/events).

Channels abstract the specific messaging infrastructure.

04

Operations Object

An Operations Object defines an action that can be taken on a channel, specified within a channel's publish or subscribe field. It describes the intent and characteristics of message flow.

Key fields include:

  • operationId: A unique string used to identify the operation in code generation.
  • message: A reference to or definition of the Message Object sent or received.
  • summary and description: Human-readable details.
  • security: Security requirements specific to this operation.
  • traits: For applying reusable operation patterns.

The publish operation sends a message to the channel; subscribe receives from it.

05

Messages Object

The Messages Object defines the format and semantics of a discrete piece of data communicated via a channel. It can be defined inline within an operation or referenced from the top-level components.messages section.

A message definition includes:

  • payload: A JSON Schema object defining the structure of the message body.
  • headers: A schema for protocol-specific headers or metadata.
  • correlationId: Describes an identifier for tracing message causality.
  • contentType: The MIME type of the payload (e.g., application/json, avro/binary).
  • name and title: For identification.

Messages ensure producers and consumers agree on data contracts.

06

Components Object

The Components Object is a container for reusable schema elements, located at components. It promotes modularity and reduces duplication within the AsyncAPI document.

Common reusable component sections include:

  • schemas: Reusable data models defined with JSON Schema.
  • messages: Reusable message definitions.
  • securitySchemes: Authentication and authorization definitions (e.g., userPassword, X509, httpApiKey).
  • parameters: Reusable channel parameters.
  • correlationIds: Reusable correlation ID objects.
  • operationTraits and messageTraits: Reusable sets of operation or message properties.

Objects within components are referenced using the $ref keyword.

SPECIFICATION COMPARISON

AsyncAPI vs. OpenAPI: Key Differences

A technical comparison of the two primary machine-readable API specification standards, highlighting their distinct design goals and application domains.

Feature / AspectAsyncAPIOpenAPI (Swagger)

Primary Communication Paradigm

Asynchronous, Event-Driven

Synchronous, Request-Response

Core Abstraction

Messages & Channels

Operations & Paths

Transport Protocol Support

Kafka, MQTT, AMQP, WebSockets, STOMP, NATS, JMS, SNS, SQS

HTTP/HTTPS, HTTP/2

Primary Document Structure

channels, messages, operations (subscribe/publish)

paths, operations (get, post, put, delete, etc.)

Message Payload Definition

Via message object, referencing schemas (JSON Schema)

Via requestBody & responses objects, referencing schemas (JSON Schema)

Server & Broker Configuration

Explicit servers object for broker connection details

servers object for API base URLs, less focus on broker metadata

Security Schemes

Supported (user/password, API key, OAuth2, etc.) for broker/client auth

Supported (API key, OAuth2, HTTP auth, etc.) for endpoint auth

Code Generation & Tooling

Client/Server SDKs, documentation, mock servers for async patterns

Client/Server SDKs, documentation, mock servers for REST APIs

Inherent State Management

Implied via message sequencing and correlation IDs

Stateless; state managed via session tokens or client context

Common Use Case

Microservices communication, IoT data streams, real-time notifications, event sourcing

CRUD web services, external developer APIs, server-to-server integration

Schema Reference Standard

JSON Schema (Draft 07, 2020-12)

JSON Schema (subset, typically Draft 04/2020-12)

Binding Specifications

Protocol-specific bindings (e.g., kafka, mqtt) for extended metadata

N/A (HTTP semantics are inherent)

ASYNCAPI

Frequently Asked Questions

AsyncAPI is an open-source specification for describing asynchronous, event-driven APIs. This FAQ addresses common questions about its purpose, mechanics, and role in AI agent integration.

AsyncAPI is an open-source specification, inspired by OpenAPI, that provides a machine-readable format for describing asynchronous, event-driven APIs. It works by defining a standard YAML or JSON document that specifies the message formats, communication channels, and operations (publish/subscribe) of an API that uses protocols like Kafka, MQTT, AMQP, or WebSockets. For an AI agent, ingesting an AsyncAPI document allows it to understand what events it can consume, what data those events contain, and where to send messages, enabling dynamic interaction with event-driven microservices and IoT systems.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.