Skip to main content

What are Events?

Events are real-time notifications streamed asynchronously from the remote autonomous general AI agent as it executes tasks. They provide complete transparency into the general AI agent’s workflow, allowing you to monitor progress, debug issues, and build interactive applications that respond to the general AI agent’s activities in real-time. Unlike traditional polling-based systems, PandaAGI events are pushed from the remote agent immediately as they occur, ensuring minimal latency and maximum responsiveness.

Event Architecture

The PandaAGI SDK streams events from a remote autonomous general AI agent that operates independently. Events are generated as the general AI agent:
  • Connects to its execution environment
  • Performs web searches and navigation
  • Creates, reads, and modifies files
  • Executes shell commands and scripts
  • Provides progress updates and notifications
  • Completes tasks and reports results

Core Event Types

The PandaAGI SDK uses a comprehensive set of event types defined in the EventType enum. Here are all available event types:

Connection & Environment Events

Fired when the general AI agent successfully connects and initializes its workspace:
When the general AI agent fails to connect or initialize:

Web Research Events

Indicates the general AI agent is performing a web search:
Contains the results from a web search:
When the general AI agent navigates to a specific webpage:
Contains the content extracted from a webpage:

File System Events

When the general AI agent reads file contents:
When the agent creates or writes to files:
When the agent replaces content in existing files:
When the agent searches for files or content within files:
When the general AI agent explores directory structure:

Command Execution Events

When the general AI agent executes shell commands:
When the agent views output from shell commands:
When the agent writes to shell or creates shell scripts:

Communication Events

Progress updates and notifications from the general AI agent:
When the agent needs clarification or input from the user:
Indicates the agent has finished the requested task:

Creative & Generation Events

When the general AI agent generates images or visual content:

Complete EventType Reference

Event Streaming

Using Event Handlers

Process events with custom handlers for better organization and reusability:

Basic Streaming with Type Safety

Stream events in real-time as your remote general AI agent works through complex tasks:

Custom Event Handler Patterns

Create specialized handlers for different use cases:

Creating Events Programmatically

You can also create typed events programmatically for testing or custom workflows:

Next Steps

Environments

Learn about general AI agent execution environments

Examples

See event streaming in action in the PandaAGI Assistant pre-built app