Events
Events are Python objects that components use to communicate in the Line SDK.
What is an Event?
An event is a Python object that carries information between nodes, bridges, and the user.
Basic Example
Built-in Event Types
For a full list of built-in events and their descriptions, see line/events.py.
Events let components communicate without being tightly coupled. See Agent Patterns for examples.
Defining Custom Event Types
Any object can be an event. This is useful for passing arbitrary data between components.
Use structured classes like Pydantic BaseModel or Python dataclasses for your custom events. This provides type safety and validation and makes your code more readable.
Messages
Messages are the wrappers around events. They contain the event, but also additional metadata:
Messages are automatically wrapped in Messages before being sent to the bus.