Skip to content

Commit 25d3f2a

Browse files
committed
fix: fix picking and reporting of state snapshots
1 parent e7067c3 commit 25d3f2a

File tree

1 file changed

+5
-4
lines changed
  • typescript-sdk/integrations/langgraph/src

1 file changed

+5
-4
lines changed

typescript-sdk/integrations/langgraph/src/agent.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ export class LangGraphAgent extends AbstractAgent {
200200
checkpointId: fork.checkpoint.checkpoint_id!,
201201
streamMode,
202202
}),
203-
state: timeTravelCheckpoint,
203+
state: timeTravelCheckpoint as ThreadState<State>,
204204
streamMode,
205205
};
206206
}
@@ -486,7 +486,7 @@ export class LangGraphAgent extends AbstractAgent {
486486
this.endStep()
487487
this.dispatchEvent({
488488
type: EventType.STATE_SNAPSHOT,
489-
snapshot: this.getStateSnapshot(state.values),
489+
snapshot: this.getStateSnapshot(state),
490490
});
491491
this.dispatchEvent({
492492
type: EventType.MESSAGES_SNAPSHOT,
@@ -707,7 +707,7 @@ export class LangGraphAgent extends AbstractAgent {
707707
this.activeRun!.manuallyEmittedState = event.data;
708708
this.dispatchEvent({
709709
type: EventType.STATE_SNAPSHOT,
710-
snapshot: this.getStateSnapshot(this.activeRun!.manuallyEmittedState!),
710+
snapshot: this.getStateSnapshot({ values: this.activeRun!.manuallyEmittedState! } as ThreadState<State>),
711711
rawEvent: event,
712712
});
713713
}
@@ -767,7 +767,8 @@ export class LangGraphAgent extends AbstractAgent {
767767
}
768768
}
769769

770-
getStateSnapshot(state: State) {
770+
getStateSnapshot(threadState: ThreadState<State>) {
771+
let state = threadState.values
771772
const schemaKeys = this.activeRun!.schemaKeys!;
772773
// Do not emit state keys that are not part of the output schema
773774
if (schemaKeys?.output) {

0 commit comments

Comments
 (0)