deepagents
Version:
Deep Agents - a library for building controllable AI agents with LangGraph
38 lines (37 loc) • 2.1 kB
TypeScript
/**
* State definitions for Deep Agents
*
* TypeScript equivalents of the Python state classes using LangGraph's Annotation.Root() pattern.
* Defines Todo interface and DeepAgentState using MessagesAnnotation as base with proper reducer functions.
*/
import "@langchain/langgraph/zod";
import type { Todo } from "./types.js";
import { z } from "zod";
/**
* File reducer function that merges file dictionaries
* Matches the Python file_reducer function behavior exactly
*/
export declare function fileReducer(left: Record<string, string> | null | undefined, right: Record<string, string> | null | undefined): Record<string, string>;
/**
* Todo reducer function that replaces the entire todo list
* This matches the Python behavior where todos are completely replaced
*/
export declare function todoReducer(left: Todo[] | null | undefined, right: Todo[] | null | undefined): Todo[];
/**
* DeepAgentState using LangGraph's Annotation.Root() pattern
* Extends MessagesAnnotation (equivalent to Python's AgentState) with todos and files channels
*/
export declare const DeepAgentState: z.ZodObject<{
messages: import("@langchain/langgraph/zod").ReducedZodChannel<z.ZodType<import("@langchain/core/messages").BaseMessage[], z.ZodTypeDef, import("@langchain/core/messages").BaseMessage[]>, import("@langchain/core/utils/types").InteropZodType<import("@langchain/langgraph").Messages>>;
} & {
todos: import("@langchain/langgraph/zod").ReducedZodChannel<z.ZodType<Todo[], z.ZodTypeDef, Todo[]>, import("@langchain/core/utils/types").InteropZodType<Todo[] | null | undefined>>;
files: import("@langchain/langgraph/zod").ReducedZodChannel<z.ZodType<Record<string, string>, z.ZodTypeDef, Record<string, string>>, import("@langchain/core/utils/types").InteropZodType<Record<string, string> | null | undefined>>;
}, "strip", z.ZodTypeAny, {
todos: Todo[];
files: Record<string, string>;
messages: import("@langchain/core/messages").BaseMessage[];
}, {
todos: Todo[];
files: Record<string, string>;
messages: import("@langchain/core/messages").BaseMessage[];
}>;