Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .changeset/separate-graph-runner.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
"ai-sdk-graph": minor
---

Separate Graph and CompiledGraph classes for better separation of concerns

**Breaking Change:** The `graph()` function no longer accepts options. Instead, use `graph().compile(options)` to get an executable graph.

Before:
```typescript
const g = graph<MyState>({ storage, onFinish, onStart })
.node('a', ...)
.edge('START', 'a')

const stream = g.execute('run-1', initialState)
```

After:
```typescript
const g = graph<MyState>()
.node('a', ...)
.edge('START', 'a')

const compiled = g.compile({ storage, onFinish, onStart })
const stream = compiled.execute('run-1', initialState)
```

This change provides:
- **Clear separation of concerns**: Graph definition is separate from execution configuration
- **Reusability**: Same graph definition can be compiled with different configurations
- **Better testability**: Test graph structure without execution, test execution with mock definitions
3 changes: 1 addition & 2 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading