Skip to content

Commit 9a583fd

Browse files
committed
Merge branch 'main' of github.com:karthikscale3/workflow into karthik/improve-dashboard
2 parents e274059 + 4f09e12 commit 9a583fd

File tree

93 files changed

+1873
-250
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+1873
-250
lines changed

.changeset/bitter-ads-hear.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@workflow/world-vercel": patch
3+
---
4+
5+
Make queue() call backwardscompatible with zod v3 for codebases that pin zod

.changeset/eleven-roses-enter.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@workflow/ai": patch
3+
---
4+
5+
Make `DurableAgent#stream()` return a `messages` array

.changeset/pre.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"all-years-glow",
4343
"angry-owls-beg",
4444
"bigint-serialization",
45+
"bitter-ads-hear",
4546
"bitter-trees-rest",
4647
"breezy-schools-wonder",
4748
"bumpy-taxis-learn",
@@ -73,6 +74,7 @@
7374
"easy-donkeys-lie",
7475
"eight-clowns-own",
7576
"eight-clubs-refuse",
77+
"eleven-roses-enter",
7678
"evil-mammals-hear",
7779
"extract-path-helpers",
7880
"extract-queue-triggers",
@@ -139,10 +141,12 @@
139141
"real-moose-kick",
140142
"real-oranges-lick",
141143
"red-cities-poke",
144+
"red-ears-smoke",
142145
"rude-wings-brush",
143146
"serious-starfishes-accept",
144147
"shaggy-falcons-make",
145148
"shaggy-tigers-attack",
149+
"shiny-islands-move",
146150
"silly-pens-shine",
147151
"silver-boats-fold",
148152
"sixty-baboons-wonder",
@@ -182,6 +186,7 @@
182186
"twenty-gifts-win",
183187
"two-cooks-unite",
184188
"two-rabbits-burn",
189+
"two-snails-cross",
185190
"violet-mails-send",
186191
"violet-taxis-give",
187192
"warm-files-attack",

.changeset/red-ears-smoke.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@workflow/world-local": patch
3+
"@workflow/utils": patch
4+
---
5+
6+
Fix port detection and base URL resolution for dev servers

.changeset/shiny-islands-move.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@workflow/world-vercel": patch
3+
---
4+
5+
Log warning when detecting zod v3

.changeset/two-snails-cross.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@workflow/ai": patch
3+
---
4+
5+
Add `onStepFinish` callback to `DurableAgent#stream()`

.gitattributes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Ensure consistent line endings for test input/output files
2+
# Use LF for all test files to ensure cross-platform consistency
3+
packages/swc-plugin-workflow/transform/tests/**/*.js text eol=lf
4+
packages/swc-plugin-workflow/transform/tests/**/*.stderr text eol=lf

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ jobs:
188188
run: ./scripts/resolve-symlinks.sh workbench/${{ matrix.app.name }}
189189

190190
- name: Run E2E Tests
191-
run: cd workbench/${{ matrix.app.name }} && pnpm dev & echo "starting tests in 10 seconds" && sleep 10 && pnpm vitest run packages/core/e2e/dev.test.ts && pnpm run test:e2e
191+
run: cd workbench/${{ matrix.app.name }} && pnpm dev & echo "starting tests in 10 seconds" && sleep 10 && pnpm vitest run packages/core/e2e/dev.test.ts && sleep 10 && pnpm run test:e2e
192192
env:
193193
APP_NAME: ${{ matrix.app.name }}
194194
DEPLOYMENT_URL: "http://localhost:${{ matrix.app.name == 'sveltekit' && '5173' || '3000' }}"

docs/content/docs/api-reference/workflow-ai/durable-agent.mdx

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ export default DurableAgentStreamOptions;`}
8686
- Tools can be implemented as workflow steps (using `"use step"` for automatic retries), or as regular workflow-level logic
8787
- Tools can use core library features like `sleep()` and Hooks within their `execute` functions
8888
- The agent processes tool calls iteratively until completion
89+
- The `stream()` method returns `{ messages }` containing the full conversation history, including initial messages, assistant responses, and tool results
8990

9091
## Examples
9192

@@ -180,6 +181,58 @@ async function multiToolAgentWorkflow(userQuery: string) {
180181
}
181182
```
182183

184+
### Multi-turn Conversation
185+
186+
```typescript
187+
import { DurableAgent } from '@workflow/ai/agent';
188+
import { z } from 'zod';
189+
190+
async function searchProducts({ query }: { query: string }) {
191+
"use step";
192+
// Search product database
193+
return `Found 3 products matching "${query}"`;
194+
}
195+
196+
async function multiTurnAgentWorkflow() {
197+
'use workflow';
198+
199+
const agent = new DurableAgent({
200+
model: 'anthropic/claude-haiku-4.5',
201+
tools: {
202+
searchProducts: {
203+
description: 'Search for products',
204+
inputSchema: z.object({ query: z.string() }),
205+
execute: searchProducts,
206+
},
207+
},
208+
});
209+
210+
const writable = getWritable<UIMessageChunk>();
211+
212+
// First user message
213+
// - Result is streamed to the provided `writable` stream
214+
// - Message history is returned in `messages` for LLM context
215+
let { messages } = await agent.stream({
216+
messages: [
217+
{ role: 'user', content: 'Find me some laptops' }
218+
],
219+
writable,
220+
});
221+
222+
// Continue the conversation with the accumulated message history
223+
const result = await agent.stream({
224+
messages: [
225+
...messages,
226+
{ role: 'user', content: 'Which one has the best battery life?' }
227+
],
228+
writable,
229+
});
230+
231+
// result.messages now contains the complete conversation history
232+
return result.messages;
233+
}
234+
```
235+
183236
### Tools with Workflow Library Features
184237

185238
```typescript

packages/ai/CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# @workflow/ai
22

3+
## 4.0.1-beta.21
4+
5+
### Patch Changes
6+
7+
- aba5264: Add `onStepFinish` callback to `DurableAgent#stream()`
8+
9+
10+
## 4.0.1-beta.20
11+
12+
### Patch Changes
13+
14+
- 00e3345: Make `DurableAgent#stream()` return a `messages` array
15+
16+
317
## 4.0.1-beta.19
418

519
### Patch Changes

0 commit comments

Comments
 (0)