You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/oss/deepagents/context-engineering.mdx
+38Lines changed: 38 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -348,6 +348,44 @@ This dual approach ensures the agent maintains awareness of its goals and progre
348
348
- If any model call raises a standard @[ContextOverflowError], Deep Agents immediately falls back to summarization and retries with summary + recent preserved messages
349
349
- Older messages are summarized by the model
350
350
351
+
:::python
352
+
<Tip>
353
+
[Streaming tokens](/oss/deepagents/streaming#llm-tokens) from the agent will generally include tokens generated by the summarization step. You can filter out these tokens using their associated metadata:
354
+
```python
355
+
for chunk in agent.stream(
356
+
{"messages": [...]},
357
+
stream_mode="messages",
358
+
version="v2",
359
+
):
360
+
token, metadata = chunk["data"]
361
+
if metadata.get("lc_source") =="summarization": # [!code highlight]
362
+
continue
363
+
else:
364
+
...
365
+
```
366
+
</Tip>
367
+
:::
368
+
369
+
:::js
370
+
<Tip>
371
+
[Streaming tokens](/oss/deepagents/streaming#llm-tokens) from the agent will generally include tokens generated by the summarization step. You can filter out these tokens using their associated metadata:
0 commit comments