Skip to main content
The autogen_core package provides the foundational components for building distributed, event-driven multi-agent systems.

Agent Classes

Base class for implementing agents with message handling capabilities.
AgentId
required
Unique identifier for the agent instance
AgentRuntime
required
Runtime environment for message passing and agent coordination
AgentId
Returns the agent’s unique identifier
Decorator-based agent with automatic message routing.
str
Optional description of the agent’s capabilities

Decorators

decorator
Marks a method as a handler for published messages of the parameter type
decorator
Marks a method as an RPC endpoint for direct invocation
decorator
Marks a method as an event handler
Agent implementation using closure functions for simple message handling.
str
required
Agent name identifier
Callable
required
Async function to handle incoming messages
AgentRuntime
required
Runtime environment

Runtime & Messaging

Protocol defining the runtime environment for agent execution and communication.

Methods

async method
Send a message to a specific agent and await response
Any
required
The message payload to send
AgentId
required
Target agent identifier
AgentId | None
Sender agent identifier (None for external)
CancellationToken | None
Token to cancel the operation
str | None
Unique message identifier
async method
Publish a message to all subscribers of a topic
Any
required
The message payload
TopicId
required
Topic to publish to
AgentId | None
Sender agent identifier
async method
Register an agent factory for dynamic agent creation
str | AgentType
required
Unique agent type identifier
Callable
required
Factory function that creates agent instances
type[Agent] | None
Expected agent class for type checking
In-process runtime for single-threaded agent execution.
method
Start the runtime message processing loop
async method
Gracefully stop the runtime
Context information for message handling.
AgentId | None
Identifier of the message sender
TopicId | None
Topic the message was published to
str
Unique message identifier
CancellationToken
Token for cancelling operations

Identity & Types

Unique identifier for an agent instance.
str
required
Agent type name (alphanumeric and underscores)
str
required
Instance key (ASCII 32-126 characters)
Agent type definition for factory registration.
str
required
Type name identifier
Topic identifier for pub/sub messaging.
str
required
Topic type
str
required
Topic source namespace
Proxy for remote agent communication.

Subscriptions

Subscribe to messages by exact type match.
str
required
Topic type to subscribe to
str
required
Agent type that will receive messages
Subscribe to messages matching a type prefix.
str
required
Topic type prefix to match
str
required
Agent type to receive matching messages
Subscribe to all messages in a namespace.

Serialization & Components

Protocol for custom message serialization.
Declarative component configuration.
decorator
Marks a class as a configurable component
class
Serializable component configuration
str
required
Component type identifier
dict
required
Component configuration data
Image data container for multimodal messages.
classmethod
Create image from byte data
classmethod
Create image from file path
classmethod
Create image from URL

State Management

Protocol for agent state persistence.
In-memory cache store implementation.

Intervention & Control

Protocol for intercepting and modifying messages.
Exception to prevent message delivery.
Token for cancelling long-running operations.

Telemetry

OpenTelemetry integration for distributed tracing.
Structured logging configuration.
str
Name of the root logger: "autogen_core"
str
Name for structured event logging
str
Name for development trace logging

Types & Protocols

Represents a tool or function call.
str
required
Unique call identifier
str
required
Function or tool name
dict
required
Function arguments
Represents a message with unknown type.

Constants

See Also