Skip to content

Commit e48e403

Browse files
committed
fix: use class property for default schema keys
1 parent 2e378a5 commit e48e403

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export class LangGraphAgent extends AbstractAgent {
122122
activeRun?: RunMetadata;
123123
// @ts-expect-error no need to initialize subscriber right now
124124
subscriber: Subscriber<ProcessedEvents>;
125-
constantSchemaKeys: string[] = ["messages", "tools"];
125+
constantSchemaKeys: string[] = DEFAULT_SCHEMA_KEYS;
126126

127127
constructor(config: LangGraphAgentConfig) {
128128
super(config);
@@ -766,7 +766,7 @@ export class LangGraphAgent extends AbstractAgent {
766766
const schemaKeys = this.activeRun!.schemaKeys!;
767767
// Do not emit state keys that are not part of the output schema
768768
if (schemaKeys?.output) {
769-
state = filterObjectBySchemaKeys(state, [...DEFAULT_SCHEMA_KEYS, ...schemaKeys.output]);
769+
state = filterObjectBySchemaKeys(state, [...this.constantSchemaKeys, ...schemaKeys.output]);
770770
}
771771
// return state
772772
return state;
@@ -813,7 +813,7 @@ export class LangGraphAgent extends AbstractAgent {
813813
if (cfg.configurable) {
814814
filteredConfigurable = schemaKeys?.config
815815
? filterObjectBySchemaKeys(cfg?.configurable, [
816-
...DEFAULT_SCHEMA_KEYS,
816+
...this.constantSchemaKeys,
817817
...(schemaKeys?.config ?? []),
818818
])
819819
: cfg?.configurable;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Message as LangGraphMessage } from "@langchain/langgraph-sdk";
22
import { State, SchemaKeys, LangGraphReasoning } from "./types";
33
import { Message, ToolCall } from "@ag-ui/client";
44

5-
export const DEFAULT_SCHEMA_KEYS = ["tools"];
5+
export const DEFAULT_SCHEMA_KEYS = ["messages", "tools"];
66

77
export function filterObjectBySchemaKeys(obj: Record<string, any>, schemaKeys: string[]) {
88
return Object.fromEntries(Object.entries(obj).filter(([key]) => schemaKeys.includes(key)));

0 commit comments

Comments
 (0)