Skip to main content
Deprecation notice: The agentic ACP type is deprecated. Use async, which behaves the same.

Overview

Async agents use an async ACP architecture that:
  • Supports both streaming and non-streaming responses
  • Requires explicit task creation before sending events
  • Ideal for complex workflows and long-running operations

Key API Method: send_event()

For async agents, you always use the send_event() method to communicate with the agent. This is different from sync agents, which use send_message() for direct communication.
Key Differences from Sync Agents:
  • Task creation required - Must create a task before sending events (sync agents don’t need this)
  • Event-based communication - Send events to tasks, not direct messages to agent names
  • Asynchronous processing - Events are processed asynchronously, poll or stream for responses
The event-based model enables asynchronous processing, state management across multiple turns, and complex workflow orchestration.

ACP Types: Base vs Temporal

Async agents can be implemented using two different backend types:
  • Base ACP - Simple event-driven architecture, suitable for learning and simple use cases
  • Temporal - Robust workflow engine for production, handles race conditions automatically
Important: From the client’s perspective, both base ACP and Temporal agents use the exact same API (both use send_event()). The choice between base and Temporal is purely a server-side implementation detail that is transparent to client code. You can switch an agent from base to Temporal (or vice versa) without changing any client code.

Setup

Prerequisites

Environment Variables

Initialize the Client

Basic Usage

1. Get Agent Information

2. Create a Task

Async agents require a task to be created before sending events:

3. Send an Event

4. Receive Messages (Polling)

Since async agents process events asynchronously, you need to poll for messages:

Streaming Messages

Helper Function for Streaming

Use the built-in helper to subscribe to task messages when testing in a local environment. The helper is synchronous: it takes a synchronous Agentex client and a task object with a name, such as the task from step 2.

Custom Streaming Implementation

For more control over streaming or for production environments, implement custom streaming logic:

Multi-Turn Conversations

Async agents automatically maintain conversation history:

View Conversation History

Retrieve all messages from a task:

Managing Tasks

Check Task Status

List All Tasks for an Agent

State Management

Async agents can maintain state across events: