Skip to content

Commit 6ea80b7

Browse files
authored
Add draft proposals (#408)
1 parent 37d9691 commit 6ea80b7

File tree

9 files changed

+2052
-0
lines changed

9 files changed

+2052
-0
lines changed

docs/docs.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,19 @@
4545
"concepts/tools"
4646
]
4747
},
48+
{
49+
"group": "Draft Changes",
50+
"pages": [
51+
"drafts/overview",
52+
"drafts/activity-events",
53+
"drafts/reasoning",
54+
"drafts/serialization",
55+
"drafts/multimodal-messages",
56+
"drafts/interrupts",
57+
"drafts/generative-ui",
58+
"drafts/meta-events"
59+
]
60+
},
4861
{
4962
"group": "Tutorials",
5063
"pages": ["tutorials/cursor", "tutorials/debugging"]

docs/drafts/activity-events.mdx

Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
1+
---
2+
title: Activity Events
3+
description:
4+
Proposal for representing ongoing agent progress between chat messages
5+
---
6+
7+
# Activity Events Proposal
8+
9+
## Summary
10+
11+
### Problem Statement
12+
13+
Users want to render "activity" updates inline with chat, not just at run start
14+
or end. Currently, there's no standardized way to represent ongoing agent
15+
progress between chat messages.
16+
17+
### Motivation
18+
19+
AG-UI is extended with **ActivityEvents** and **ActivityMessages** to represent
20+
ongoing agent progress in between chat messages. This allows frameworks to
21+
surface fine-grained activity updates chronologically, giving users immediate
22+
visibility into what an agent is doing without waiting for the next message or
23+
run boundary.
24+
25+
## Status
26+
27+
- **Status**: Draft
28+
- **Author(s)**: Markus Ecker ([email protected])
29+
30+
## Background
31+
32+
Users want real-time visibility into agent activities as they happen. Consider
33+
this example UI:
34+
35+
```
36+
+------------------------------------------------------------+
37+
| I will search the internet for relevant information | <- TextMessage
38+
+------------------------------------------------------------+
39+
+------------------------------------------------------------+
40+
| ✓ checking reddit | <- ActivityMessage
41+
| searching X.com... |
42+
+------------------------------------------------------------+
43+
```
44+
45+
### Use Cases
46+
47+
- **Workflows**: Step-by-step progress through workflow execution
48+
- **Planning**: Intermediate planning or tool use visibility
49+
- **Custom frameworks**: Signals representing ongoing work in any agent system
50+
51+
## Challenges
52+
53+
- **Flexibility**: Must handle arbitrary activity data from different frameworks
54+
- **Serializability**: Events must be replayable and rehydrated for session
55+
recovery
56+
- **Extensibility**: Developers should define custom renderers per activity
57+
type, with a generic fallback
58+
- **Chronology**: Activities must interleave naturally with chat and run events
59+
60+
## Detailed Specification
61+
62+
### Overview
63+
64+
This proposal introduces two new concepts to the AG-UI protocol:
65+
66+
1. **ActivityEvent**: A new event type in the event stream
67+
2. **ActivityMessage**: A new message type alongside TextMessage, ToolMessage,
68+
etc.
69+
70+
Frameworks may emit ActivityEvents, and frontends can render them inline with
71+
chat.
72+
73+
### New Event: ActivityEvent
74+
75+
```typescript
76+
type ActivityEvent = BaseEvent & {
77+
type: EventType.ACTIVITY
78+
/**
79+
* Unique identifier for the ActivityMessage this event belongs to.
80+
*/
81+
messageId: string
82+
/**
83+
* Activity type, e.g. "PLAN", "SEARCH", "SCRAPE"
84+
*/
85+
activityType: string
86+
/**
87+
* Snapshot of the full activity state (optional).
88+
*/
89+
snapshot?: Record<string, any>
90+
/**
91+
* Patch to apply to the prior snapshot (optional).
92+
* Follows JSON Patch semantics.
93+
*/
94+
patch?: Record<string, any>
95+
}
96+
```
97+
98+
#### Example Events
99+
100+
Initial activity snapshot:
101+
102+
```json
103+
{
104+
"id": "evt_001",
105+
"ts": 1714064100000,
106+
"type": "ACTIVITY",
107+
"messageId": "msg_789",
108+
"activityType": "PLAN",
109+
"snapshot": {
110+
"tasks": ["check reddit", "search X.com"]
111+
}
112+
}
113+
```
114+
115+
Incremental update via patch:
116+
117+
```json
118+
{
119+
"id": "evt_002",
120+
"ts": 1714064120000,
121+
"type": "ACTIVITY",
122+
"messageId": "msg_789",
123+
"activityType": "PLAN",
124+
"patch": {
125+
"op": "replace",
126+
"path": "/tasks/0",
127+
"value": "✓ check reddit"
128+
}
129+
}
130+
```
131+
132+
### New Message: ActivityMessage
133+
134+
```typescript
135+
type ActivityMessage = {
136+
id: string
137+
role: "activity"
138+
activityType: string
139+
/**
140+
* Finalized activity content as of compaction.
141+
*/
142+
content: Record<string, any>
143+
}
144+
```
145+
146+
### Rendering Strategy
147+
148+
- **Generic renderer**: Displays raw snapshot/patch as JSON or formatted text
149+
- **Custom renderer**: Developers can register a renderer per `activityType`:
150+
- `"PLAN"` → Interactive checklist component
151+
- `"SEARCH"` → Live status with progress indicators
152+
- `"WORKFLOW"` → Step-by-step workflow visualization
153+
154+
## Implementation Considerations
155+
156+
### Client SDK Changes
157+
158+
TypeScript SDK additions:
159+
160+
- New `ActivityEvent` type in `@ag-ui/core`
161+
- New `ActivityMessage` type in message unions
162+
- Activity renderer registry in `@ag-ui/client`
163+
164+
Python SDK additions:
165+
166+
- New `ActivityEvent` class in `ag_ui.core.events`
167+
- New `ActivityMessage` class in message types
168+
- Activity serialization/deserialization support
169+
170+
### Integration Impact
171+
172+
- **Planning Frameworks**: Can emit ActivityEvents during planning or tool
173+
execution phases
174+
- **Workflow Systems**: Can surface step-by-step workflow progress as
175+
ActivityEvents
176+
- **Other frameworks**: May emit ActivityEvents freely; AG-UI will serialize
177+
them like other events
178+
179+
## Examples and Use Cases
180+
181+
### Example 1: Web Search Activity
182+
183+
```typescript
184+
// Agent emits search activity
185+
agent.emitActivity({
186+
messageId: "msg_123",
187+
activityType: "SEARCH",
188+
snapshot: {
189+
sources: [
190+
{ name: "Reddit", status: "pending" },
191+
{ name: "X.com", status: "pending" },
192+
{ name: "Google", status: "pending" },
193+
],
194+
},
195+
})
196+
197+
// Update as search progresses
198+
agent.emitActivity({
199+
messageId: "msg_123",
200+
activityType: "SEARCH",
201+
patch: {
202+
op: "replace",
203+
path: "/sources/0/status",
204+
value: "complete",
205+
},
206+
})
207+
```
208+
209+
### Use Case: Multi-Step Workflow Visibility
210+
211+
A data analysis agent performing multiple steps:
212+
213+
1. Loading dataset → ActivityEvent shows progress bar
214+
2. Cleaning data → ActivityEvent shows rows processed
215+
3. Running analysis → ActivityEvent shows current computation
216+
4. Generating report → ActivityEvent shows sections completed
217+
218+
Each step appears inline with chat, giving users real-time feedback.
219+
220+
## Testing Strategy
221+
222+
- Unit tests for ActivityEvent serialization/deserialization
223+
- Integration tests with mock frameworks emitting ActivityEvents
224+
- E2E tests in AG-UI Dojo demonstrating activity rendering
225+
- Performance benchmarks for high-frequency activity updates
226+
227+
## References
228+
229+
- [JSON Patch RFC 6902](https://tools.ietf.org/html/rfc6902)
230+
- [AG-UI Events Documentation](/concepts/events)
231+
- [AG-UI Messages Documentation](/concepts/messages)

0 commit comments

Comments
 (0)