Skip to main content
Conversations are the primary way your agent handles user messages. Each conversation handler defines how your agent responds to messages from specific channels.

Creating a conversation

Create a conversation handler in src/conversations/:

Channel matching

The channel property determines which integration channels the Conversation handles:

Conversation handler

The handler function receives context about the incoming message and provides APIs to execute your agent’s logic:

Using knowledge bases

Provide knowledge to your agent’s AI model:

Using hooks

Add hooks to customize behavior at different stages:

Conversation instance

The handler receives a conversation object that provides methods to interact with the current conversation:

Sending messages

Send a message to the conversation:

Typing indicators

Control typing indicators:

Conversation tags

Access and modify conversation tags:

Trigger subscriptions

Subscribe a conversation to triggers:

Multiple conversations

You can create multiple conversation handlers for different channels or use cases:

Reference

Conversation props

Handler parameters

The handler function receives different parameters depending on the incoming request type. The handler uses a discriminated union based on the type field:

Message handler

When type is "message":

Event handler

When type is "event":

Workflow request handler

When type is "workflow_request":
Each conversation file should export a default Conversation instance. The ADK automatically discovers and registers all conversations in the src/conversations/ directory.