Event Streaming
ZeroDB includes event streaming for real-time agent communication and application state tracking.
Create an Event
curl -X POST https://api.ainative.studio/api/v1/public/zerodb/events \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"type": "agent.task_completed",
"data": {
"agent_id": "agent_123",
"task": "research",
"result": "Found 5 relevant papers"
}
}'
List Events
curl "https://api.ainative.studio/api/v1/public/zerodb/events?type=agent.task_completed&limit=20" \
-H "Authorization: Bearer $TOKEN"
Event Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Event type (e.g., agent.task_completed) |
data | object | Yes | Event payload |
source | string | No | Source system or agent ID |
correlation_id | string | No | ID for tracking related events across systems |
Python SDK
import requests
headers = {"Authorization": "Bearer YOUR_API_KEY"}
base = "https://api.ainative.studio/api/v1/public/zerodb/events"
# Create an event
requests.post(base, headers=headers, json={
"type": "agent.task_completed",
"data": {
"agent_id": "agent_456",
"task": "research",
"duration_ms": 2340,
"result": "success"
},
"source": "agent-orchestrator",
"correlation_id": "workflow_789"
})
# Query events by type and time range
response = requests.get(base, headers=headers, params={
"type": "agent.task_completed",
"start_time": "2026-04-01T00:00:00Z",
"limit": 50
})
for event in response.json()["events"]:
print(f"[{event['timestamp']}] {event['type']}: {event['data']}")
ℹ️Correlation IDs
Use correlation IDs to track related events across distributed agent systems. Query all events with the same correlation_id to reconstruct the full workflow trace.
Use Cases
Agent Coordination
Audit Logging
State Sync
Workflow Triggers
Endpoints
| Method | Path | Description |
|---|---|---|
| POST | /zerodb/events | Create an event |
| GET | /zerodb/events | List events with filters |
| GET | /zerodb/events/{id} | Get a specific event |