File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
typescript-sdk/integrations/langgraph/src Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -122,7 +122,7 @@ export class LangGraphAgent extends AbstractAgent {
122
122
activeRun ?: RunMetadata ;
123
123
// @ts -expect-error no need to initialize subscriber right now
124
124
subscriber : Subscriber < ProcessedEvents > ;
125
- constantSchemaKeys : string [ ] = [ "messages" , "tools" ] ;
125
+ constantSchemaKeys : string [ ] = DEFAULT_SCHEMA_KEYS ;
126
126
127
127
constructor ( config : LangGraphAgentConfig ) {
128
128
super ( config ) ;
@@ -766,7 +766,7 @@ export class LangGraphAgent extends AbstractAgent {
766
766
const schemaKeys = this . activeRun ! . schemaKeys ! ;
767
767
// Do not emit state keys that are not part of the output schema
768
768
if ( schemaKeys ?. output ) {
769
- state = filterObjectBySchemaKeys ( state , [ ...DEFAULT_SCHEMA_KEYS , ...schemaKeys . output ] ) ;
769
+ state = filterObjectBySchemaKeys ( state , [ ...this . constantSchemaKeys , ...schemaKeys . output ] ) ;
770
770
}
771
771
// return state
772
772
return state ;
@@ -813,7 +813,7 @@ export class LangGraphAgent extends AbstractAgent {
813
813
if ( cfg . configurable ) {
814
814
filteredConfigurable = schemaKeys ?. config
815
815
? filterObjectBySchemaKeys ( cfg ?. configurable , [
816
- ...DEFAULT_SCHEMA_KEYS ,
816
+ ...this . constantSchemaKeys ,
817
817
...( schemaKeys ?. config ?? [ ] ) ,
818
818
] )
819
819
: cfg ?. configurable ;
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { Message as LangGraphMessage } from "@langchain/langgraph-sdk";
2
2
import { State , SchemaKeys , LangGraphReasoning } from "./types" ;
3
3
import { Message , ToolCall } from "@ag-ui/client" ;
4
4
5
- export const DEFAULT_SCHEMA_KEYS = [ "tools" ] ;
5
+ export const DEFAULT_SCHEMA_KEYS = [ "messages" , " tools"] ;
6
6
7
7
export function filterObjectBySchemaKeys ( obj : Record < string , any > , schemaKeys : string [ ] ) {
8
8
return Object . fromEntries ( Object . entries ( obj ) . filter ( ( [ key ] ) => schemaKeys . includes ( key ) ) ) ;
You can’t perform that action at this time.
0 commit comments