feat(agent): Split agents into maintainable chunks
This commit is contained in:
parent
09799a880b
commit
df1a8b6cd2
6 changed files with 678 additions and 586 deletions
41
src/lib/agents/agentState.ts
Normal file
41
src/lib/agents/agentState.ts
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
import { BaseMessage } from '@langchain/core/messages';
|
||||
import { Annotation, END } from '@langchain/langgraph';
|
||||
import { Document } from 'langchain/document';
|
||||
|
||||
/**
|
||||
* State interface for the agent supervisor workflow
|
||||
*/
|
||||
export const AgentState = Annotation.Root({
|
||||
messages: Annotation<BaseMessage[]>({
|
||||
reducer: (x, y) => x.concat(y),
|
||||
default: () => [],
|
||||
}),
|
||||
query: Annotation<string>({
|
||||
reducer: (x, y) => y ?? x,
|
||||
default: () => '',
|
||||
}),
|
||||
relevantDocuments: Annotation<Document[]>({
|
||||
reducer: (x, y) => x.concat(y),
|
||||
default: () => [],
|
||||
}),
|
||||
bannedUrls: Annotation<string[]>({
|
||||
reducer: (x, y) => x.concat(y),
|
||||
default: () => [],
|
||||
}),
|
||||
searchInstructionHistory: Annotation<string[]>({
|
||||
reducer: (x, y) => x.concat(y),
|
||||
default: () => [],
|
||||
}),
|
||||
searchInstructions: Annotation<string>({
|
||||
reducer: (x, y) => y ?? x,
|
||||
default: () => '',
|
||||
}),
|
||||
next: Annotation<string>({
|
||||
reducer: (x, y) => y ?? x ?? END,
|
||||
default: () => END,
|
||||
}),
|
||||
analysis: Annotation<string>({
|
||||
reducer: (x, y) => y ?? x,
|
||||
default: () => '',
|
||||
}),
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue