Skip to content

Commit 7eef085

Browse files
committed
Improved docs and added video
1 parent b0ce123 commit 7eef085

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

docs/guides/example-projects/vercel-ai-sdk-deep-research.mdx

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ import RealtimeLearnMore from "/snippets/realtime-learn-more.mdx";
1717

1818
This full-stack project is an intelligent deep research agent that autonomously conducts multi-layered web research, generating comprehensive reports which are then converted to PDF and uploaded to storage.
1919

20+
<video
21+
controls
22+
className="w-full aspect-video"
23+
src="https://github.com/user-attachments/assets/aa86d2b2-7aa7-4948-82ff-5e1e80cf8e37"
24+
></video>
25+
2026
**Tech stack:**
2127

2228
- **[Next.js](https://nextjs.org/)** for the web app
@@ -98,28 +104,28 @@ Level 0 (Initial Query): "AI safety in autonomous vehicles"
98104
5. **Recursive deepening**: Follow-up questions become new queries for the next depth level
99105
6. **Accumulation**: All learnings, sources, and queries are accumulated across recursion levels
100106

101-
### Trigger.dev Realtime progress updates
107+
### Using Trigger.dev Realtime to trigger and subscribe to the deep research task
102108

103-
As each task is completed, the metadata is set and the frontend is updated:
109+
We use the [`useRealtimeTaskTrigger`](/frontend/react-hooks/triggering#userealtimetasktrigger) React hook to trigger the `deep-research` task and subscribe to it's updates.
104110

105-
**Task metadata**:
111+
**Frontend (React Hook)**:
106112

107113
```typescript
108-
metadata.set("status", {
109-
progress: 25,
110-
label: `Searching the web for: "${query}"`,
114+
const triggerInstance = useRealtimeTaskTrigger<typeof deepResearchOrchestrator>("deep-research", {
115+
accessToken: triggerToken,
111116
});
117+
const { progress, label } = parseStatus(triggerInstance.run?.metadata);
112118
```
113119

114-
**Frontend (React hook)**:
120+
As the research progresses, the metadata is set within the tasks and the frontend is kept updated with every new status:
115121

116-
We use the [`useRealtimeTaskTrigger`](https://trigger.dev/docs/frontend/react-hooks/triggering#userealtimetasktrigger) hook to get the task metadata and update the frontend in real-time.
122+
**Task Metadata**:
117123

118124
```typescript
119-
const triggerInstance = useRealtimeTaskTrigger<typeof deepResearchOrchestrator>("deep-research", {
120-
accessToken: triggerToken,
125+
metadata.set("status", {
126+
progress: 25,
127+
label: `Searching the web for: "${query}"`,
121128
});
122-
const { progress, label } = parseStatus(triggerInstance.run?.metadata);
123129
```
124130

125131
## Relevant code

0 commit comments

Comments
 (0)