deepagents
Version:
Deep Agents - a library for building controllable AI agents with LangGraph
143 lines (142 loc) • 4.2 kB
TypeScript
/**
* Tool functions for Deep Agents
*
* TypeScript versions of all tools using @langchain/core/tools tool() function.
* Uses getCurrentTaskInput() for state access and returns Command objects for state updates.
* Implements mock filesystem operations using state.files similar to Python version.
*/
import { ToolMessage } from "@langchain/core/messages";
import { Command } from "@langchain/langgraph";
import { z } from "zod";
/**
* Write todos tool - manages todo list with Command return
* Uses getCurrentTaskInput() instead of Python's InjectedState
*/
export declare const writeTodos: import("@langchain/core/tools").DynamicStructuredTool<z.ZodObject<{
todos: z.ZodArray<z.ZodObject<{
content: z.ZodString;
status: z.ZodEnum<["pending", "in_progress", "completed"]>;
}, "strip", z.ZodTypeAny, {
status: "pending" | "in_progress" | "completed";
content: string;
}, {
status: "pending" | "in_progress" | "completed";
content: string;
}>, "many">;
}, "strip", z.ZodTypeAny, {
todos: {
status: "pending" | "in_progress" | "completed";
content: string;
}[];
}, {
todos: {
status: "pending" | "in_progress" | "completed";
content: string;
}[];
}>, {
todos: {
status: "pending" | "in_progress" | "completed";
content: string;
}[];
}, {
todos: {
status: "pending" | "in_progress" | "completed";
content: string;
}[];
}, Command<unknown, {
todos: {
status: "pending" | "in_progress" | "completed";
content: string;
}[];
messages: ToolMessage[];
}, string>>;
/**
* List files tool - returns list of files from state.files
* Equivalent to Python's ls function
*/
export declare const ls: import("@langchain/core/tools").DynamicStructuredTool<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>, {}, {}, string[]>;
/**
* Read file tool - reads from mock filesystem in state.files
* Matches Python read_file function behavior exactly
*/
export declare const readFile: import("@langchain/core/tools").DynamicStructuredTool<z.ZodObject<{
file_path: z.ZodString;
offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
}, "strip", z.ZodTypeAny, {
file_path: string;
offset: number;
limit: number;
}, {
file_path: string;
offset?: number | undefined;
limit?: number | undefined;
}>, {
file_path: string;
offset?: number;
limit?: number;
}, {
file_path: string;
offset?: number | undefined;
limit?: number | undefined;
}, string>;
/**
* Write file tool - writes to mock filesystem with Command return
* Matches Python write_file function behavior exactly
*/
export declare const writeFile: import("@langchain/core/tools").DynamicStructuredTool<z.ZodObject<{
file_path: z.ZodString;
content: z.ZodString;
}, "strip", z.ZodTypeAny, {
content: string;
file_path: string;
}, {
content: string;
file_path: string;
}>, {
file_path: string;
content: string;
}, {
content: string;
file_path: string;
}, Command<unknown, {
files: {
[x: string]: string;
};
messages: ToolMessage[];
}, string>>;
/**
* Edit file tool - edits files in mock filesystem with Command return
* Matches Python edit_file function behavior exactly
*/
export declare const editFile: import("@langchain/core/tools").DynamicStructuredTool<z.ZodObject<{
file_path: z.ZodString;
old_string: z.ZodString;
new_string: z.ZodString;
replace_all: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
}, "strip", z.ZodTypeAny, {
file_path: string;
old_string: string;
new_string: string;
replace_all: boolean;
}, {
file_path: string;
old_string: string;
new_string: string;
replace_all?: boolean | undefined;
}>, {
file_path: string;
old_string: string;
new_string: string;
replace_all?: boolean;
}, {
file_path: string;
old_string: string;
new_string: string;
replace_all?: boolean | undefined;
}, string | Command<unknown, {
files: {
[x: string]: string;
};
messages: ToolMessage[];
}, string>>;