File size: 1,649 Bytes
b7a067b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""

Streaming event types yielded by Agent.stream().



Each event is a plain dict with at least a ``"type"`` key.

"""

# ── Text chunk ──────────────────────────────────────────────────────────
# {"type": "text",      "content": "partial assistant message"}
TEXT = "text"

# ── Reasoning (e.g. DeepSeek R1 chain-of-thought) ──────────────────────
# {"type": "reasoning", "content": "model thinking"}
REASONING = "reasoning"

# ── Tool was called by the model ────────────────────────────────────────
# {"type": "tool_call",   "name": "fetch_webpage", "arguments": '{"url":"..."}'}
TOOL_CALL = "tool_call"

# ── Tool execution output ───────────────────────────────────────────────
# {"type": "tool_output", "name": "fetch_webpage", "content": "<html>..."}
TOOL_OUTPUT = "tool_output"

# ── Final response (no more tool calls) ─────────────────────────────────
# {"type": "done",       "content": "full assistant message"}
DONE = "done"

# ── Fatal error ─────────────────────────────────────────────────────────
# {"type": "error",      "content": "API key invalid"}
ERROR = "error"