[GH-ISSUE #2] Create TypeScript Implementation of Deep Agents #231

Closed
opened 2026-06-05 17:20:52 -04:00 by yindo · 2 comments
Owner

Originally created by @Palashio on GitHub (Aug 4, 2025).
Original GitHub issue: https://github.com/langchain-ai/deepagentsjs/issues/2

we want to create a typescript implementation of deep agents that's implemented in python. we want to try and make everything 1:1 as possible, and define any of the types.

here are the files in python:

graph.py

from deepagents.sub_agent import _create_task_tool, SubAgent
from deepagents.model import get_default_model
from deepagents.tools import write_todos, write_file, read_file, ls, edit_file
from deepagents.state import DeepAgentState
from typing import Sequence, Union, Callable, Any, TypeVar, Type, Optional
from langchain_core.tools import BaseTool
from langchain_core.language_models import LanguageModelLike

from langgraph.prebuilt import create_react_agent

StateSchema = TypeVar("StateSchema", bound=DeepAgentState)
StateSchemaType = Type[StateSchema]

base_prompt = """You have access to a number of standard tools

write_todos

You have access to the write_todos tools to help you manage and plan tasks. Use these tools VERY frequently to ensure that you are tracking your tasks and giving the user visibility into your progress.
These tools are also EXTREMELY helpful for planning tasks, and for breaking down larger complex tasks into smaller steps. If you do not use this tool when planning, you may forget to do important tasks - and that is unacceptable.

It is critical that you mark todos as completed as soon as you are done with a task. Do not batch up multiple tasks before marking them as completed.

task

  • When doing web search, prefer to use the task tool in order to reduce context usage."""

def create_deep_agent(
tools: Sequence[Union[BaseTool, Callable, dict[str, Any]]],
instructions: str,
model: Optional[Union[str, LanguageModelLike]] = None,
subagents: list[SubAgent] = None,
state_schema: Optional[StateSchemaType] = None,
):
"""Create a deep agent.

This agent will by default have access to a tool to write todos (write_todos),
and then four file editing tools: write_file, ls, read_file, edit_file.

Args:
    tools: The additional tools the agent should have access to.
    instructions: The additional instructions the agent should have. Will go in
        the system prompt.
    model: The model to use.
    subagents: The subagents to use. Each subagent should be a dictionary with the
        following keys:
            - `name`
            - `description` (used by the main agent to decide whether to call the sub agent)
            - `prompt` (used as the system prompt in the subagent)
            - (optional) `tools`
    state_schema: The schema of the deep agent. Should subclass from DeepAgentState
"""
prompt = instructions + base_prompt
built_in_tools = [write_todos, write_file, read_file, ls, edit_file]
if model is None:
    model = get_default_model()
state_schema = state_schema or DeepAgentState
task_tool = _create_task_tool(
    list(tools) + built_in_tools,
    instructions,
    subagents or [],
    model,
    state_schema
)
all_tools = built_in_tools + list(tools) + [task_tool]
return create_react_agent(
    model,
    prompt=prompt,
    tools=all_tools,
    state_schema=state_schema,
)

model.py

from langchain_anthropic import ChatAnthropic

def get_default_model():
return ChatAnthropic(model_name="claude-sonnet-4-20250514", max_tokens=64000)

prompts.py
WRITE_TODOS_DESCRIPTION = """Use this tool to create and manage a structured task list for your current work session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.
It also helps the user understand the progress of the task and overall progress of their requests.

When to Use This Tool

Use this tool proactively in these scenarios:

  1. Complex multi-step tasks - When a task requires 3 or more distinct steps or actions
  2. Non-trivial and complex tasks - Tasks that require careful planning or multiple operations
  3. User explicitly requests todo list - When the user directly asks you to use the todo list
  4. User provides multiple tasks - When users provide a list of things to be done (numbered or comma-separated)
  5. After receiving new instructions - Immediately capture user requirements as todos
  6. When you start working on a task - Mark it as in_progress BEFORE beginning work. Ideally you should only have one todo as in_progress at a time
  7. After completing a task - Mark it as completed and add any new follow-up tasks discovered during implementation

When NOT to Use This Tool

Skip using this tool when:

  1. There is only a single, straightforward task
  2. The task is trivial and tracking it provides no organizational benefit
  3. The task can be completed in less than 3 trivial steps
  4. The task is purely conversational or informational

NOTE that you should not use this tool if there is only one trivial task to do. In this case you are better off just doing the task directly.

Examples of When to Use the Todo List

User: I want to add a dark mode toggle to the application settings. Make sure you run the tests and build when you're done! Assistant: I'll help add a dark mode toggle to your application settings. Let me create a todo list to track this implementation. *Creates todo list with the following items:* 1. Create dark mode toggle component in Settings page 2. Add dark mode state management (context/store) 3. Implement CSS-in-JS styles for dark theme 4. Update existing components to support theme switching 5. Run tests and build process, addressing any failures or errors that occur *Begins working on the first task* The assistant used the todo list because: 1. Adding dark mode is a multi-step feature requiring UI, state management, and styling changes 2. The user explicitly requested tests and build be run afterward 3. The assistant inferred that tests and build need to pass by adding "Ensure tests and build succeed" as the final task User: Help me plan a comprehensive marketing campaign for our new product launch, including social media, email marketing, and press releases. Assistant: I'll help you plan a comprehensive marketing campaign for your product launch. Let me create a todo list to organize all the components. *Creates todo list with the following items:* 1. Define target audience and key messaging 2. Create social media content calendar and posting schedule 3. Design email marketing sequence and automation flows 4. Draft press release and identify media contacts 5. Set up tracking and analytics for campaign performance 6. Create visual assets and brand materials 7. Coordinate launch timeline and deliverables *Begins working on the first task* The assistant used the todo list because: 1. Marketing campaign planning involves multiple distinct channels and activities 2. Each component requires careful coordination and planning 3. The systematic approach ensures all aspects of the launch are covered 4. Progress tracking helps maintain timeline and deliverables User: Help me rename the function getCwd to getCurrentWorkingDirectory across my project Assistant: Let me first search through your codebase to find all occurrences of 'getCwd'. *Uses search tools to locate all instances of getCwd in the codebase* Assistant: I've found 15 instances of 'getCwd' across 8 different files. Let me create a todo list to track these changes. *Creates todo list with specific items for each file that needs updating* The assistant used the todo list because: 1. First, the assistant searched to understand the scope of the task 2. Upon finding multiple occurrences across different files, it determined this was a complex task with multiple steps 3. The todo list helps ensure every instance is tracked and updated systematically 4. This approach prevents missing any occurrences and maintains consistency User: I need help organizing my home office: decluttering the desk, setting up a filing system, organizing digital files, and creating a daily workflow. Assistant: I'll help you organize your home office systematically. Let me create a todo list to track each area of organization. *Creates todo list with items like: 1) Sort and declutter desk items, 2) Set up physical filing system for documents, 3) Organize digital files and folders, 4) Create daily workflow and productivity systems, 5) Establish maintenance routines* Let's start with decluttering your desk space to create a clean foundation for the other organizational systems. The assistant used the todo list because: 1. The user provided multiple distinct organizational tasks 2. Each area requires different approaches and careful planning 3. Home organization benefits from systematic, step-by-step completion 4. Progress tracking ensures all areas are addressed thoroughly

Examples of When NOT to Use the Todo List

User: How do I print 'Hello World' in Python? Assistant: In Python, you can print "Hello World" with this simple code:

python
print("Hello World")

This will output the text "Hello World" to the console when executed.

The assistant did not use the todo list because this is a single, trivial task that can be completed in one step. There's no need to track multiple tasks or steps for such a straightforward request. User: What's the best way to water houseplants? Assistant: The best way to water houseplants depends on the specific plant type, but here are some general guidelines:
  • Check soil moisture by inserting your finger about 1-2 inches into the soil
  • Water thoroughly when the top inch feels dry, allowing water to drain from the bottom
  • Use room temperature water and water in the morning when possible
  • Avoid overwatering, which is more harmful than underwatering for most plants

Different plants have different needs, so it's important to research your specific varieties for optimal care.

The assistant did not use the todo list because this is an informational request with no actual tasks to complete. The user is simply asking for advice and explanation, not for the assistant to perform multiple steps or activities. User: Can you add a comment to the calculateTotal function to explain what it does? Assistant: Sure, let me add a comment to the calculateTotal function to explain what it does. * Uses the Edit tool to add a comment to the calculateTotal function * The assistant did not use the todo list because this is a single, straightforward task confined to one location. Adding a comment doesn't require tracking multiple steps or systematic organization. User: What time is it in Tokyo right now? Assistant: I'll check the current time in Tokyo for you.

Searches for current time in Tokyo

The current time in Tokyo, Japan is [current time]. Tokyo is in the Japan Standard Time (JST) zone, which is UTC+9.

The assistant did not use the todo list because this is a single information lookup with immediate results. There are no multiple steps to track or organize, making the todo list unnecessary for this straightforward request.

Task States and Management

  1. Task States: Use these states to track progress:

    • pending: Task not yet started
    • in_progress: Currently working on (limit to ONE task at a time)
    • completed: Task finished successfully
  2. Task Management:

    • Update task status in real-time as you work
    • Mark tasks complete IMMEDIATELY after finishing (don't batch completions)
    • Only have ONE task in_progress at any time
    • Complete current tasks before starting new ones
    • Remove tasks that are no longer relevant from the list entirely
  3. Task Completion Requirements:

    • ONLY mark a task as completed when you have FULLY accomplished it
    • If you encounter errors, blockers, or cannot finish, keep the task as in_progress
    • When blocked, create a new task describing what needs to be resolved
    • Never mark a task as completed if:
      • There are unresolved issues or errors
      • Work is partial or incomplete
      • You encountered blockers that prevent completion
      • You couldn't find necessary resources or dependencies
      • Quality standards haven't been met
  4. Task Breakdown:

    • Create specific, actionable items
    • Break complex tasks into smaller, manageable steps
    • Use clear, descriptive task names

When in doubt, use this tool. Being proactive with task management demonstrates attentiveness and ensures you complete all requirements successfully."""

TASK_DESCRIPTION_PREFIX = """Launch a new agent to handle complex, multi-step tasks autonomously.

Available agent types and the tools they have access to:

  • general-purpose: General-purpose agent for researching complex questions, searching for files and content, and executing multi-step tasks. When you are searching for a keyword or file and are not confident that you will find the right match in the first few tries use this agent to perform the search for you. (Tools: *)
    {other_agents}
    """

TASK_DESCRIPTION_SUFFIX = """When using the Task tool, you must specify a subagent_type parameter to select which agent type to use.

When to use the Agent tool:

  • When you are instructed to execute custom slash commands. Use the Agent tool with the slash command invocation as the entire prompt. The slash command can take arguments. For example: Task(description="Check the file", prompt="/check-file path/to/file.py")

When NOT to use the Agent tool:

  • If you want to read a specific file path, use the Read or Glob tool instead of the Agent tool, to find the match more quickly
  • If you are searching for a specific term or definition within a known location, use the Glob tool instead, to find the match more quickly
  • If you are searching for content within a specific file or set of 2-3 files, use the Read tool instead of the Agent tool, to find the match more quickly
  • Other tasks that are not related to the agent descriptions above

Usage notes:

  1. Launch multiple agents concurrently whenever possible, to maximize performance; to do that, use a single message with multiple tool uses
  2. When the agent is done, it will return a single message back to you. The result returned by the agent is not visible to the user. To show the user the result, you should send a text message back to the user with a concise summary of the result.
  3. Each agent invocation is stateless. You will not be able to send additional messages to the agent, nor will the agent be able to communicate with you outside of its final report. Therefore, your prompt should contain a highly detailed task description for the agent to perform autonomously and you should specify exactly what information the agent should return back to you in its final and only message to you.
  4. The agent's outputs should generally be trusted
  5. Clearly tell the agent whether you expect it to create content, perform analysis, or just do research (search, file reads, web fetches, etc.), since it is not aware of the user's intent
  6. If the agent description mentions that it should be used proactively, then you should try your best to use it without the user having to ask for it first. Use your judgement.

Example usage:

<example_agent_descriptions>
"content-reviewer": use this agent after you are done creating significant content or documents
"greeting-responder": use this agent when to respond to user greetings with a friendly joke
"research-analyst": use this agent to conduct thorough research on complex topics
</example_agent_description>

user: "Please write a function that checks if a number is prime" assistant: Sure let me write a function that checks if a number is prime assistant: First let me use the Write tool to write a function that checks if a number is prime assistant: I'm going to use the Write tool to write the following code: function isPrime(n) { if (n <= 1) return false for (let i = 2; i * i <= n; i++) { if (n % i === 0) return false } return true } Since significant content was created and the task was completed, now use the content-reviewer agent to review the work assistant: Now let me use the content-reviewer agent to review the code assistant: Uses the Task tool to launch with the content-reviewer agent user: "Can you help me research the environmental impact of different renewable energy sources and create a comprehensive report?" This is a complex research task that would benefit from using the research-analyst agent to conduct thorough analysis assistant: I'll help you research the environmental impact of renewable energy sources. Let me use the research-analyst agent to conduct comprehensive research on this topic. assistant: Uses the Task tool to launch with the research-analyst agent, providing detailed instructions about what research to conduct and what format the report should take user: "Hello" Since the user is greeting, use the greeting-responder agent to respond with a friendly joke assistant: "I'm going to use the Task tool to launch with the greeting-responder agent" """ EDIT_DESCRIPTION = """Performs exact string replacements in files.

Usage:

  • You must use your Read tool at least once in the conversation before editing. This tool will error if you attempt an edit without reading the file.
  • When editing text from Read tool output, ensure you preserve the exact indentation (tabs/spaces) as it appears AFTER the line number prefix. The line number prefix format is: spaces + line number + tab. Everything after that tab is the actual file content to match. Never include any part of the line number prefix in the old_string or new_string.
  • ALWAYS prefer editing existing files. NEVER write new files unless explicitly required.
  • Only use emojis if the user explicitly requests it. Avoid adding emojis to files unless asked.
  • The edit will FAIL if old_string is not unique in the file. Either provide a larger string with more surrounding context to make it unique or use replace_all to change every instance of old_string.
  • Use replace_all for replacing and renaming strings across the file. This parameter is useful if you want to rename a variable for instance."""
    TOOL_DESCRIPTION = """Reads a file from the local filesystem. You can access any file directly by using this tool.
    Assume this tool is able to read all files on the machine. If the User provides a path to a file assume that path is valid. It is okay to read a file that does not exist; an error will be returned.

Usage:

  • The file_path parameter must be an absolute path, not a relative path
  • By default, it reads up to 2000 lines starting from the beginning of the file
  • You can optionally specify a line offset and limit (especially handy for long files), but it's recommended to read the whole file by not providing these parameters
  • Any lines longer than 2000 characters will be truncated
  • Results are returned using cat -n format, with line numbers starting at 1
  • You have the capability to call multiple tools in a single response. It is always better to speculatively read multiple files as a batch that are potentially useful.
  • If you read a file that exists but has empty contents you will receive a system reminder warning in place of file contents."""

state.py
from langgraph.prebuilt.chat_agent_executor import AgentState
from typing import NotRequired, Annotated
from typing import Literal
from typing_extensions import TypedDict

class Todo(TypedDict):
"""Todo to track."""

content: str
status: Literal["pending", "in_progress", "completed"]

def file_reducer(l, r):
if l is None:
return r
elif r is None:
return l
else:
return {**l, **r}

class DeepAgentState(AgentState):
todos: NotRequired[list[Todo]]
files: Annotated[NotRequired[dict[str, str]], file_reducer]

sub_agent.py

from deepagents.prompts import TASK_DESCRIPTION_PREFIX, TASK_DESCRIPTION_SUFFIX
from deepagents.state import DeepAgentState
from langgraph.prebuilt import create_react_agent
from langchain_core.tools import BaseTool
from typing import TypedDict
from langchain_core.tools import tool, InjectedToolCallId
from langchain_core.messages import ToolMessage
from typing import Annotated, NotRequired
from langgraph.types import Command

from langgraph.prebuilt import InjectedState

class SubAgent(TypedDict):
name: str
description: str
prompt: str
tools: NotRequired[list[str]]

def create_task_tool(tools, instructions, subagents: list[SubAgent], model, state_schema):
agents = {
"general-purpose": create_react_agent(model, prompt=instructions, tools=tools)
}
tools_by_name = {}
for tool
in tools:
if not isinstance(tool_, BaseTool):
tool_ = tool(tool_)
tools_by_name[tool_.name] = tool_
for _agent in subagents:
if "tools" in _agent:
_tools = [tools_by_name[t] for t in _agent["tools"]]
else:
_tools = tools
agents[_agent["name"]] = create_react_agent(
model, prompt=_agent["prompt"], tools=_tools, state_schema=state_schema
)

other_agents_string = [
    f"- {_agent['name']}: {_agent['description']}" for _agent in subagents
]

@tool(
    description=TASK_DESCRIPTION_PREFIX.format(other_agents=other_agents_string)
    + TASK_DESCRIPTION_SUFFIX
)
def task(
    description: str,
    subagent_type: str,
    state: Annotated[DeepAgentState, InjectedState],
    tool_call_id: Annotated[str, InjectedToolCallId],
):
    if subagent_type not in agents:
        return f"Error: invoked agent of type {subagent_type}, the only allowed types are {[f'`{k}`' for k in agents]}"
    sub_agent = agents[subagent_type]
    state["messages"] = [{"role": "user", "content": description}]
    result = sub_agent.invoke(state)
    return Command(
        update={
            "files": result.get("files", {}),
            "messages": [
                ToolMessage(
                    result["messages"][-1].content, tool_call_id=tool_call_id
                )
            ],
        }
    )

return task

tools.py

from langchain_core.tools import tool, InjectedToolCallId
from langgraph.types import Command
from langchain_core.messages import ToolMessage
from typing import Annotated
from langgraph.prebuilt import InjectedState

from deepagents.prompts import (
WRITE_TODOS_DESCRIPTION,
EDIT_DESCRIPTION,
TOOL_DESCRIPTION,
)
from deepagents.state import Todo, DeepAgentState

@tool(description=WRITE_TODOS_DESCRIPTION)
def write_todos(
todos: list[Todo], tool_call_id: Annotated[str, InjectedToolCallId]
) -> Command:
return Command(
update={
"todos": todos,
"messages": [
ToolMessage(f"Updated todo list to {todos}", tool_call_id=tool_call_id)
],
}
)

def ls(state: Annotated[DeepAgentState, InjectedState]) -> list[str]:
"""List all files"""
return list(state.get("files", {}).keys())

@tool(description=TOOL_DESCRIPTION)
def read_file(
file_path: str,
state: Annotated[DeepAgentState, InjectedState],
offset: int = 0,
limit: int = 2000,
) -> str:
"""Read file."""
mock_filesystem = state.get("files", {})
if file_path not in mock_filesystem:
return f"Error: File '{file_path}' not found"

# Get file content
content = mock_filesystem[file_path]

# Handle empty file
if not content or content.strip() == "":
    return "System reminder: File exists but has empty contents"

# Split content into lines
lines = content.splitlines()

# Apply line offset and limit
start_idx = offset
end_idx = min(start_idx + limit, len(lines))

# Handle case where offset is beyond file length
if start_idx >= len(lines):
    return f"Error: Line offset {offset} exceeds file length ({len(lines)} lines)"

# Format output with line numbers (cat -n format)
result_lines = []
for i in range(start_idx, end_idx):
    line_content = lines[i]

    # Truncate lines longer than 2000 characters
    if len(line_content) > 2000:
        line_content = line_content[:2000]

    # Line numbers start at 1, so add 1 to the index
    line_number = i + 1
    result_lines.append(f"{line_number:6d}\t{line_content}")

return "\n".join(result_lines)

def write_file(
file_path: str,
content: str,
state: Annotated[DeepAgentState, InjectedState],
tool_call_id: Annotated[str, InjectedToolCallId],
) -> Command:
"""Write to a file."""
files = state.get("files", {})
files[file_path] = content
return Command(
update={
"files": files,
"messages": [
ToolMessage(f"Updated file {file_path}", tool_call_id=tool_call_id)
],
}
)

@tool(description=EDIT_DESCRIPTION)
def edit_file(
file_path: str,
old_string: str,
new_string: str,
state: Annotated[DeepAgentState, InjectedState],
tool_call_id: Annotated[str, InjectedToolCallId],
replace_all: bool = False,
) -> str:
"""Write to a file."""
mock_filesystem = state.get("files", {})
# Check if file exists in mock filesystem
if file_path not in mock_filesystem:
return f"Error: File '{file_path}' not found"

# Get current file content
content = mock_filesystem[file_path]

# Check if old_string exists in the file
if old_string not in content:
    return f"Error: String not found in file: '{old_string}'"

# If not replace_all, check for uniqueness
if not replace_all:
    occurrences = content.count(old_string)
    if occurrences > 1:
        return f"Error: String '{old_string}' appears {occurrences} times in file. Use replace_all=True to replace all instances, or provide a more specific string with surrounding context."
    elif occurrences == 0:
        return f"Error: String not found in file: '{old_string}'"

# Perform the replacement
if replace_all:
    new_content = content.replace(old_string, new_string)
    replacement_count = content.count(old_string)
    result_msg = f"Successfully replaced {replacement_count} instance(s) of the string in '{file_path}'"
else:
    new_content = content.replace(
        old_string, new_string, 1
    )  # Replace only first occurrence
    result_msg = f"Successfully replaced string in '{file_path}'"

# Update the mock filesystem
mock_filesystem[file_path] = new_content
return Command(
    update={
        "files": mock_filesystem,
        "messages": [
            ToolMessage(f"Updated file {file_path}", tool_call_id=tool_call_id)
        ],
    }
)</open-swe-issue-content>
Agent Context { "tasks": [ { "id": "2737cf65-74d6-498d-99d6-14baedb6afa8", "taskIndex": 0, "request": "[original issue]\n**Create TypeScript Implementation of Deep Agents**\nwe want to create a typescript implementation of deep agents that's implemented in python. we want to try and make everything 1:1 as possible, and define any of the types. \n\nhere are the files in python:\n\ngraph.py\n\nfrom deepagents.sub_agent import _create_task_tool, SubAgent\nfrom deepagents.model import get_default_model\nfrom deepagents.tools import write_todos, write_file, read_file, ls, edit_file\nfrom deepagents.state import DeepAgentState\nfrom typing import Sequence, Union, Callable, Any, TypeVar, Type, Optional\nfrom langchain_core.tools import BaseTool\nfrom langchain_core.language_models import LanguageModelLike\n\nfrom langgraph.prebuilt import create_react_agent\n\nStateSchema = TypeVar(\"StateSchema\", bound=DeepAgentState)\nStateSchemaType = Type[StateSchema]\n\nbase_prompt = \"\"\"You have access to a number of standard tools\n\n## `write_todos`\n\nYou have access to the `write_todos` tools to help you manage and plan tasks. Use these tools VERY frequently to ensure that you are tracking your tasks and giving the user visibility into your progress.\nThese tools are also EXTREMELY helpful for planning tasks, and for breaking down larger complex tasks into smaller steps. If you do not use this tool when planning, you may forget to do important tasks - and that is unacceptable.\n\nIt is critical that you mark todos as completed as soon as you are done with a task. Do not batch up multiple tasks before marking them as completed.\n## `task`\n\n- When doing web search, prefer to use the `task` tool in order to reduce context usage.\"\"\"\n\n\ndef create_deep_agent(\n tools: Sequence[Union[BaseTool, Callable, dict[str, Any]]],\n instructions: str,\n model: Optional[Union[str, LanguageModelLike]] = None,\n subagents: list[SubAgent] = None,\n state_schema: Optional[StateSchemaType] = None,\n):\n \"\"\"Create a deep agent.\n\n This agent will by default have access to a tool to write todos (write_todos),\n and then four file editing tools: write_file, ls, read_file, edit_file.\n\n Args:\n tools: The additional tools the agent should have access to.\n instructions: The additional instructions the agent should have. Will go in\n the system prompt.\n model: The model to use.\n subagents: The subagents to use. Each subagent should be a dictionary with the\n following keys:\n - `name`\n - `description` (used by the main agent to decide whether to call the sub agent)\n - `prompt` (used as the system prompt in the subagent)\n - (optional) `tools`\n state_schema: The schema of the deep agent. Should subclass from DeepAgentState\n \"\"\"\n prompt = instructions + base_prompt\n built_in_tools = [write_todos, write_file, read_file, ls, edit_file]\n if model is None:\n model = get_default_model()\n state_schema = state_schema or DeepAgentState\n task_tool = _create_task_tool(\n list(tools) + built_in_tools,\n instructions,\n subagents or [],\n model,\n state_schema\n )\n all_tools = built_in_tools + list(tools) + [task_tool]\n return create_react_agent(\n model,\n prompt=prompt,\n tools=all_tools,\n state_schema=state_schema,\n )\n\nmodel.py\n\nfrom langchain_anthropic import ChatAnthropic\n\n\ndef get_default_model():\n return ChatAnthropic(model_name=\"claude-sonnet-4-20250514\", max_tokens=64000)\n\nprompts.py\nWRITE_TODOS_DESCRIPTION = \"\"\"Use this tool to create and manage a structured task list for your current work session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.\nIt also helps the user understand the progress of the task and overall progress of their requests.\n\n## When to Use This Tool\nUse this tool proactively in these scenarios:\n\n1. Complex multi-step tasks - When a task requires 3 or more distinct steps or actions\n2. Non-trivial and complex tasks - Tasks that require careful planning or multiple operations\n3. User explicitly requests todo list - When the user directly asks you to use the todo list\n4. User provides multiple tasks - When users provide a list of things to be done (numbered or comma-separated)\n5. After receiving new instructions - Immediately capture user requirements as todos\n6. When you start working on a task - Mark it as in_progress BEFORE beginning work. Ideally you should only have one todo as in_progress at a time\n7. After completing a task - Mark it as completed and add any new follow-up tasks discovered during implementation\n\n## When NOT to Use This Tool\n\nSkip using this tool when:\n1. There is only a single, straightforward task\n2. The task is trivial and tracking it provides no organizational benefit\n3. The task can be completed in less than 3 trivial steps\n4. The task is purely conversational or informational\n\nNOTE that you should not use this tool if there is only one trivial task to do. In this case you are better off just doing the task directly.\n\n## Examples of When to Use the Todo List\n\n\nUser: I want to add a dark mode toggle to the application settings. Make sure you run the tests and build when you're done!\nAssistant: I'll help add a dark mode toggle to your application settings. Let me create a todo list to track this implementation.\n*Creates todo list with the following items:*\n1. Create dark mode toggle component in Settings page\n2. Add dark mode state management (context/store)\n3. Implement CSS-in-JS styles for dark theme\n4. Update existing components to support theme switching\n5. Run tests and build process, addressing any failures or errors that occur\n*Begins working on the first task*\n\n\nThe assistant used the todo list because:\n1. Adding dark mode is a multi-step feature requiring UI, state management, and styling changes\n2. The user explicitly requested tests and build be run afterward\n3. The assistant inferred that tests and build need to pass by adding \"Ensure tests and build succeed\" as the final task\n\n\n\n\nUser: Help me plan a comprehensive marketing campaign for our new product launch, including social media, email marketing, and press releases.\nAssistant: I'll help you plan a comprehensive marketing campaign for your product launch. Let me create a todo list to organize all the components.\n*Creates todo list with the following items:*\n1. Define target audience and key messaging\n2. Create social media content calendar and posting schedule\n3. Design email marketing sequence and automation flows\n4. Draft press release and identify media contacts\n5. Set up tracking and analytics for campaign performance\n6. Create visual assets and brand materials\n7. Coordinate launch timeline and deliverables\n*Begins working on the first task*\n\n\nThe assistant used the todo list because:\n1. Marketing campaign planning involves multiple distinct channels and activities\n2. Each component requires careful coordination and planning\n3. The systematic approach ensures all aspects of the launch are covered\n4. Progress tracking helps maintain timeline and deliverables\n\n\n\n\nUser: Help me rename the function getCwd to getCurrentWorkingDirectory across my project\nAssistant: Let me first search through your codebase to find all occurrences of 'getCwd'.\n*Uses search tools to locate all instances of getCwd in the codebase*\nAssistant: I've found 15 instances of 'getCwd' across 8 different files. Let me create a todo list to track these changes.\n*Creates todo list with specific items for each file that needs updating*\n\n\nThe assistant used the todo list because:\n1. First, the assistant searched to understand the scope of the task\n2. Upon finding multiple occurrences across different files, it determined this was a complex task with multiple steps\n3. The todo list helps ensure every instance is tracked and updated systematically\n4. This approach prevents missing any occurrences and maintains consistency\n\n\n\n\nUser: I need help organizing my home office: decluttering the desk, setting up a filing system, organizing digital files, and creating a daily workflow.\nAssistant: I'll help you organize your home office systematically. Let me create a todo list to track each area of organization.\n*Creates todo list with items like: 1) Sort and declutter desk items, 2) Set up physical filing system for documents, 3) Organize digital files and folders, 4) Create daily workflow and productivity systems, 5) Establish maintenance routines*\nLet's start with decluttering your desk space to create a clean foundation for the other organizational systems.\n\n\nThe assistant used the todo list because:\n1. The user provided multiple distinct organizational tasks\n2. Each area requires different approaches and careful planning\n3. Home organization benefits from systematic, step-by-step completion\n4. Progress tracking ensures all areas are addressed thoroughly\n\n\n\n## Examples of When NOT to Use the Todo List\n\n\nUser: How do I print 'Hello World' in Python?\nAssistant: In Python, you can print \"Hello World\" with this simple code:\n\npython\nprint(\"Hello World\")\n\nThis will output the text \"Hello World\" to the console when executed.\n\n\nThe assistant did not use the todo list because this is a single, trivial task that can be completed in one step. There's no need to track multiple tasks or steps for such a straightforward request.\n\n\n\n\nUser: What's the best way to water houseplants?\nAssistant: The best way to water houseplants depends on the specific plant type, but here are some general guidelines:\n\n- Check soil moisture by inserting your finger about 1-2 inches into the soil\n- Water thoroughly when the top inch feels dry, allowing water to drain from the bottom\n- Use room temperature water and water in the morning when possible\n- Avoid overwatering, which is more harmful than underwatering for most plants\n\nDifferent plants have different needs, so it's important to research your specific varieties for optimal care.\n\n\nThe assistant did not use the todo list because this is an informational request with no actual tasks to complete. The user is simply asking for advice and explanation, not for the assistant to perform multiple steps or activities.\n\n\n\n\nUser: Can you add a comment to the calculateTotal function to explain what it does?\nAssistant: Sure, let me add a comment to the calculateTotal function to explain what it does.\n* Uses the Edit tool to add a comment to the calculateTotal function *\n\n\nThe assistant did not use the todo list because this is a single, straightforward task confined to one location. Adding a comment doesn't require tracking multiple steps or systematic organization.\n\n\n\n\nUser: What time is it in Tokyo right now?\nAssistant: I'll check the current time in Tokyo for you.\n\n*Searches for current time in Tokyo*\n\nThe current time in Tokyo, Japan is [current time]. Tokyo is in the Japan Standard Time (JST) zone, which is UTC+9.\n\n\nThe assistant did not use the todo list because this is a single information lookup with immediate results. There are no multiple steps to track or organize, making the todo list unnecessary for this straightforward request.\n\n\n\n## Task States and Management\n\n1. **Task States**: Use these states to track progress:\n - pending: Task not yet started\n - in_progress: Currently working on (limit to ONE task at a time)\n - completed: Task finished successfully\n\n2. **Task Management**:\n - Update task status in real-time as you work\n - Mark tasks complete IMMEDIATELY after finishing (don't batch completions)\n - Only have ONE task in_progress at any time\n - Complete current tasks before starting new ones\n - Remove tasks that are no longer relevant from the list entirely\n\n3. **Task Completion Requirements**:\n - ONLY mark a task as completed when you have FULLY accomplished it\n - If you encounter errors, blockers, or cannot finish, keep the task as in_progress\n - When blocked, create a new task describing what needs to be resolved\n - Never mark a task as completed if:\n - There are unresolved issues or errors\n - Work is partial or incomplete\n - You encountered blockers that prevent completion\n - You couldn't find necessary resources or dependencies\n - Quality standards haven't been met\n\n4. **Task Breakdown**:\n - Create specific, actionable items\n - Break complex tasks into smaller, manageable steps\n - Use clear, descriptive task names\n\nWhen in doubt, use this tool. Being proactive with task management demonstrates attentiveness and ensures you complete all requirements successfully.\"\"\"\n\nTASK_DESCRIPTION_PREFIX = \"\"\"Launch a new agent to handle complex, multi-step tasks autonomously. \n\nAvailable agent types and the tools they have access to:\n- general-purpose: General-purpose agent for researching complex questions, searching for files and content, and executing multi-step tasks. When you are searching for a keyword or file and are not confident that you will find the right match in the first few tries use this agent to perform the search for you. (Tools: *)\n{other_agents}\n\"\"\"\n\nTASK_DESCRIPTION_SUFFIX = \"\"\"When using the Task tool, you must specify a subagent_type parameter to select which agent type to use.\n\nWhen to use the Agent tool:\n- When you are instructed to execute custom slash commands. Use the Agent tool with the slash command invocation as the entire prompt. The slash command can take arguments. For example: Task(description=\"Check the file\", prompt=\"/check-file path/to/file.py\")\n\nWhen NOT to use the Agent tool:\n- If you want to read a specific file path, use the Read or Glob tool instead of the Agent tool, to find the match more quickly\n- If you are searching for a specific term or definition within a known location, use the Glob tool instead, to find the match more quickly\n- If you are searching for content within a specific file or set of 2-3 files, use the Read tool instead of the Agent tool, to find the match more quickly\n- Other tasks that are not related to the agent descriptions above\n\n\nUsage notes:\n1. Launch multiple agents concurrently whenever possible, to maximize performance; to do that, use a single message with multiple tool uses\n2. When the agent is done, it will return a single message back to you. The result returned by the agent is not visible to the user. To show the user the result, you should send a text message back to the user with a concise summary of the result.\n3. Each agent invocation is stateless. You will not be able to send additional messages to the agent, nor will the agent be able to communicate with you outside of its final report. Therefore, your prompt should contain a highly detailed task description for the agent to perform autonomously and you should specify exactly what information the agent should return back to you in its final and only message to you.\n4. The agent's outputs should generally be trusted\n5. Clearly tell the agent whether you expect it to create content, perform analysis, or just do research (search, file reads, web fetches, etc.), since it is not aware of the user's intent\n6. If the agent description mentions that it should be used proactively, then you should try your best to use it without the user having to ask for it first. Use your judgement.\n\nExample usage:\n\n\n\"content-reviewer\": use this agent after you are done creating significant content or documents\n\"greeting-responder\": use this agent when to respond to user greetings with a friendly joke\n\"research-analyst\": use this agent to conduct thorough research on complex topics\n\n\n\nuser: \"Please write a function that checks if a number is prime\"\nassistant: Sure let me write a function that checks if a number is prime\nassistant: First let me use the Write tool to write a function that checks if a number is prime\nassistant: I'm going to use the Write tool to write the following code:\n\nfunction isPrime(n) {\n if (n <= 1) return false\n for (let i = 2; i * i <= n; i++) {\n if (n % i === 0) return false\n }\n return true\n}\n\n\nSince significant content was created and the task was completed, now use the content-reviewer agent to review the work\n\nassistant: Now let me use the content-reviewer agent to review the code\nassistant: Uses the Task tool to launch with the content-reviewer agent \n\n\n\nuser: \"Can you help me research the environmental impact of different renewable energy sources and create a comprehensive report?\"\n\nThis is a complex research task that would benefit from using the research-analyst agent to conduct thorough analysis\n\nassistant: I'll help you research the environmental impact of renewable energy sources. Let me use the research-analyst agent to conduct comprehensive research on this topic.\nassistant: Uses the Task tool to launch with the research-analyst agent, providing detailed instructions about what research to conduct and what format the report should take\n\n\n\nuser: \"Hello\"\n\nSince the user is greeting, use the greeting-responder agent to respond with a friendly joke\n\nassistant: \"I'm going to use the Task tool to launch with the greeting-responder agent\"\n\"\"\"\nEDIT_DESCRIPTION = \"\"\"Performs exact string replacements in files. \n\nUsage:\n- You must use your `Read` tool at least once in the conversation before editing. This tool will error if you attempt an edit without reading the file. \n- When editing text from Read tool output, ensure you preserve the exact indentation (tabs/spaces) as it appears AFTER the line number prefix. The line number prefix format is: spaces + line number + tab. Everything after that tab is the actual file content to match. Never include any part of the line number prefix in the old_string or new_string.\n- ALWAYS prefer editing existing files. NEVER write new files unless explicitly required.\n- Only use emojis if the user explicitly requests it. Avoid adding emojis to files unless asked.\n- The edit will FAIL if `old_string` is not unique in the file. Either provide a larger string with more surrounding context to make it unique or use `replace_all` to change every instance of `old_string`. \n- Use `replace_all` for replacing and renaming strings across the file. This parameter is useful if you want to rename a variable for instance.\"\"\"\nTOOL_DESCRIPTION = \"\"\"Reads a file from the local filesystem. You can access any file directly by using this tool.\nAssume this tool is able to read all files on the machine. If the User provides a path to a file assume that path is valid. It is okay to read a file that does not exist; an error will be returned.\n\nUsage:\n- The file_path parameter must be an absolute path, not a relative path\n- By default, it reads up to 2000 lines starting from the beginning of the file\n- You can optionally specify a line offset and limit (especially handy for long files), but it's recommended to read the whole file by not providing these parameters\n- Any lines longer than 2000 characters will be truncated\n- Results are returned using cat -n format, with line numbers starting at 1\n- You have the capability to call multiple tools in a single response. It is always better to speculatively read multiple files as a batch that are potentially useful. \n- If you read a file that exists but has empty contents you will receive a system reminder warning in place of file contents.\"\"\"\n\nstate.py\nfrom langgraph.prebuilt.chat_agent_executor import AgentState\nfrom typing import NotRequired, Annotated\nfrom typing import Literal\nfrom typing_extensions import TypedDict\n\n\nclass Todo(TypedDict):\n \"\"\"Todo to track.\"\"\"\n\n content: str\n status: Literal[\"pending\", \"in_progress\", \"completed\"]\n\n\ndef file_reducer(l, r):\n if l is None:\n return r\n elif r is None:\n return l\n else:\n return {**l, **r}\n\n\nclass DeepAgentState(AgentState):\n todos: NotRequired[list[Todo]]\n files: Annotated[NotRequired[dict[str, str]], file_reducer]\n\nsub_agent.py\n\nfrom deepagents.prompts import TASK_DESCRIPTION_PREFIX, TASK_DESCRIPTION_SUFFIX\nfrom deepagents.state import DeepAgentState\nfrom langgraph.prebuilt import create_react_agent\nfrom langchain_core.tools import BaseTool\nfrom typing import TypedDict\nfrom langchain_core.tools import tool, InjectedToolCallId\nfrom langchain_core.messages import ToolMessage\nfrom typing import Annotated, NotRequired\nfrom langgraph.types import Command\n\nfrom langgraph.prebuilt import InjectedState\n\n\nclass SubAgent(TypedDict):\n name: str\n description: str\n prompt: str\n tools: NotRequired[list[str]]\n\n\ndef _create_task_tool(tools, instructions, subagents: list[SubAgent], model, state_schema):\n agents = {\n \"general-purpose\": create_react_agent(model, prompt=instructions, tools=tools)\n }\n tools_by_name = {}\n for tool_ in tools:\n if not isinstance(tool_, BaseTool):\n tool_ = tool(tool_)\n tools_by_name[tool_.name] = tool_\n for _agent in subagents:\n if \"tools\" in _agent:\n _tools = [tools_by_name[t] for t in _agent[\"tools\"]]\n else:\n _tools = tools\n agents[_agent[\"name\"]] = create_react_agent(\n model, prompt=_agent[\"prompt\"], tools=_tools, state_schema=state_schema\n )\n\n other_agents_string = [\n f\"- {_agent['name']}: {_agent['description']}\" for _agent in subagents\n ]\n\n @tool(\n description=TASK_DESCRIPTION_PREFIX.format(other_agents=other_agents_string)\n + TASK_DESCRIPTION_SUFFIX\n )\n def task(\n description: str,\n subagent_type: str,\n state: Annotated[DeepAgentState, InjectedState],\n tool_call_id: Annotated[str, InjectedToolCallId],\n ):\n if subagent_type not in agents:\n return f\"Error: invoked agent of type {subagent_type}, the only allowed types are {[f'`{k}`' for k in agents]}\"\n sub_agent = agents[subagent_type]\n state[\"messages\"] = [{\"role\": \"user\", \"content\": description}]\n result = sub_agent.invoke(state)\n return Command(\n update={\n \"files\": result.get(\"files\", {}),\n \"messages\": [\n ToolMessage(\n result[\"messages\"][-1].content, tool_call_id=tool_call_id\n )\n ],\n }\n )\n\n return task\n\ntools.py\n\nfrom langchain_core.tools import tool, InjectedToolCallId\nfrom langgraph.types import Command\nfrom langchain_core.messages import ToolMessage\nfrom typing import Annotated\nfrom langgraph.prebuilt import InjectedState\n\nfrom deepagents.prompts import (\n WRITE_TODOS_DESCRIPTION,\n EDIT_DESCRIPTION,\n TOOL_DESCRIPTION,\n)\nfrom deepagents.state import Todo, DeepAgentState\n\n\n@tool(description=WRITE_TODOS_DESCRIPTION)\ndef write_todos(\n todos: list[Todo], tool_call_id: Annotated[str, InjectedToolCallId]\n) -> Command:\n return Command(\n update={\n \"todos\": todos,\n \"messages\": [\n ToolMessage(f\"Updated todo list to {todos}\", tool_call_id=tool_call_id)\n ],\n }\n )\n\n\ndef ls(state: Annotated[DeepAgentState, InjectedState]) -> list[str]:\n \"\"\"List all files\"\"\"\n return list(state.get(\"files\", {}).keys())\n\n\n@tool(description=TOOL_DESCRIPTION)\ndef read_file(\n file_path: str,\n state: Annotated[DeepAgentState, InjectedState],\n offset: int = 0,\n limit: int = 2000,\n) -> str:\n \"\"\"Read file.\"\"\"\n mock_filesystem = state.get(\"files\", {})\n if file_path not in mock_filesystem:\n return f\"Error: File '{file_path}' not found\"\n\n # Get file content\n content = mock_filesystem[file_path]\n\n # Handle empty file\n if not content or content.strip() == \"\":\n return \"System reminder: File exists but has empty contents\"\n\n # Split content into lines\n lines = content.splitlines()\n\n # Apply line offset and limit\n start_idx = offset\n end_idx = min(start_idx + limit, len(lines))\n\n # Handle case where offset is beyond file length\n if start_idx >= len(lines):\n return f\"Error: Line offset {offset} exceeds file length ({len(lines)} lines)\"\n\n # Format output with line numbers (cat -n format)\n result_lines = []\n for i in range(start_idx, end_idx):\n line_content = lines[i]\n\n # Truncate lines longer than 2000 characters\n if len(line_content) > 2000:\n line_content = line_content[:2000]\n\n # Line numbers start at 1, so add 1 to the index\n line_number = i + 1\n result_lines.append(f\"{line_number:6d}\\t{line_content}\")\n\n return \"\\n\".join(result_lines)\n\n\ndef write_file(\n file_path: str,\n content: str,\n state: Annotated[DeepAgentState, InjectedState],\n tool_call_id: Annotated[str, InjectedToolCallId],\n) -> Command:\n \"\"\"Write to a file.\"\"\"\n files = state.get(\"files\", {})\n files[file_path] = content\n return Command(\n update={\n \"files\": files,\n \"messages\": [\n ToolMessage(f\"Updated file {file_path}\", tool_call_id=tool_call_id)\n ],\n }\n )\n\n\n@tool(description=EDIT_DESCRIPTION)\ndef edit_file(\n file_path: str,\n old_string: str,\n new_string: str,\n state: Annotated[DeepAgentState, InjectedState],\n tool_call_id: Annotated[str, InjectedToolCallId],\n replace_all: bool = False,\n) -> str:\n \"\"\"Write to a file.\"\"\"\n mock_filesystem = state.get(\"files\", {})\n # Check if file exists in mock filesystem\n if file_path not in mock_filesystem:\n return f\"Error: File '{file_path}' not found\"\n\n # Get current file content\n content = mock_filesystem[file_path]\n\n # Check if old_string exists in the file\n if old_string not in content:\n return f\"Error: String not found in file: '{old_string}'\"\n\n # If not replace_all, check for uniqueness\n if not replace_all:\n occurrences = content.count(old_string)\n if occurrences > 1:\n return f\"Error: String '{old_string}' appears {occurrences} times in file. Use replace_all=True to replace all instances, or provide a more specific string with surrounding context.\"\n elif occurrences == 0:\n return f\"Error: String not found in file: '{old_string}'\"\n\n # Perform the replacement\n if replace_all:\n new_content = content.replace(old_string, new_string)\n replacement_count = content.count(old_string)\n result_msg = f\"Successfully replaced {replacement_count} instance(s) of the string in '{file_path}'\"\n else:\n new_content = content.replace(\n old_string, new_string, 1\n ) # Replace only first occurrence\n result_msg = f\"Successfully replaced string in '{file_path}'\"\n\n # Update the mock filesystem\n mock_filesystem[file_path] = new_content\n return Command(\n update={\n \"files\": mock_filesystem,\n \"messages\": [\n ToolMessage(f\"Updated file {file_path}\", tool_call_id=tool_call_id)\n ],\n }\n )", "title": "Create TypeScript Implementation of Deep Agents with 1:1 Python Mapping", "createdAt": 1754326377374, "completed": false, "planRevisions": [ { "revisionIndex": 0, "plans": [ { "index": 0, "plan": "**Set up project structure and dependencies** - Create `package.json` with required LangChain packages (`@langchain/core`, `@langchain/langgraph`, `@langchain/langgraph-sdk`, `@langchain/anthropic`, `zod` for validation), create `tsconfig.json` with proper TypeScript configuration, and set up `src/` directory structure matching the Python module organization.", "completed": true, "summary": "**Set up project structure and dependencies - COMPLETED**\n\nSuccessfully established the foundational TypeScript project structure for the Deep Agents implementation:\n\n### Key Accomplishments:\n- **Created `package.json`** with all required dependencies:\n - `@langchain/core` (^0.3.66) - Core LangChain abstractions\n - `@langchain/langgraph` (^0.4.2) - Main LangGraph library \n - `@langchain/langgraph-sdk` (^0.0.105) - LangGraph SDK for cloud/platform integration\n - `@langchain/anthropic` (^0.3.25) - Anthropic model integration\n - `zod` (^3.23.8) - Schema validation library\n - TypeScript and Node.js type definitions as dev dependencies\n\n- **Created `tsconfig.json`** with optimal TypeScript configuration:\n - Target ES2022 with CommonJS modules for Node.js compatibility\n - Strict type checking enabled for maximum type safety\n - Declaration files and source maps generation\n - Proper module resolution and decorator support\n - Output directory structure (`src/` → `dist/`)\n\n- **Established `src/` directory structure** to mirror Python module organization\n- **Successfully installed all dependencies** (42 packages) with zero vulnerabilities\n\n### Project Structure:\n```\ndeepagentsjs/\n├── package.json\n├── tsconfig.json\n├── src/ (ready for implementation files)\n└── node_modules/ (dependencies installed)\n```\n\nThe project is now ready for implementing the TypeScript type definitions and core functionality, maintaining 1:1 compatibility with the Python Deep Agents implementation." }, { "index": 1, "plan": "**Implement TypeScript type definitions in `src/types.ts`** - Define core interfaces including `SubAgent` interface (with `name`, `description`, `prompt`, and optional `tools` properties), `Todo` interface with `content` and `status` literal types, and generic type utilities for state schema management that mirror the Python `TypeVar` and `Type` patterns.", "completed": true, "summary": "Implemented TypeScript type definitions in `src/types.ts` as required. The file now includes:\n- `Todo` interface (with `content` and `status` literal types)\n- `SubAgent` interface (with `name`, `description`, `prompt`, and optional `tools` properties)\n- Type utilities for state schema management, including generic constraints, type utilities for state schemas, reducers, and command patterns\n- All types and interfaces mirror the Python TypeVar, Type, and TypedDict patterns for 1:1 compatibility\n\nThis provides a strong type foundation for the rest of the Deep Agents TypeScript implementation." }, { "index": 2, "plan": "**Create state management system in `src/state.ts`** - Implement `DeepAgentState` using LangGraph's `Annotation.Root()` pattern with `todos` array and `files` dictionary channels, create file reducer function that merges file objects (equivalent to Python's `file_reducer`), and define proper TypeScript types that extend the base agent state pattern.", "completed": true, "summary": "**Create state management system in `src/state.ts` - COMPLETED**\n\nSuccessfully implemented the state management system using LangGraph's `Annotation.Root()` pattern with 1:1 Python compatibility:\n\n### Key Accomplishments:\n- **Implemented `DeepAgentState`** using LangGraph's `Annotation.Root()` pattern with three channels:\n - `messages`: BaseMessage[] with concat reducer (inherited from AgentState pattern)\n - `todos`: Todo[] with replacement reducer matching Python behavior\n - `files`: Record with custom file reducer\n\n- **Created `fileReducer` function** that exactly mirrors Python's `file_reducer`:\n - Handles null/undefined cases properly\n - Merges file objects using spread operator\n - Maintains exact same logic as Python implementation\n\n- **Defined proper TypeScript types**:\n - `DeepAgentStateType` - Type alias for the state\n - `DeepAgentStateInterface` - Interface extending base agent state pattern\n - Utility functions for initialization, type guards, and state merging\n\n- **Added comprehensive type safety**:\n - `createInitialDeepAgentState()` - Factory for initial state\n - `isDeepAgentState()` - Runtime type guard\n - `mergeDeepAgentState()` - State merging utility\n\n### State Structure:\n```typescript\nDeepAgentState = Annotation.Root({\n messages: BaseMessage[] (with concat reducer),\n todos: Todo[] (with replacement reducer),\n files: Record (with fileReducer)\n})\n```\n\nThe implementation provides full type safety while maintaining exact behavioral compatibility with the Python version's state management system." }, { "index": 3, "plan": "**Implement model configuration in `src/model.ts`** - Create `getDefaultModel()` function that returns a configured `ChatAnthropic` instance with model name `claude-sonnet-4-20250514` and `maxTokens: 64000`, matching the exact Python configuration, and export proper TypeScript types for model interfaces.", "completed": true, "summary": "**Implement model configuration in `src/model.ts` - COMPLETED**\n\nSuccessfully implemented the model configuration system with exact 1:1 Python compatibility:\n\n### Key Accomplishments:\n- **Created `getDefaultModel()` function** that returns a configured `ChatAnthropic` instance with:\n - Model name: `claude-sonnet-4-20250514` (exact match to Python)\n - MaxTokens: 64000 (exact match to Python)\n - Proper TypeScript typing\n\n- **Exported proper TypeScript types** including:\n - `DefaultModelType` - Type alias for ChatAnthropic\n - `ModelConfig` - Interface for model configuration options\n - `LanguageModelLike` - Union type for flexible model parameters\n\n- **Added utility functions** for enhanced functionality:\n - `createAnthropicModel()` - Factory with custom configuration\n - `resolveModel()` - Utility to resolve LanguageModelLike to concrete instances\n - `isChatAnthropic()` and `isLanguageModel()` - Type guards for runtime checking\n\n- **Included model constants** - `MODEL_NAMES` object with commonly used model identifiers\n\n### Core Implementation:\n```typescript\nexport function getDefaultModel(): ChatAnthropic {\n return new ChatAnthropic({\n model: \"claude-sonnet-4-20250514\",\n maxTokens: 64000,\n });\n}\n```\n\nThe implementation provides exact behavioral compatibility with Python's `get_default_model()` while adding TypeScript-specific enhancements for type safety and developer experience." }, { "index": 4, "plan": "**Create prompt templates in `src/prompts.ts`** - Export all prompt constants as TypeScript string literals: `WRITE_TODOS_DESCRIPTION`, `TASK_DESCRIPTION_PREFIX`, `TASK_DESCRIPTION_SUFFIX`, `EDIT_DESCRIPTION`, and `TOOL_DESCRIPTION`, copying the exact text content from the Python version to maintain 1:1 functionality.", "completed": true, "summary": "Created `src/prompts.ts` and exported all required prompt constants as TypeScript string literals:\n- `WRITE_TODOS_DESCRIPTION`\n- `TASK_DESCRIPTION_PREFIX`\n- `TASK_DESCRIPTION_SUFFIX`\n- `EDIT_DESCRIPTION`\n- `TOOL_DESCRIPTION`\n\nAll prompt text was copied verbatim from the Python version to maintain 1:1 functionality. The file is ready for use in subsequent implementation steps." }, { "index": 5, "plan": "**Implement core tools in `src/tools.ts`** - Create `writeTodos`, `readFile`, `writeFile`, `editFile`, and `ls` tools using LangGraph's `tool()` function with Zod schemas for validation, implement state injection patterns using LangGraph's state management, ensure each tool returns proper `Command` objects for state updates, and maintain exact same functionality as Python versions including error handling and file system simulation.", "completed": false }, { "index": 6, "plan": "**Build sub-agent system in `src/sub-agent.ts`** - Implement `_createTaskTool` function that creates dynamic task delegation tool, build agent registry system that maps agent names to `createReactAgent` instances, create the main `task` tool that handles sub-agent invocation with proper state management and tool filtering, and ensure proper TypeScript typing throughout the sub-agent creation process.", "completed": false }, { "index": 7, "plan": "**Create main graph factory in `src/graph.ts`** - Implement `createDeepAgent` function with exact same signature as Python version (tools, instructions, model, subagents, stateSchema parameters), combine built-in tools with user-provided tools, create task tool using sub-agent system, use `createReactAgent` from LangGraph prebuilt with proper prompt construction, and ensure proper TypeScript generics for state schema handling.", "completed": false }, { "index": 8, "plan": "**Add index file and exports in `src/index.ts`** - Export all public APIs including `createDeepAgent`, `DeepAgentState`, `SubAgent` interface, `getDefaultModel`, and all tool functions, ensuring the TypeScript module provides the same public interface as the Python package for seamless migration.", "completed": false } ], "createdAt": 1754326377374, "createdBy": "agent" }, { "revisionIndex": 1, "plans": [ { "index": 0, "plan": "**Set up project structure and dependencies** - Create `package.json` with required LangChain packages (`@langchain/core`, `@langchain/langgraph`, `@langchain/langgraph-sdk`, `@langchain/anthropic`, `zod` for validation), create `tsconfig.json` with proper TypeScript configuration, and set up `src/` directory structure matching the Python module organization.", "completed": true, "summary": "**Set up project structure and dependencies - COMPLETED**\n\nSuccessfully established the foundational TypeScript project structure for the Deep Agents implementation:\n\n### Key Accomplishments:\n- **Created `package.json`** with all required dependencies:\n - `@langchain/core` (^0.3.66) - Core LangChain abstractions\n - `@langchain/langgraph` (^0.4.2) - Main LangGraph library \n - `@langchain/langgraph-sdk` (^0.0.105) - LangGraph SDK for cloud/platform integration\n - `@langchain/anthropic` (^0.3.25) - Anthropic model integration\n - `zod` (^3.23.8) - Schema validation library\n - TypeScript and Node.js type definitions as dev dependencies\n\n- **Created `tsconfig.json`** with optimal TypeScript configuration:\n - Target ES2022 with CommonJS modules for Node.js compatibility\n - Strict type checking enabled for maximum type safety\n - Declaration files and source maps generation\n - Proper module resolution and decorator support\n - Output directory structure (`src/` → `dist/`)\n\n- **Established `src/` directory structure** to mirror Python module organization\n- **Successfully installed all dependencies** (42 packages) with zero vulnerabilities\n\n### Project Structure:\n```\ndeepagentsjs/\n├── package.json\n├── tsconfig.json\n├── src/ (ready for implementation files)\n└── node_modules/ (dependencies installed)\n```\n\nThe project is now ready for implementing the TypeScript type definitions and core functionality, maintaining 1:1 compatibility with the Python Deep Agents implementation." }, { "index": 1, "plan": "**Implement TypeScript type definitions in `src/types.ts`** - Define core interfaces including `SubAgent` interface (with `name`, `description`, `prompt`, and optional `tools` properties), `Todo` interface with `content` and `status` literal types, and generic type utilities for state schema management that mirror the Python `TypeVar` and `Type` patterns.", "completed": true, "summary": "Implemented TypeScript type definitions in `src/types.ts` as required. The file now includes:\n- `Todo` interface (with `content` and `status` literal types)\n- `SubAgent` interface (with `name`, `description`, `prompt`, and optional `tools` properties)\n- Type utilities for state schema management, including generic constraints, type utilities for state schemas, reducers, and command patterns\n- All types and interfaces mirror the Python TypeVar, Type, and TypedDict patterns for 1:1 compatibility\n\nThis provides a strong type foundation for the rest of the Deep Agents TypeScript implementation." }, { "index": 2, "plan": "**Create state management system in `src/state.ts`** - Implement `DeepAgentState` using LangGraph's `Annotation.Root()` pattern with `todos` array and `files` dictionary channels, create file reducer function that merges file objects (equivalent to Python's `file_reducer`), and define proper TypeScript types that extend the base agent state pattern.", "completed": true, "summary": "**Create state management system in `src/state.ts` - COMPLETED**\n\nSuccessfully implemented the state management system using LangGraph's `Annotation.Root()` pattern with 1:1 Python compatibility:\n\n### Key Accomplishments:\n- **Implemented `DeepAgentState`** using LangGraph's `Annotation.Root()` pattern with three channels:\n - `messages`: BaseMessage[] with concat reducer (inherited from AgentState pattern)\n - `todos`: Todo[] with replacement reducer matching Python behavior\n - `files`: Record with custom file reducer\n\n- **Created `fileReducer` function** that exactly mirrors Python's `file_reducer`:\n - Handles null/undefined cases properly\n - Merges file objects using spread operator\n - Maintains exact same logic as Python implementation\n\n- **Defined proper TypeScript types**:\n - `DeepAgentStateType` - Type alias for the state\n - `DeepAgentStateInterface` - Interface extending base agent state pattern\n - Utility functions for initialization, type guards, and state merging\n\n- **Added comprehensive type safety**:\n - `createInitialDeepAgentState()` - Factory for initial state\n - `isDeepAgentState()` - Runtime type guard\n - `mergeDeepAgentState()` - State merging utility\n\n### State Structure:\n```typescript\nDeepAgentState = Annotation.Root({\n messages: BaseMessage[] (with concat reducer),\n todos: Todo[] (with replacement reducer),\n files: Record (with fileReducer)\n})\n```\n\nThe implementation provides full type safety while maintaining exact behavioral compatibility with the Python version's state management system." }, { "index": 3, "plan": "**Implement model configuration in `src/model.ts`** - Create `getDefaultModel()` function that returns a configured `ChatAnthropic` instance with model name `claude-sonnet-4-20250514` and `maxTokens: 64000`, matching the exact Python configuration, and export proper TypeScript types for model interfaces.", "completed": true, "summary": "**Implement model configuration in `src/model.ts` - COMPLETED**\n\nSuccessfully implemented the model configuration system with exact 1:1 Python compatibility:\n\n### Key Accomplishments:\n- **Created `getDefaultModel()` function** that returns a configured `ChatAnthropic` instance with:\n - Model name: `claude-sonnet-4-20250514` (exact match to Python)\n - MaxTokens: 64000 (exact match to Python)\n - Proper TypeScript typing\n\n- **Exported proper TypeScript types** including:\n - `DefaultModelType` - Type alias for ChatAnthropic\n - `ModelConfig` - Interface for model configuration options\n - `LanguageModelLike` - Union type for flexible model parameters\n\n- **Added utility functions** for enhanced functionality:\n - `createAnthropicModel()` - Factory with custom configuration\n - `resolveModel()` - Utility to resolve LanguageModelLike to concrete instances\n - `isChatAnthropic()` and `isLanguageModel()` - Type guards for runtime checking\n\n- **Included model constants** - `MODEL_NAMES` object with commonly used model identifiers\n\n### Core Implementation:\n```typescript\nexport function getDefaultModel(): ChatAnthropic {\n return new ChatAnthropic({\n model: \"claude-sonnet-4-20250514\",\n maxTokens: 64000,\n });\n}\n```\n\nThe implementation provides exact behavioral compatibility with Python's `get_default_model()` while adding TypeScript-specific enhancements for type safety and developer experience." }, { "index": 4, "plan": "**Create prompt templates in `src/prompts.ts`** - Export all prompt constants as TypeScript string literals: `WRITE_TODOS_DESCRIPTION`, `TASK_DESCRIPTION_PREFIX`, `TASK_DESCRIPTION_SUFFIX`, `EDIT_DESCRIPTION`, and `TOOL_DESCRIPTION`, copying the exact text content from the Python version to maintain 1:1 functionality.", "completed": true, "summary": "Created `src/prompts.ts` and exported all required prompt constants as TypeScript string literals:\n- `WRITE_TODOS_DESCRIPTION`\n- `TASK_DESCRIPTION_PREFIX`\n- `TASK_DESCRIPTION_SUFFIX`\n- `EDIT_DESCRIPTION`\n- `TOOL_DESCRIPTION`\n\nAll prompt text was copied verbatim from the Python version to maintain 1:1 functionality. The file is ready for use in subsequent implementation steps." }, { "index": 5, "plan": "Fix `src/prompts.ts`: wrap multi-line strings in back-ticked template literals (or split them) so they are valid TypeScript and compile without errors.", "completed": true, "summary": "**Fix `src/prompts.ts`: wrap multi-line strings in back-ticked template literals (or split them) so they are valid TypeScript and compile without errors - COMPLETED**\n\nSuccessfully resolved all TypeScript compilation errors in the prompts file:\n\n### Key Accomplishments:\n- **Fixed template literal syntax issues** - Recreated `src/prompts.ts` with properly escaped backticks to resolve TS1005, TS1443, and TS1160 compilation errors\n- **Preserved exact prompt content** - Maintained verbatim text from Python version while ensuring TypeScript compatibility\n- **Resolved import issues** - Fixed `BaseTool` import in `src/types.ts` by updating to `StructuredTool` from `@langchain/core/tools`\n- **Verified successful compilation** - Confirmed `npm run build` now completes with zero TypeScript errors\n\n### Technical Details:\n- **Problem**: Template literals containing unescaped backticks (`) were causing TypeScript to interpret them as nested template literals\n- **Solution**: Recreated the file with properly escaped backticks (\\`) in template literal strings\n- **Validation**: Build now succeeds completely with no compilation errors\n\n### Files Fixed:\n- `src/prompts.ts` - All prompt constants now compile correctly\n- `src/types.ts` - Updated import to use correct LangChain export\n\nThe project now has a solid foundation with all core configuration files compiling successfully, ready for implementing the remaining tools and functionality." }, { "index": 6, "plan": "Implement `src/tools.ts` replicating Python `tools.py` functionality (writeTodos, ls, readFile, writeFile, editFile) using LangGraph’s `tool()` helper and correct `Command` return types.", "completed": false }, { "index": 7, "plan": "Implement `src/sub-agent.ts` with `_createTaskTool`, sub-agent registry, and the `task` tool, using strict TypeScript typing and LangGraph APIs.", "completed": false }, { "index": 8, "plan": "Implement `src/graph.ts` containing `createDeepAgent` that assembles built-in tools with user tools, constructs the prompt, creates the task tool, and returns a `createReactAgent` instance, mirroring Python logic.", "completed": false }, { "index": 9, "plan": "Create `src/index.ts` that re-exports public APIs (`createDeepAgent`, `DeepAgentState`, `SubAgent`, `getDefaultModel`, tool functions, etc.).", "completed": false }, { "index": 10, "plan": "After implementing the above, run `npm run build` and ensure the TypeScript compiler reports zero errors.", "completed": false }, { "index": 11, "plan": "(Optional but recommended) Add basic unit tests or an example to demonstrate usage and verify runtime behaviour.", "completed": false } ], "createdAt": 1754327189505, "createdBy": "agent" } ], "activeRevisionIndex": 1, "pullRequestNumber": 3 } ], "activeTaskIndex": 0 } [ "**Set up project structure and dependencies** - Create `package.json` with required LangChain packages (`@langchain/core`, `@langchain/langgraph`, `@langchain/langgraph-sdk`, `@langchain/anthropic`, `zod` for validation), create `tsconfig.json` with proper TypeScript configuration, and set up `src/` directory structure matching the Python module organization.", "**Implement TypeScript type definitions in `src/types.ts`** - Define core interfaces including `SubAgent` interface (with `name`, `description`, `prompt`, and optional `tools` properties), `Todo` interface with `content` and `status` literal types, and generic type utilities for state schema management that mirror the Python `TypeVar` and `Type` patterns.", "**Create state management system in `src/state.ts`** - Implement `DeepAgentState` using LangGraph's `Annotation.Root()` pattern with `todos` array and `files` dictionary channels, create file reducer function that merges file objects (equivalent to Python's `file_reducer`), and define proper TypeScript types that extend the base agent state pattern.", "**Implement model configuration in `src/model.ts`** - Create `getDefaultModel()` function that returns a configured `ChatAnthropic` instance with model name `claude-sonnet-4-20250514` and `maxTokens: 64000`, matching the exact Python configuration, and export proper TypeScript types for model interfaces.", "**Create prompt templates in `src/prompts.ts`** - Export all prompt constants as TypeScript string literals: `WRITE_TODOS_DESCRIPTION`, `TASK_DESCRIPTION_PREFIX`, `TASK_DESCRIPTION_SUFFIX`, `EDIT_DESCRIPTION`, and `TOOL_DESCRIPTION`, copying the exact text content from the Python version to maintain 1:1 functionality.", "**Implement core tools in `src/tools.ts`** - Create `writeTodos`, `readFile`, `writeFile`, `editFile`, and `ls` tools using LangGraph's `tool()` function with Zod schemas for validation, implement state injection patterns using LangGraph's state management, ensure each tool returns proper `Command` objects for state updates, and maintain exact same functionality as Python versions including error handling and file system simulation.", "**Build sub-agent system in `src/sub-agent.ts`** - Implement `_createTaskTool` function that creates dynamic task delegation tool, build agent registry system that maps agent names to `createReactAgent` instances, create the main `task` tool that handles sub-agent invocation with proper state management and tool filtering, and ensure proper TypeScript typing throughout the sub-agent creation process.", "**Create main graph factory in `src/graph.ts`** - Implement `createDeepAgent` function with exact same signature as Python version (tools, instructions, model, subagents, stateSchema parameters), combine built-in tools with user-provided tools, create task tool using sub-agent system, use `createReactAgent` from LangGraph prebuilt with proper prompt construction, and ensure proper TypeScript generics for state schema handling.", "**Add index file and exports in `src/index.ts`** - Export all public APIs including `createDeepAgent`, `DeepAgentState`, `SubAgent` interface, `getDefaultModel`, and all tool functions, ensuring the TypeScript module provides the same public interface as the Python package for seamless migration." ]
Originally created by @Palashio on GitHub (Aug 4, 2025). Original GitHub issue: https://github.com/langchain-ai/deepagentsjs/issues/2 <open-swe-issue-content>we want to create a typescript implementation of deep agents that's implemented in python. we want to try and make everything 1:1 as possible, and define any of the types. here are the files in python: graph.py from deepagents.sub_agent import _create_task_tool, SubAgent from deepagents.model import get_default_model from deepagents.tools import write_todos, write_file, read_file, ls, edit_file from deepagents.state import DeepAgentState from typing import Sequence, Union, Callable, Any, TypeVar, Type, Optional from langchain_core.tools import BaseTool from langchain_core.language_models import LanguageModelLike from langgraph.prebuilt import create_react_agent StateSchema = TypeVar("StateSchema", bound=DeepAgentState) StateSchemaType = Type[StateSchema] base_prompt = """You have access to a number of standard tools ## `write_todos` You have access to the `write_todos` tools to help you manage and plan tasks. Use these tools VERY frequently to ensure that you are tracking your tasks and giving the user visibility into your progress. These tools are also EXTREMELY helpful for planning tasks, and for breaking down larger complex tasks into smaller steps. If you do not use this tool when planning, you may forget to do important tasks - and that is unacceptable. It is critical that you mark todos as completed as soon as you are done with a task. Do not batch up multiple tasks before marking them as completed. ## `task` - When doing web search, prefer to use the `task` tool in order to reduce context usage.""" def create_deep_agent( tools: Sequence[Union[BaseTool, Callable, dict[str, Any]]], instructions: str, model: Optional[Union[str, LanguageModelLike]] = None, subagents: list[SubAgent] = None, state_schema: Optional[StateSchemaType] = None, ): """Create a deep agent. This agent will by default have access to a tool to write todos (write_todos), and then four file editing tools: write_file, ls, read_file, edit_file. Args: tools: The additional tools the agent should have access to. instructions: The additional instructions the agent should have. Will go in the system prompt. model: The model to use. subagents: The subagents to use. Each subagent should be a dictionary with the following keys: - `name` - `description` (used by the main agent to decide whether to call the sub agent) - `prompt` (used as the system prompt in the subagent) - (optional) `tools` state_schema: The schema of the deep agent. Should subclass from DeepAgentState """ prompt = instructions + base_prompt built_in_tools = [write_todos, write_file, read_file, ls, edit_file] if model is None: model = get_default_model() state_schema = state_schema or DeepAgentState task_tool = _create_task_tool( list(tools) + built_in_tools, instructions, subagents or [], model, state_schema ) all_tools = built_in_tools + list(tools) + [task_tool] return create_react_agent( model, prompt=prompt, tools=all_tools, state_schema=state_schema, ) model.py from langchain_anthropic import ChatAnthropic def get_default_model(): return ChatAnthropic(model_name="claude-sonnet-4-20250514", max_tokens=64000) prompts.py WRITE_TODOS_DESCRIPTION = """Use this tool to create and manage a structured task list for your current work session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user. It also helps the user understand the progress of the task and overall progress of their requests. ## When to Use This Tool Use this tool proactively in these scenarios: 1. Complex multi-step tasks - When a task requires 3 or more distinct steps or actions 2. Non-trivial and complex tasks - Tasks that require careful planning or multiple operations 3. User explicitly requests todo list - When the user directly asks you to use the todo list 4. User provides multiple tasks - When users provide a list of things to be done (numbered or comma-separated) 5. After receiving new instructions - Immediately capture user requirements as todos 6. When you start working on a task - Mark it as in_progress BEFORE beginning work. Ideally you should only have one todo as in_progress at a time 7. After completing a task - Mark it as completed and add any new follow-up tasks discovered during implementation ## When NOT to Use This Tool Skip using this tool when: 1. There is only a single, straightforward task 2. The task is trivial and tracking it provides no organizational benefit 3. The task can be completed in less than 3 trivial steps 4. The task is purely conversational or informational NOTE that you should not use this tool if there is only one trivial task to do. In this case you are better off just doing the task directly. ## Examples of When to Use the Todo List <example> User: I want to add a dark mode toggle to the application settings. Make sure you run the tests and build when you're done! Assistant: I'll help add a dark mode toggle to your application settings. Let me create a todo list to track this implementation. *Creates todo list with the following items:* 1. Create dark mode toggle component in Settings page 2. Add dark mode state management (context/store) 3. Implement CSS-in-JS styles for dark theme 4. Update existing components to support theme switching 5. Run tests and build process, addressing any failures or errors that occur *Begins working on the first task* <reasoning> The assistant used the todo list because: 1. Adding dark mode is a multi-step feature requiring UI, state management, and styling changes 2. The user explicitly requested tests and build be run afterward 3. The assistant inferred that tests and build need to pass by adding "Ensure tests and build succeed" as the final task </reasoning> </example> <example> User: Help me plan a comprehensive marketing campaign for our new product launch, including social media, email marketing, and press releases. Assistant: I'll help you plan a comprehensive marketing campaign for your product launch. Let me create a todo list to organize all the components. *Creates todo list with the following items:* 1. Define target audience and key messaging 2. Create social media content calendar and posting schedule 3. Design email marketing sequence and automation flows 4. Draft press release and identify media contacts 5. Set up tracking and analytics for campaign performance 6. Create visual assets and brand materials 7. Coordinate launch timeline and deliverables *Begins working on the first task* <reasoning> The assistant used the todo list because: 1. Marketing campaign planning involves multiple distinct channels and activities 2. Each component requires careful coordination and planning 3. The systematic approach ensures all aspects of the launch are covered 4. Progress tracking helps maintain timeline and deliverables </reasoning> </example> <example> User: Help me rename the function getCwd to getCurrentWorkingDirectory across my project Assistant: Let me first search through your codebase to find all occurrences of 'getCwd'. *Uses search tools to locate all instances of getCwd in the codebase* Assistant: I've found 15 instances of 'getCwd' across 8 different files. Let me create a todo list to track these changes. *Creates todo list with specific items for each file that needs updating* <reasoning> The assistant used the todo list because: 1. First, the assistant searched to understand the scope of the task 2. Upon finding multiple occurrences across different files, it determined this was a complex task with multiple steps 3. The todo list helps ensure every instance is tracked and updated systematically 4. This approach prevents missing any occurrences and maintains consistency </reasoning> </example> <example> User: I need help organizing my home office: decluttering the desk, setting up a filing system, organizing digital files, and creating a daily workflow. Assistant: I'll help you organize your home office systematically. Let me create a todo list to track each area of organization. *Creates todo list with items like: 1) Sort and declutter desk items, 2) Set up physical filing system for documents, 3) Organize digital files and folders, 4) Create daily workflow and productivity systems, 5) Establish maintenance routines* Let's start with decluttering your desk space to create a clean foundation for the other organizational systems. <reasoning> The assistant used the todo list because: 1. The user provided multiple distinct organizational tasks 2. Each area requires different approaches and careful planning 3. Home organization benefits from systematic, step-by-step completion 4. Progress tracking ensures all areas are addressed thoroughly </reasoning> </example> ## Examples of When NOT to Use the Todo List <example> User: How do I print 'Hello World' in Python? Assistant: In Python, you can print "Hello World" with this simple code: python print("Hello World") This will output the text "Hello World" to the console when executed.</assistant> <reasoning> The assistant did not use the todo list because this is a single, trivial task that can be completed in one step. There's no need to track multiple tasks or steps for such a straightforward request. </reasoning> </example> <example> User: What's the best way to water houseplants? Assistant: The best way to water houseplants depends on the specific plant type, but here are some general guidelines: - Check soil moisture by inserting your finger about 1-2 inches into the soil - Water thoroughly when the top inch feels dry, allowing water to drain from the bottom - Use room temperature water and water in the morning when possible - Avoid overwatering, which is more harmful than underwatering for most plants Different plants have different needs, so it's important to research your specific varieties for optimal care. <reasoning> The assistant did not use the todo list because this is an informational request with no actual tasks to complete. The user is simply asking for advice and explanation, not for the assistant to perform multiple steps or activities. </reasoning> </example> <example> User: Can you add a comment to the calculateTotal function to explain what it does? Assistant: Sure, let me add a comment to the calculateTotal function to explain what it does. * Uses the Edit tool to add a comment to the calculateTotal function * <reasoning> The assistant did not use the todo list because this is a single, straightforward task confined to one location. Adding a comment doesn't require tracking multiple steps or systematic organization. </reasoning> </example> <example> User: What time is it in Tokyo right now? Assistant: I'll check the current time in Tokyo for you. *Searches for current time in Tokyo* The current time in Tokyo, Japan is [current time]. Tokyo is in the Japan Standard Time (JST) zone, which is UTC+9. <reasoning> The assistant did not use the todo list because this is a single information lookup with immediate results. There are no multiple steps to track or organize, making the todo list unnecessary for this straightforward request. </reasoning> </example> ## Task States and Management 1. **Task States**: Use these states to track progress: - pending: Task not yet started - in_progress: Currently working on (limit to ONE task at a time) - completed: Task finished successfully 2. **Task Management**: - Update task status in real-time as you work - Mark tasks complete IMMEDIATELY after finishing (don't batch completions) - Only have ONE task in_progress at any time - Complete current tasks before starting new ones - Remove tasks that are no longer relevant from the list entirely 3. **Task Completion Requirements**: - ONLY mark a task as completed when you have FULLY accomplished it - If you encounter errors, blockers, or cannot finish, keep the task as in_progress - When blocked, create a new task describing what needs to be resolved - Never mark a task as completed if: - There are unresolved issues or errors - Work is partial or incomplete - You encountered blockers that prevent completion - You couldn't find necessary resources or dependencies - Quality standards haven't been met 4. **Task Breakdown**: - Create specific, actionable items - Break complex tasks into smaller, manageable steps - Use clear, descriptive task names When in doubt, use this tool. Being proactive with task management demonstrates attentiveness and ensures you complete all requirements successfully.""" TASK_DESCRIPTION_PREFIX = """Launch a new agent to handle complex, multi-step tasks autonomously. Available agent types and the tools they have access to: - general-purpose: General-purpose agent for researching complex questions, searching for files and content, and executing multi-step tasks. When you are searching for a keyword or file and are not confident that you will find the right match in the first few tries use this agent to perform the search for you. (Tools: *) {other_agents} """ TASK_DESCRIPTION_SUFFIX = """When using the Task tool, you must specify a subagent_type parameter to select which agent type to use. When to use the Agent tool: - When you are instructed to execute custom slash commands. Use the Agent tool with the slash command invocation as the entire prompt. The slash command can take arguments. For example: Task(description="Check the file", prompt="/check-file path/to/file.py") When NOT to use the Agent tool: - If you want to read a specific file path, use the Read or Glob tool instead of the Agent tool, to find the match more quickly - If you are searching for a specific term or definition within a known location, use the Glob tool instead, to find the match more quickly - If you are searching for content within a specific file or set of 2-3 files, use the Read tool instead of the Agent tool, to find the match more quickly - Other tasks that are not related to the agent descriptions above Usage notes: 1. Launch multiple agents concurrently whenever possible, to maximize performance; to do that, use a single message with multiple tool uses 2. When the agent is done, it will return a single message back to you. The result returned by the agent is not visible to the user. To show the user the result, you should send a text message back to the user with a concise summary of the result. 3. Each agent invocation is stateless. You will not be able to send additional messages to the agent, nor will the agent be able to communicate with you outside of its final report. Therefore, your prompt should contain a highly detailed task description for the agent to perform autonomously and you should specify exactly what information the agent should return back to you in its final and only message to you. 4. The agent's outputs should generally be trusted 5. Clearly tell the agent whether you expect it to create content, perform analysis, or just do research (search, file reads, web fetches, etc.), since it is not aware of the user's intent 6. If the agent description mentions that it should be used proactively, then you should try your best to use it without the user having to ask for it first. Use your judgement. Example usage: <example_agent_descriptions> "content-reviewer": use this agent after you are done creating significant content or documents "greeting-responder": use this agent when to respond to user greetings with a friendly joke "research-analyst": use this agent to conduct thorough research on complex topics </example_agent_description> <example> user: "Please write a function that checks if a number is prime" assistant: Sure let me write a function that checks if a number is prime assistant: First let me use the Write tool to write a function that checks if a number is prime assistant: I'm going to use the Write tool to write the following code: <code> function isPrime(n) { if (n <= 1) return false for (let i = 2; i * i <= n; i++) { if (n % i === 0) return false } return true } </code> <commentary> Since significant content was created and the task was completed, now use the content-reviewer agent to review the work </commentary> assistant: Now let me use the content-reviewer agent to review the code assistant: Uses the Task tool to launch with the content-reviewer agent </example> <example> user: "Can you help me research the environmental impact of different renewable energy sources and create a comprehensive report?" <commentary> This is a complex research task that would benefit from using the research-analyst agent to conduct thorough analysis </commentary> assistant: I'll help you research the environmental impact of renewable energy sources. Let me use the research-analyst agent to conduct comprehensive research on this topic. assistant: Uses the Task tool to launch with the research-analyst agent, providing detailed instructions about what research to conduct and what format the report should take </example> <example> user: "Hello" <commentary> Since the user is greeting, use the greeting-responder agent to respond with a friendly joke </commentary> assistant: "I'm going to use the Task tool to launch with the greeting-responder agent" </example>""" EDIT_DESCRIPTION = """Performs exact string replacements in files. Usage: - You must use your `Read` tool at least once in the conversation before editing. This tool will error if you attempt an edit without reading the file. - When editing text from Read tool output, ensure you preserve the exact indentation (tabs/spaces) as it appears AFTER the line number prefix. The line number prefix format is: spaces + line number + tab. Everything after that tab is the actual file content to match. Never include any part of the line number prefix in the old_string or new_string. - ALWAYS prefer editing existing files. NEVER write new files unless explicitly required. - Only use emojis if the user explicitly requests it. Avoid adding emojis to files unless asked. - The edit will FAIL if `old_string` is not unique in the file. Either provide a larger string with more surrounding context to make it unique or use `replace_all` to change every instance of `old_string`. - Use `replace_all` for replacing and renaming strings across the file. This parameter is useful if you want to rename a variable for instance.""" TOOL_DESCRIPTION = """Reads a file from the local filesystem. You can access any file directly by using this tool. Assume this tool is able to read all files on the machine. If the User provides a path to a file assume that path is valid. It is okay to read a file that does not exist; an error will be returned. Usage: - The file_path parameter must be an absolute path, not a relative path - By default, it reads up to 2000 lines starting from the beginning of the file - You can optionally specify a line offset and limit (especially handy for long files), but it's recommended to read the whole file by not providing these parameters - Any lines longer than 2000 characters will be truncated - Results are returned using cat -n format, with line numbers starting at 1 - You have the capability to call multiple tools in a single response. It is always better to speculatively read multiple files as a batch that are potentially useful. - If you read a file that exists but has empty contents you will receive a system reminder warning in place of file contents.""" state.py from langgraph.prebuilt.chat_agent_executor import AgentState from typing import NotRequired, Annotated from typing import Literal from typing_extensions import TypedDict class Todo(TypedDict): """Todo to track.""" content: str status: Literal["pending", "in_progress", "completed"] def file_reducer(l, r): if l is None: return r elif r is None: return l else: return {**l, **r} class DeepAgentState(AgentState): todos: NotRequired[list[Todo]] files: Annotated[NotRequired[dict[str, str]], file_reducer] sub_agent.py from deepagents.prompts import TASK_DESCRIPTION_PREFIX, TASK_DESCRIPTION_SUFFIX from deepagents.state import DeepAgentState from langgraph.prebuilt import create_react_agent from langchain_core.tools import BaseTool from typing import TypedDict from langchain_core.tools import tool, InjectedToolCallId from langchain_core.messages import ToolMessage from typing import Annotated, NotRequired from langgraph.types import Command from langgraph.prebuilt import InjectedState class SubAgent(TypedDict): name: str description: str prompt: str tools: NotRequired[list[str]] def _create_task_tool(tools, instructions, subagents: list[SubAgent], model, state_schema): agents = { "general-purpose": create_react_agent(model, prompt=instructions, tools=tools) } tools_by_name = {} for tool_ in tools: if not isinstance(tool_, BaseTool): tool_ = tool(tool_) tools_by_name[tool_.name] = tool_ for _agent in subagents: if "tools" in _agent: _tools = [tools_by_name[t] for t in _agent["tools"]] else: _tools = tools agents[_agent["name"]] = create_react_agent( model, prompt=_agent["prompt"], tools=_tools, state_schema=state_schema ) other_agents_string = [ f"- {_agent['name']}: {_agent['description']}" for _agent in subagents ] @tool( description=TASK_DESCRIPTION_PREFIX.format(other_agents=other_agents_string) + TASK_DESCRIPTION_SUFFIX ) def task( description: str, subagent_type: str, state: Annotated[DeepAgentState, InjectedState], tool_call_id: Annotated[str, InjectedToolCallId], ): if subagent_type not in agents: return f"Error: invoked agent of type {subagent_type}, the only allowed types are {[f'`{k}`' for k in agents]}" sub_agent = agents[subagent_type] state["messages"] = [{"role": "user", "content": description}] result = sub_agent.invoke(state) return Command( update={ "files": result.get("files", {}), "messages": [ ToolMessage( result["messages"][-1].content, tool_call_id=tool_call_id ) ], } ) return task tools.py from langchain_core.tools import tool, InjectedToolCallId from langgraph.types import Command from langchain_core.messages import ToolMessage from typing import Annotated from langgraph.prebuilt import InjectedState from deepagents.prompts import ( WRITE_TODOS_DESCRIPTION, EDIT_DESCRIPTION, TOOL_DESCRIPTION, ) from deepagents.state import Todo, DeepAgentState @tool(description=WRITE_TODOS_DESCRIPTION) def write_todos( todos: list[Todo], tool_call_id: Annotated[str, InjectedToolCallId] ) -> Command: return Command( update={ "todos": todos, "messages": [ ToolMessage(f"Updated todo list to {todos}", tool_call_id=tool_call_id) ], } ) def ls(state: Annotated[DeepAgentState, InjectedState]) -> list[str]: """List all files""" return list(state.get("files", {}).keys()) @tool(description=TOOL_DESCRIPTION) def read_file( file_path: str, state: Annotated[DeepAgentState, InjectedState], offset: int = 0, limit: int = 2000, ) -> str: """Read file.""" mock_filesystem = state.get("files", {}) if file_path not in mock_filesystem: return f"Error: File '{file_path}' not found" # Get file content content = mock_filesystem[file_path] # Handle empty file if not content or content.strip() == "": return "System reminder: File exists but has empty contents" # Split content into lines lines = content.splitlines() # Apply line offset and limit start_idx = offset end_idx = min(start_idx + limit, len(lines)) # Handle case where offset is beyond file length if start_idx >= len(lines): return f"Error: Line offset {offset} exceeds file length ({len(lines)} lines)" # Format output with line numbers (cat -n format) result_lines = [] for i in range(start_idx, end_idx): line_content = lines[i] # Truncate lines longer than 2000 characters if len(line_content) > 2000: line_content = line_content[:2000] # Line numbers start at 1, so add 1 to the index line_number = i + 1 result_lines.append(f"{line_number:6d}\t{line_content}") return "\n".join(result_lines) def write_file( file_path: str, content: str, state: Annotated[DeepAgentState, InjectedState], tool_call_id: Annotated[str, InjectedToolCallId], ) -> Command: """Write to a file.""" files = state.get("files", {}) files[file_path] = content return Command( update={ "files": files, "messages": [ ToolMessage(f"Updated file {file_path}", tool_call_id=tool_call_id) ], } ) @tool(description=EDIT_DESCRIPTION) def edit_file( file_path: str, old_string: str, new_string: str, state: Annotated[DeepAgentState, InjectedState], tool_call_id: Annotated[str, InjectedToolCallId], replace_all: bool = False, ) -> str: """Write to a file.""" mock_filesystem = state.get("files", {}) # Check if file exists in mock filesystem if file_path not in mock_filesystem: return f"Error: File '{file_path}' not found" # Get current file content content = mock_filesystem[file_path] # Check if old_string exists in the file if old_string not in content: return f"Error: String not found in file: '{old_string}'" # If not replace_all, check for uniqueness if not replace_all: occurrences = content.count(old_string) if occurrences > 1: return f"Error: String '{old_string}' appears {occurrences} times in file. Use replace_all=True to replace all instances, or provide a more specific string with surrounding context." elif occurrences == 0: return f"Error: String not found in file: '{old_string}'" # Perform the replacement if replace_all: new_content = content.replace(old_string, new_string) replacement_count = content.count(old_string) result_msg = f"Successfully replaced {replacement_count} instance(s) of the string in '{file_path}'" else: new_content = content.replace( old_string, new_string, 1 ) # Replace only first occurrence result_msg = f"Successfully replaced string in '{file_path}'" # Update the mock filesystem mock_filesystem[file_path] = new_content return Command( update={ "files": mock_filesystem, "messages": [ ToolMessage(f"Updated file {file_path}", tool_call_id=tool_call_id) ], } )</open-swe-issue-content> <details> <summary>Agent Context</summary> <open-swe-do-not-edit-task-plan> { "tasks": [ { "id": "2737cf65-74d6-498d-99d6-14baedb6afa8", "taskIndex": 0, "request": "[original issue]\n**Create TypeScript Implementation of Deep Agents**\nwe want to create a typescript implementation of deep agents that's implemented in python. we want to try and make everything 1:1 as possible, and define any of the types. \n\nhere are the files in python:\n\ngraph.py\n\nfrom deepagents.sub_agent import _create_task_tool, SubAgent\nfrom deepagents.model import get_default_model\nfrom deepagents.tools import write_todos, write_file, read_file, ls, edit_file\nfrom deepagents.state import DeepAgentState\nfrom typing import Sequence, Union, Callable, Any, TypeVar, Type, Optional\nfrom langchain_core.tools import BaseTool\nfrom langchain_core.language_models import LanguageModelLike\n\nfrom langgraph.prebuilt import create_react_agent\n\nStateSchema = TypeVar(\"StateSchema\", bound=DeepAgentState)\nStateSchemaType = Type[StateSchema]\n\nbase_prompt = \"\"\"You have access to a number of standard tools\n\n## `write_todos`\n\nYou have access to the `write_todos` tools to help you manage and plan tasks. Use these tools VERY frequently to ensure that you are tracking your tasks and giving the user visibility into your progress.\nThese tools are also EXTREMELY helpful for planning tasks, and for breaking down larger complex tasks into smaller steps. If you do not use this tool when planning, you may forget to do important tasks - and that is unacceptable.\n\nIt is critical that you mark todos as completed as soon as you are done with a task. Do not batch up multiple tasks before marking them as completed.\n## `task`\n\n- When doing web search, prefer to use the `task` tool in order to reduce context usage.\"\"\"\n\n\ndef create_deep_agent(\n tools: Sequence[Union[BaseTool, Callable, dict[str, Any]]],\n instructions: str,\n model: Optional[Union[str, LanguageModelLike]] = None,\n subagents: list[SubAgent] = None,\n state_schema: Optional[StateSchemaType] = None,\n):\n \"\"\"Create a deep agent.\n\n This agent will by default have access to a tool to write todos (write_todos),\n and then four file editing tools: write_file, ls, read_file, edit_file.\n\n Args:\n tools: The additional tools the agent should have access to.\n instructions: The additional instructions the agent should have. Will go in\n the system prompt.\n model: The model to use.\n subagents: The subagents to use. Each subagent should be a dictionary with the\n following keys:\n - `name`\n - `description` (used by the main agent to decide whether to call the sub agent)\n - `prompt` (used as the system prompt in the subagent)\n - (optional) `tools`\n state_schema: The schema of the deep agent. Should subclass from DeepAgentState\n \"\"\"\n prompt = instructions + base_prompt\n built_in_tools = [write_todos, write_file, read_file, ls, edit_file]\n if model is None:\n model = get_default_model()\n state_schema = state_schema or DeepAgentState\n task_tool = _create_task_tool(\n list(tools) + built_in_tools,\n instructions,\n subagents or [],\n model,\n state_schema\n )\n all_tools = built_in_tools + list(tools) + [task_tool]\n return create_react_agent(\n model,\n prompt=prompt,\n tools=all_tools,\n state_schema=state_schema,\n )\n\nmodel.py\n\nfrom langchain_anthropic import ChatAnthropic\n\n\ndef get_default_model():\n return ChatAnthropic(model_name=\"claude-sonnet-4-20250514\", max_tokens=64000)\n\nprompts.py\nWRITE_TODOS_DESCRIPTION = \"\"\"Use this tool to create and manage a structured task list for your current work session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.\nIt also helps the user understand the progress of the task and overall progress of their requests.\n\n## When to Use This Tool\nUse this tool proactively in these scenarios:\n\n1. Complex multi-step tasks - When a task requires 3 or more distinct steps or actions\n2. Non-trivial and complex tasks - Tasks that require careful planning or multiple operations\n3. User explicitly requests todo list - When the user directly asks you to use the todo list\n4. User provides multiple tasks - When users provide a list of things to be done (numbered or comma-separated)\n5. After receiving new instructions - Immediately capture user requirements as todos\n6. When you start working on a task - Mark it as in_progress BEFORE beginning work. Ideally you should only have one todo as in_progress at a time\n7. After completing a task - Mark it as completed and add any new follow-up tasks discovered during implementation\n\n## When NOT to Use This Tool\n\nSkip using this tool when:\n1. There is only a single, straightforward task\n2. The task is trivial and tracking it provides no organizational benefit\n3. The task can be completed in less than 3 trivial steps\n4. The task is purely conversational or informational\n\nNOTE that you should not use this tool if there is only one trivial task to do. In this case you are better off just doing the task directly.\n\n## Examples of When to Use the Todo List\n\n<example>\nUser: I want to add a dark mode toggle to the application settings. Make sure you run the tests and build when you're done!\nAssistant: I'll help add a dark mode toggle to your application settings. Let me create a todo list to track this implementation.\n*Creates todo list with the following items:*\n1. Create dark mode toggle component in Settings page\n2. Add dark mode state management (context/store)\n3. Implement CSS-in-JS styles for dark theme\n4. Update existing components to support theme switching\n5. Run tests and build process, addressing any failures or errors that occur\n*Begins working on the first task*\n\n<reasoning>\nThe assistant used the todo list because:\n1. Adding dark mode is a multi-step feature requiring UI, state management, and styling changes\n2. The user explicitly requested tests and build be run afterward\n3. The assistant inferred that tests and build need to pass by adding \"Ensure tests and build succeed\" as the final task\n</reasoning>\n</example>\n\n<example>\nUser: Help me plan a comprehensive marketing campaign for our new product launch, including social media, email marketing, and press releases.\nAssistant: I'll help you plan a comprehensive marketing campaign for your product launch. Let me create a todo list to organize all the components.\n*Creates todo list with the following items:*\n1. Define target audience and key messaging\n2. Create social media content calendar and posting schedule\n3. Design email marketing sequence and automation flows\n4. Draft press release and identify media contacts\n5. Set up tracking and analytics for campaign performance\n6. Create visual assets and brand materials\n7. Coordinate launch timeline and deliverables\n*Begins working on the first task*\n\n<reasoning>\nThe assistant used the todo list because:\n1. Marketing campaign planning involves multiple distinct channels and activities\n2. Each component requires careful coordination and planning\n3. The systematic approach ensures all aspects of the launch are covered\n4. Progress tracking helps maintain timeline and deliverables\n</reasoning>\n</example>\n\n<example>\nUser: Help me rename the function getCwd to getCurrentWorkingDirectory across my project\nAssistant: Let me first search through your codebase to find all occurrences of 'getCwd'.\n*Uses search tools to locate all instances of getCwd in the codebase*\nAssistant: I've found 15 instances of 'getCwd' across 8 different files. Let me create a todo list to track these changes.\n*Creates todo list with specific items for each file that needs updating*\n\n<reasoning>\nThe assistant used the todo list because:\n1. First, the assistant searched to understand the scope of the task\n2. Upon finding multiple occurrences across different files, it determined this was a complex task with multiple steps\n3. The todo list helps ensure every instance is tracked and updated systematically\n4. This approach prevents missing any occurrences and maintains consistency\n</reasoning>\n</example>\n\n<example>\nUser: I need help organizing my home office: decluttering the desk, setting up a filing system, organizing digital files, and creating a daily workflow.\nAssistant: I'll help you organize your home office systematically. Let me create a todo list to track each area of organization.\n*Creates todo list with items like: 1) Sort and declutter desk items, 2) Set up physical filing system for documents, 3) Organize digital files and folders, 4) Create daily workflow and productivity systems, 5) Establish maintenance routines*\nLet's start with decluttering your desk space to create a clean foundation for the other organizational systems.\n\n<reasoning>\nThe assistant used the todo list because:\n1. The user provided multiple distinct organizational tasks\n2. Each area requires different approaches and careful planning\n3. Home organization benefits from systematic, step-by-step completion\n4. Progress tracking ensures all areas are addressed thoroughly\n</reasoning>\n</example>\n\n## Examples of When NOT to Use the Todo List\n\n<example>\nUser: How do I print 'Hello World' in Python?\nAssistant: In Python, you can print \"Hello World\" with this simple code:\n\npython\nprint(\"Hello World\")\n\nThis will output the text \"Hello World\" to the console when executed.</assistant>\n\n<reasoning>\nThe assistant did not use the todo list because this is a single, trivial task that can be completed in one step. There's no need to track multiple tasks or steps for such a straightforward request.\n</reasoning>\n</example>\n\n<example>\nUser: What's the best way to water houseplants?\nAssistant: The best way to water houseplants depends on the specific plant type, but here are some general guidelines:\n\n- Check soil moisture by inserting your finger about 1-2 inches into the soil\n- Water thoroughly when the top inch feels dry, allowing water to drain from the bottom\n- Use room temperature water and water in the morning when possible\n- Avoid overwatering, which is more harmful than underwatering for most plants\n\nDifferent plants have different needs, so it's important to research your specific varieties for optimal care.\n\n<reasoning>\nThe assistant did not use the todo list because this is an informational request with no actual tasks to complete. The user is simply asking for advice and explanation, not for the assistant to perform multiple steps or activities.\n</reasoning>\n</example>\n\n<example>\nUser: Can you add a comment to the calculateTotal function to explain what it does?\nAssistant: Sure, let me add a comment to the calculateTotal function to explain what it does.\n* Uses the Edit tool to add a comment to the calculateTotal function *\n\n<reasoning>\nThe assistant did not use the todo list because this is a single, straightforward task confined to one location. Adding a comment doesn't require tracking multiple steps or systematic organization.\n</reasoning>\n</example>\n\n<example>\nUser: What time is it in Tokyo right now?\nAssistant: I'll check the current time in Tokyo for you.\n\n*Searches for current time in Tokyo*\n\nThe current time in Tokyo, Japan is [current time]. Tokyo is in the Japan Standard Time (JST) zone, which is UTC+9.\n\n<reasoning>\nThe assistant did not use the todo list because this is a single information lookup with immediate results. There are no multiple steps to track or organize, making the todo list unnecessary for this straightforward request.\n</reasoning>\n</example>\n\n## Task States and Management\n\n1. **Task States**: Use these states to track progress:\n - pending: Task not yet started\n - in_progress: Currently working on (limit to ONE task at a time)\n - completed: Task finished successfully\n\n2. **Task Management**:\n - Update task status in real-time as you work\n - Mark tasks complete IMMEDIATELY after finishing (don't batch completions)\n - Only have ONE task in_progress at any time\n - Complete current tasks before starting new ones\n - Remove tasks that are no longer relevant from the list entirely\n\n3. **Task Completion Requirements**:\n - ONLY mark a task as completed when you have FULLY accomplished it\n - If you encounter errors, blockers, or cannot finish, keep the task as in_progress\n - When blocked, create a new task describing what needs to be resolved\n - Never mark a task as completed if:\n - There are unresolved issues or errors\n - Work is partial or incomplete\n - You encountered blockers that prevent completion\n - You couldn't find necessary resources or dependencies\n - Quality standards haven't been met\n\n4. **Task Breakdown**:\n - Create specific, actionable items\n - Break complex tasks into smaller, manageable steps\n - Use clear, descriptive task names\n\nWhen in doubt, use this tool. Being proactive with task management demonstrates attentiveness and ensures you complete all requirements successfully.\"\"\"\n\nTASK_DESCRIPTION_PREFIX = \"\"\"Launch a new agent to handle complex, multi-step tasks autonomously. \n\nAvailable agent types and the tools they have access to:\n- general-purpose: General-purpose agent for researching complex questions, searching for files and content, and executing multi-step tasks. When you are searching for a keyword or file and are not confident that you will find the right match in the first few tries use this agent to perform the search for you. (Tools: *)\n{other_agents}\n\"\"\"\n\nTASK_DESCRIPTION_SUFFIX = \"\"\"When using the Task tool, you must specify a subagent_type parameter to select which agent type to use.\n\nWhen to use the Agent tool:\n- When you are instructed to execute custom slash commands. Use the Agent tool with the slash command invocation as the entire prompt. The slash command can take arguments. For example: Task(description=\"Check the file\", prompt=\"/check-file path/to/file.py\")\n\nWhen NOT to use the Agent tool:\n- If you want to read a specific file path, use the Read or Glob tool instead of the Agent tool, to find the match more quickly\n- If you are searching for a specific term or definition within a known location, use the Glob tool instead, to find the match more quickly\n- If you are searching for content within a specific file or set of 2-3 files, use the Read tool instead of the Agent tool, to find the match more quickly\n- Other tasks that are not related to the agent descriptions above\n\n\nUsage notes:\n1. Launch multiple agents concurrently whenever possible, to maximize performance; to do that, use a single message with multiple tool uses\n2. When the agent is done, it will return a single message back to you. The result returned by the agent is not visible to the user. To show the user the result, you should send a text message back to the user with a concise summary of the result.\n3. Each agent invocation is stateless. You will not be able to send additional messages to the agent, nor will the agent be able to communicate with you outside of its final report. Therefore, your prompt should contain a highly detailed task description for the agent to perform autonomously and you should specify exactly what information the agent should return back to you in its final and only message to you.\n4. The agent's outputs should generally be trusted\n5. Clearly tell the agent whether you expect it to create content, perform analysis, or just do research (search, file reads, web fetches, etc.), since it is not aware of the user's intent\n6. If the agent description mentions that it should be used proactively, then you should try your best to use it without the user having to ask for it first. Use your judgement.\n\nExample usage:\n\n<example_agent_descriptions>\n\"content-reviewer\": use this agent after you are done creating significant content or documents\n\"greeting-responder\": use this agent when to respond to user greetings with a friendly joke\n\"research-analyst\": use this agent to conduct thorough research on complex topics\n</example_agent_description>\n\n<example>\nuser: \"Please write a function that checks if a number is prime\"\nassistant: Sure let me write a function that checks if a number is prime\nassistant: First let me use the Write tool to write a function that checks if a number is prime\nassistant: I'm going to use the Write tool to write the following code:\n<code>\nfunction isPrime(n) {\n if (n <= 1) return false\n for (let i = 2; i * i <= n; i++) {\n if (n % i === 0) return false\n }\n return true\n}\n</code>\n<commentary>\nSince significant content was created and the task was completed, now use the content-reviewer agent to review the work\n</commentary>\nassistant: Now let me use the content-reviewer agent to review the code\nassistant: Uses the Task tool to launch with the content-reviewer agent \n</example>\n\n<example>\nuser: \"Can you help me research the environmental impact of different renewable energy sources and create a comprehensive report?\"\n<commentary>\nThis is a complex research task that would benefit from using the research-analyst agent to conduct thorough analysis\n</commentary>\nassistant: I'll help you research the environmental impact of renewable energy sources. Let me use the research-analyst agent to conduct comprehensive research on this topic.\nassistant: Uses the Task tool to launch with the research-analyst agent, providing detailed instructions about what research to conduct and what format the report should take\n</example>\n\n<example>\nuser: \"Hello\"\n<commentary>\nSince the user is greeting, use the greeting-responder agent to respond with a friendly joke\n</commentary>\nassistant: \"I'm going to use the Task tool to launch with the greeting-responder agent\"\n</example>\"\"\"\nEDIT_DESCRIPTION = \"\"\"Performs exact string replacements in files. \n\nUsage:\n- You must use your `Read` tool at least once in the conversation before editing. This tool will error if you attempt an edit without reading the file. \n- When editing text from Read tool output, ensure you preserve the exact indentation (tabs/spaces) as it appears AFTER the line number prefix. The line number prefix format is: spaces + line number + tab. Everything after that tab is the actual file content to match. Never include any part of the line number prefix in the old_string or new_string.\n- ALWAYS prefer editing existing files. NEVER write new files unless explicitly required.\n- Only use emojis if the user explicitly requests it. Avoid adding emojis to files unless asked.\n- The edit will FAIL if `old_string` is not unique in the file. Either provide a larger string with more surrounding context to make it unique or use `replace_all` to change every instance of `old_string`. \n- Use `replace_all` for replacing and renaming strings across the file. This parameter is useful if you want to rename a variable for instance.\"\"\"\nTOOL_DESCRIPTION = \"\"\"Reads a file from the local filesystem. You can access any file directly by using this tool.\nAssume this tool is able to read all files on the machine. If the User provides a path to a file assume that path is valid. It is okay to read a file that does not exist; an error will be returned.\n\nUsage:\n- The file_path parameter must be an absolute path, not a relative path\n- By default, it reads up to 2000 lines starting from the beginning of the file\n- You can optionally specify a line offset and limit (especially handy for long files), but it's recommended to read the whole file by not providing these parameters\n- Any lines longer than 2000 characters will be truncated\n- Results are returned using cat -n format, with line numbers starting at 1\n- You have the capability to call multiple tools in a single response. It is always better to speculatively read multiple files as a batch that are potentially useful. \n- If you read a file that exists but has empty contents you will receive a system reminder warning in place of file contents.\"\"\"\n\nstate.py\nfrom langgraph.prebuilt.chat_agent_executor import AgentState\nfrom typing import NotRequired, Annotated\nfrom typing import Literal\nfrom typing_extensions import TypedDict\n\n\nclass Todo(TypedDict):\n \"\"\"Todo to track.\"\"\"\n\n content: str\n status: Literal[\"pending\", \"in_progress\", \"completed\"]\n\n\ndef file_reducer(l, r):\n if l is None:\n return r\n elif r is None:\n return l\n else:\n return {**l, **r}\n\n\nclass DeepAgentState(AgentState):\n todos: NotRequired[list[Todo]]\n files: Annotated[NotRequired[dict[str, str]], file_reducer]\n\nsub_agent.py\n\nfrom deepagents.prompts import TASK_DESCRIPTION_PREFIX, TASK_DESCRIPTION_SUFFIX\nfrom deepagents.state import DeepAgentState\nfrom langgraph.prebuilt import create_react_agent\nfrom langchain_core.tools import BaseTool\nfrom typing import TypedDict\nfrom langchain_core.tools import tool, InjectedToolCallId\nfrom langchain_core.messages import ToolMessage\nfrom typing import Annotated, NotRequired\nfrom langgraph.types import Command\n\nfrom langgraph.prebuilt import InjectedState\n\n\nclass SubAgent(TypedDict):\n name: str\n description: str\n prompt: str\n tools: NotRequired[list[str]]\n\n\ndef _create_task_tool(tools, instructions, subagents: list[SubAgent], model, state_schema):\n agents = {\n \"general-purpose\": create_react_agent(model, prompt=instructions, tools=tools)\n }\n tools_by_name = {}\n for tool_ in tools:\n if not isinstance(tool_, BaseTool):\n tool_ = tool(tool_)\n tools_by_name[tool_.name] = tool_\n for _agent in subagents:\n if \"tools\" in _agent:\n _tools = [tools_by_name[t] for t in _agent[\"tools\"]]\n else:\n _tools = tools\n agents[_agent[\"name\"]] = create_react_agent(\n model, prompt=_agent[\"prompt\"], tools=_tools, state_schema=state_schema\n )\n\n other_agents_string = [\n f\"- {_agent['name']}: {_agent['description']}\" for _agent in subagents\n ]\n\n @tool(\n description=TASK_DESCRIPTION_PREFIX.format(other_agents=other_agents_string)\n + TASK_DESCRIPTION_SUFFIX\n )\n def task(\n description: str,\n subagent_type: str,\n state: Annotated[DeepAgentState, InjectedState],\n tool_call_id: Annotated[str, InjectedToolCallId],\n ):\n if subagent_type not in agents:\n return f\"Error: invoked agent of type {subagent_type}, the only allowed types are {[f'`{k}`' for k in agents]}\"\n sub_agent = agents[subagent_type]\n state[\"messages\"] = [{\"role\": \"user\", \"content\": description}]\n result = sub_agent.invoke(state)\n return Command(\n update={\n \"files\": result.get(\"files\", {}),\n \"messages\": [\n ToolMessage(\n result[\"messages\"][-1].content, tool_call_id=tool_call_id\n )\n ],\n }\n )\n\n return task\n\ntools.py\n\nfrom langchain_core.tools import tool, InjectedToolCallId\nfrom langgraph.types import Command\nfrom langchain_core.messages import ToolMessage\nfrom typing import Annotated\nfrom langgraph.prebuilt import InjectedState\n\nfrom deepagents.prompts import (\n WRITE_TODOS_DESCRIPTION,\n EDIT_DESCRIPTION,\n TOOL_DESCRIPTION,\n)\nfrom deepagents.state import Todo, DeepAgentState\n\n\n@tool(description=WRITE_TODOS_DESCRIPTION)\ndef write_todos(\n todos: list[Todo], tool_call_id: Annotated[str, InjectedToolCallId]\n) -> Command:\n return Command(\n update={\n \"todos\": todos,\n \"messages\": [\n ToolMessage(f\"Updated todo list to {todos}\", tool_call_id=tool_call_id)\n ],\n }\n )\n\n\ndef ls(state: Annotated[DeepAgentState, InjectedState]) -> list[str]:\n \"\"\"List all files\"\"\"\n return list(state.get(\"files\", {}).keys())\n\n\n@tool(description=TOOL_DESCRIPTION)\ndef read_file(\n file_path: str,\n state: Annotated[DeepAgentState, InjectedState],\n offset: int = 0,\n limit: int = 2000,\n) -> str:\n \"\"\"Read file.\"\"\"\n mock_filesystem = state.get(\"files\", {})\n if file_path not in mock_filesystem:\n return f\"Error: File '{file_path}' not found\"\n\n # Get file content\n content = mock_filesystem[file_path]\n\n # Handle empty file\n if not content or content.strip() == \"\":\n return \"System reminder: File exists but has empty contents\"\n\n # Split content into lines\n lines = content.splitlines()\n\n # Apply line offset and limit\n start_idx = offset\n end_idx = min(start_idx + limit, len(lines))\n\n # Handle case where offset is beyond file length\n if start_idx >= len(lines):\n return f\"Error: Line offset {offset} exceeds file length ({len(lines)} lines)\"\n\n # Format output with line numbers (cat -n format)\n result_lines = []\n for i in range(start_idx, end_idx):\n line_content = lines[i]\n\n # Truncate lines longer than 2000 characters\n if len(line_content) > 2000:\n line_content = line_content[:2000]\n\n # Line numbers start at 1, so add 1 to the index\n line_number = i + 1\n result_lines.append(f\"{line_number:6d}\\t{line_content}\")\n\n return \"\\n\".join(result_lines)\n\n\ndef write_file(\n file_path: str,\n content: str,\n state: Annotated[DeepAgentState, InjectedState],\n tool_call_id: Annotated[str, InjectedToolCallId],\n) -> Command:\n \"\"\"Write to a file.\"\"\"\n files = state.get(\"files\", {})\n files[file_path] = content\n return Command(\n update={\n \"files\": files,\n \"messages\": [\n ToolMessage(f\"Updated file {file_path}\", tool_call_id=tool_call_id)\n ],\n }\n )\n\n\n@tool(description=EDIT_DESCRIPTION)\ndef edit_file(\n file_path: str,\n old_string: str,\n new_string: str,\n state: Annotated[DeepAgentState, InjectedState],\n tool_call_id: Annotated[str, InjectedToolCallId],\n replace_all: bool = False,\n) -> str:\n \"\"\"Write to a file.\"\"\"\n mock_filesystem = state.get(\"files\", {})\n # Check if file exists in mock filesystem\n if file_path not in mock_filesystem:\n return f\"Error: File '{file_path}' not found\"\n\n # Get current file content\n content = mock_filesystem[file_path]\n\n # Check if old_string exists in the file\n if old_string not in content:\n return f\"Error: String not found in file: '{old_string}'\"\n\n # If not replace_all, check for uniqueness\n if not replace_all:\n occurrences = content.count(old_string)\n if occurrences > 1:\n return f\"Error: String '{old_string}' appears {occurrences} times in file. Use replace_all=True to replace all instances, or provide a more specific string with surrounding context.\"\n elif occurrences == 0:\n return f\"Error: String not found in file: '{old_string}'\"\n\n # Perform the replacement\n if replace_all:\n new_content = content.replace(old_string, new_string)\n replacement_count = content.count(old_string)\n result_msg = f\"Successfully replaced {replacement_count} instance(s) of the string in '{file_path}'\"\n else:\n new_content = content.replace(\n old_string, new_string, 1\n ) # Replace only first occurrence\n result_msg = f\"Successfully replaced string in '{file_path}'\"\n\n # Update the mock filesystem\n mock_filesystem[file_path] = new_content\n return Command(\n update={\n \"files\": mock_filesystem,\n \"messages\": [\n ToolMessage(f\"Updated file {file_path}\", tool_call_id=tool_call_id)\n ],\n }\n )", "title": "Create TypeScript Implementation of Deep Agents with 1:1 Python Mapping", "createdAt": 1754326377374, "completed": false, "planRevisions": [ { "revisionIndex": 0, "plans": [ { "index": 0, "plan": "**Set up project structure and dependencies** - Create `package.json` with required LangChain packages (`@langchain/core`, `@langchain/langgraph`, `@langchain/langgraph-sdk`, `@langchain/anthropic`, `zod` for validation), create `tsconfig.json` with proper TypeScript configuration, and set up `src/` directory structure matching the Python module organization.", "completed": true, "summary": "**Set up project structure and dependencies - COMPLETED**\n\nSuccessfully established the foundational TypeScript project structure for the Deep Agents implementation:\n\n### Key Accomplishments:\n- **Created `package.json`** with all required dependencies:\n - `@langchain/core` (^0.3.66) - Core LangChain abstractions\n - `@langchain/langgraph` (^0.4.2) - Main LangGraph library \n - `@langchain/langgraph-sdk` (^0.0.105) - LangGraph SDK for cloud/platform integration\n - `@langchain/anthropic` (^0.3.25) - Anthropic model integration\n - `zod` (^3.23.8) - Schema validation library\n - TypeScript and Node.js type definitions as dev dependencies\n\n- **Created `tsconfig.json`** with optimal TypeScript configuration:\n - Target ES2022 with CommonJS modules for Node.js compatibility\n - Strict type checking enabled for maximum type safety\n - Declaration files and source maps generation\n - Proper module resolution and decorator support\n - Output directory structure (`src/` → `dist/`)\n\n- **Established `src/` directory structure** to mirror Python module organization\n- **Successfully installed all dependencies** (42 packages) with zero vulnerabilities\n\n### Project Structure:\n```\ndeepagentsjs/\n├── package.json\n├── tsconfig.json\n├── src/ (ready for implementation files)\n└── node_modules/ (dependencies installed)\n```\n\nThe project is now ready for implementing the TypeScript type definitions and core functionality, maintaining 1:1 compatibility with the Python Deep Agents implementation." }, { "index": 1, "plan": "**Implement TypeScript type definitions in `src/types.ts`** - Define core interfaces including `SubAgent` interface (with `name`, `description`, `prompt`, and optional `tools` properties), `Todo` interface with `content` and `status` literal types, and generic type utilities for state schema management that mirror the Python `TypeVar` and `Type` patterns.", "completed": true, "summary": "Implemented TypeScript type definitions in `src/types.ts` as required. The file now includes:\n- `Todo` interface (with `content` and `status` literal types)\n- `SubAgent` interface (with `name`, `description`, `prompt`, and optional `tools` properties)\n- Type utilities for state schema management, including generic constraints, type utilities for state schemas, reducers, and command patterns\n- All types and interfaces mirror the Python TypeVar, Type, and TypedDict patterns for 1:1 compatibility\n\nThis provides a strong type foundation for the rest of the Deep Agents TypeScript implementation." }, { "index": 2, "plan": "**Create state management system in `src/state.ts`** - Implement `DeepAgentState` using LangGraph's `Annotation.Root()` pattern with `todos` array and `files` dictionary channels, create file reducer function that merges file objects (equivalent to Python's `file_reducer`), and define proper TypeScript types that extend the base agent state pattern.", "completed": true, "summary": "**Create state management system in `src/state.ts` - COMPLETED**\n\nSuccessfully implemented the state management system using LangGraph's `Annotation.Root()` pattern with 1:1 Python compatibility:\n\n### Key Accomplishments:\n- **Implemented `DeepAgentState`** using LangGraph's `Annotation.Root()` pattern with three channels:\n - `messages`: BaseMessage[] with concat reducer (inherited from AgentState pattern)\n - `todos`: Todo[] with replacement reducer matching Python behavior\n - `files`: Record<string, string> with custom file reducer\n\n- **Created `fileReducer` function** that exactly mirrors Python's `file_reducer`:\n - Handles null/undefined cases properly\n - Merges file objects using spread operator\n - Maintains exact same logic as Python implementation\n\n- **Defined proper TypeScript types**:\n - `DeepAgentStateType` - Type alias for the state\n - `DeepAgentStateInterface` - Interface extending base agent state pattern\n - Utility functions for initialization, type guards, and state merging\n\n- **Added comprehensive type safety**:\n - `createInitialDeepAgentState()` - Factory for initial state\n - `isDeepAgentState()` - Runtime type guard\n - `mergeDeepAgentState()` - State merging utility\n\n### State Structure:\n```typescript\nDeepAgentState = Annotation.Root({\n messages: BaseMessage[] (with concat reducer),\n todos: Todo[] (with replacement reducer),\n files: Record<string, string> (with fileReducer)\n})\n```\n\nThe implementation provides full type safety while maintaining exact behavioral compatibility with the Python version's state management system." }, { "index": 3, "plan": "**Implement model configuration in `src/model.ts`** - Create `getDefaultModel()` function that returns a configured `ChatAnthropic` instance with model name `claude-sonnet-4-20250514` and `maxTokens: 64000`, matching the exact Python configuration, and export proper TypeScript types for model interfaces.", "completed": true, "summary": "**Implement model configuration in `src/model.ts` - COMPLETED**\n\nSuccessfully implemented the model configuration system with exact 1:1 Python compatibility:\n\n### Key Accomplishments:\n- **Created `getDefaultModel()` function** that returns a configured `ChatAnthropic` instance with:\n - Model name: `claude-sonnet-4-20250514` (exact match to Python)\n - MaxTokens: 64000 (exact match to Python)\n - Proper TypeScript typing\n\n- **Exported proper TypeScript types** including:\n - `DefaultModelType` - Type alias for ChatAnthropic\n - `ModelConfig` - Interface for model configuration options\n - `LanguageModelLike` - Union type for flexible model parameters\n\n- **Added utility functions** for enhanced functionality:\n - `createAnthropicModel()` - Factory with custom configuration\n - `resolveModel()` - Utility to resolve LanguageModelLike to concrete instances\n - `isChatAnthropic()` and `isLanguageModel()` - Type guards for runtime checking\n\n- **Included model constants** - `MODEL_NAMES` object with commonly used model identifiers\n\n### Core Implementation:\n```typescript\nexport function getDefaultModel(): ChatAnthropic {\n return new ChatAnthropic({\n model: \"claude-sonnet-4-20250514\",\n maxTokens: 64000,\n });\n}\n```\n\nThe implementation provides exact behavioral compatibility with Python's `get_default_model()` while adding TypeScript-specific enhancements for type safety and developer experience." }, { "index": 4, "plan": "**Create prompt templates in `src/prompts.ts`** - Export all prompt constants as TypeScript string literals: `WRITE_TODOS_DESCRIPTION`, `TASK_DESCRIPTION_PREFIX`, `TASK_DESCRIPTION_SUFFIX`, `EDIT_DESCRIPTION`, and `TOOL_DESCRIPTION`, copying the exact text content from the Python version to maintain 1:1 functionality.", "completed": true, "summary": "Created `src/prompts.ts` and exported all required prompt constants as TypeScript string literals:\n- `WRITE_TODOS_DESCRIPTION`\n- `TASK_DESCRIPTION_PREFIX`\n- `TASK_DESCRIPTION_SUFFIX`\n- `EDIT_DESCRIPTION`\n- `TOOL_DESCRIPTION`\n\nAll prompt text was copied verbatim from the Python version to maintain 1:1 functionality. The file is ready for use in subsequent implementation steps." }, { "index": 5, "plan": "**Implement core tools in `src/tools.ts`** - Create `writeTodos`, `readFile`, `writeFile`, `editFile`, and `ls` tools using LangGraph's `tool()` function with Zod schemas for validation, implement state injection patterns using LangGraph's state management, ensure each tool returns proper `Command` objects for state updates, and maintain exact same functionality as Python versions including error handling and file system simulation.", "completed": false }, { "index": 6, "plan": "**Build sub-agent system in `src/sub-agent.ts`** - Implement `_createTaskTool` function that creates dynamic task delegation tool, build agent registry system that maps agent names to `createReactAgent` instances, create the main `task` tool that handles sub-agent invocation with proper state management and tool filtering, and ensure proper TypeScript typing throughout the sub-agent creation process.", "completed": false }, { "index": 7, "plan": "**Create main graph factory in `src/graph.ts`** - Implement `createDeepAgent` function with exact same signature as Python version (tools, instructions, model, subagents, stateSchema parameters), combine built-in tools with user-provided tools, create task tool using sub-agent system, use `createReactAgent` from LangGraph prebuilt with proper prompt construction, and ensure proper TypeScript generics for state schema handling.", "completed": false }, { "index": 8, "plan": "**Add index file and exports in `src/index.ts`** - Export all public APIs including `createDeepAgent`, `DeepAgentState`, `SubAgent` interface, `getDefaultModel`, and all tool functions, ensuring the TypeScript module provides the same public interface as the Python package for seamless migration.", "completed": false } ], "createdAt": 1754326377374, "createdBy": "agent" }, { "revisionIndex": 1, "plans": [ { "index": 0, "plan": "**Set up project structure and dependencies** - Create `package.json` with required LangChain packages (`@langchain/core`, `@langchain/langgraph`, `@langchain/langgraph-sdk`, `@langchain/anthropic`, `zod` for validation), create `tsconfig.json` with proper TypeScript configuration, and set up `src/` directory structure matching the Python module organization.", "completed": true, "summary": "**Set up project structure and dependencies - COMPLETED**\n\nSuccessfully established the foundational TypeScript project structure for the Deep Agents implementation:\n\n### Key Accomplishments:\n- **Created `package.json`** with all required dependencies:\n - `@langchain/core` (^0.3.66) - Core LangChain abstractions\n - `@langchain/langgraph` (^0.4.2) - Main LangGraph library \n - `@langchain/langgraph-sdk` (^0.0.105) - LangGraph SDK for cloud/platform integration\n - `@langchain/anthropic` (^0.3.25) - Anthropic model integration\n - `zod` (^3.23.8) - Schema validation library\n - TypeScript and Node.js type definitions as dev dependencies\n\n- **Created `tsconfig.json`** with optimal TypeScript configuration:\n - Target ES2022 with CommonJS modules for Node.js compatibility\n - Strict type checking enabled for maximum type safety\n - Declaration files and source maps generation\n - Proper module resolution and decorator support\n - Output directory structure (`src/` → `dist/`)\n\n- **Established `src/` directory structure** to mirror Python module organization\n- **Successfully installed all dependencies** (42 packages) with zero vulnerabilities\n\n### Project Structure:\n```\ndeepagentsjs/\n├── package.json\n├── tsconfig.json\n├── src/ (ready for implementation files)\n└── node_modules/ (dependencies installed)\n```\n\nThe project is now ready for implementing the TypeScript type definitions and core functionality, maintaining 1:1 compatibility with the Python Deep Agents implementation." }, { "index": 1, "plan": "**Implement TypeScript type definitions in `src/types.ts`** - Define core interfaces including `SubAgent` interface (with `name`, `description`, `prompt`, and optional `tools` properties), `Todo` interface with `content` and `status` literal types, and generic type utilities for state schema management that mirror the Python `TypeVar` and `Type` patterns.", "completed": true, "summary": "Implemented TypeScript type definitions in `src/types.ts` as required. The file now includes:\n- `Todo` interface (with `content` and `status` literal types)\n- `SubAgent` interface (with `name`, `description`, `prompt`, and optional `tools` properties)\n- Type utilities for state schema management, including generic constraints, type utilities for state schemas, reducers, and command patterns\n- All types and interfaces mirror the Python TypeVar, Type, and TypedDict patterns for 1:1 compatibility\n\nThis provides a strong type foundation for the rest of the Deep Agents TypeScript implementation." }, { "index": 2, "plan": "**Create state management system in `src/state.ts`** - Implement `DeepAgentState` using LangGraph's `Annotation.Root()` pattern with `todos` array and `files` dictionary channels, create file reducer function that merges file objects (equivalent to Python's `file_reducer`), and define proper TypeScript types that extend the base agent state pattern.", "completed": true, "summary": "**Create state management system in `src/state.ts` - COMPLETED**\n\nSuccessfully implemented the state management system using LangGraph's `Annotation.Root()` pattern with 1:1 Python compatibility:\n\n### Key Accomplishments:\n- **Implemented `DeepAgentState`** using LangGraph's `Annotation.Root()` pattern with three channels:\n - `messages`: BaseMessage[] with concat reducer (inherited from AgentState pattern)\n - `todos`: Todo[] with replacement reducer matching Python behavior\n - `files`: Record<string, string> with custom file reducer\n\n- **Created `fileReducer` function** that exactly mirrors Python's `file_reducer`:\n - Handles null/undefined cases properly\n - Merges file objects using spread operator\n - Maintains exact same logic as Python implementation\n\n- **Defined proper TypeScript types**:\n - `DeepAgentStateType` - Type alias for the state\n - `DeepAgentStateInterface` - Interface extending base agent state pattern\n - Utility functions for initialization, type guards, and state merging\n\n- **Added comprehensive type safety**:\n - `createInitialDeepAgentState()` - Factory for initial state\n - `isDeepAgentState()` - Runtime type guard\n - `mergeDeepAgentState()` - State merging utility\n\n### State Structure:\n```typescript\nDeepAgentState = Annotation.Root({\n messages: BaseMessage[] (with concat reducer),\n todos: Todo[] (with replacement reducer),\n files: Record<string, string> (with fileReducer)\n})\n```\n\nThe implementation provides full type safety while maintaining exact behavioral compatibility with the Python version's state management system." }, { "index": 3, "plan": "**Implement model configuration in `src/model.ts`** - Create `getDefaultModel()` function that returns a configured `ChatAnthropic` instance with model name `claude-sonnet-4-20250514` and `maxTokens: 64000`, matching the exact Python configuration, and export proper TypeScript types for model interfaces.", "completed": true, "summary": "**Implement model configuration in `src/model.ts` - COMPLETED**\n\nSuccessfully implemented the model configuration system with exact 1:1 Python compatibility:\n\n### Key Accomplishments:\n- **Created `getDefaultModel()` function** that returns a configured `ChatAnthropic` instance with:\n - Model name: `claude-sonnet-4-20250514` (exact match to Python)\n - MaxTokens: 64000 (exact match to Python)\n - Proper TypeScript typing\n\n- **Exported proper TypeScript types** including:\n - `DefaultModelType` - Type alias for ChatAnthropic\n - `ModelConfig` - Interface for model configuration options\n - `LanguageModelLike` - Union type for flexible model parameters\n\n- **Added utility functions** for enhanced functionality:\n - `createAnthropicModel()` - Factory with custom configuration\n - `resolveModel()` - Utility to resolve LanguageModelLike to concrete instances\n - `isChatAnthropic()` and `isLanguageModel()` - Type guards for runtime checking\n\n- **Included model constants** - `MODEL_NAMES` object with commonly used model identifiers\n\n### Core Implementation:\n```typescript\nexport function getDefaultModel(): ChatAnthropic {\n return new ChatAnthropic({\n model: \"claude-sonnet-4-20250514\",\n maxTokens: 64000,\n });\n}\n```\n\nThe implementation provides exact behavioral compatibility with Python's `get_default_model()` while adding TypeScript-specific enhancements for type safety and developer experience." }, { "index": 4, "plan": "**Create prompt templates in `src/prompts.ts`** - Export all prompt constants as TypeScript string literals: `WRITE_TODOS_DESCRIPTION`, `TASK_DESCRIPTION_PREFIX`, `TASK_DESCRIPTION_SUFFIX`, `EDIT_DESCRIPTION`, and `TOOL_DESCRIPTION`, copying the exact text content from the Python version to maintain 1:1 functionality.", "completed": true, "summary": "Created `src/prompts.ts` and exported all required prompt constants as TypeScript string literals:\n- `WRITE_TODOS_DESCRIPTION`\n- `TASK_DESCRIPTION_PREFIX`\n- `TASK_DESCRIPTION_SUFFIX`\n- `EDIT_DESCRIPTION`\n- `TOOL_DESCRIPTION`\n\nAll prompt text was copied verbatim from the Python version to maintain 1:1 functionality. The file is ready for use in subsequent implementation steps." }, { "index": 5, "plan": "Fix `src/prompts.ts`: wrap multi-line strings in back-ticked template literals (or split them) so they are valid TypeScript and compile without errors.", "completed": true, "summary": "**Fix `src/prompts.ts`: wrap multi-line strings in back-ticked template literals (or split them) so they are valid TypeScript and compile without errors - COMPLETED**\n\nSuccessfully resolved all TypeScript compilation errors in the prompts file:\n\n### Key Accomplishments:\n- **Fixed template literal syntax issues** - Recreated `src/prompts.ts` with properly escaped backticks to resolve TS1005, TS1443, and TS1160 compilation errors\n- **Preserved exact prompt content** - Maintained verbatim text from Python version while ensuring TypeScript compatibility\n- **Resolved import issues** - Fixed `BaseTool` import in `src/types.ts` by updating to `StructuredTool` from `@langchain/core/tools`\n- **Verified successful compilation** - Confirmed `npm run build` now completes with zero TypeScript errors\n\n### Technical Details:\n- **Problem**: Template literals containing unescaped backticks (`) were causing TypeScript to interpret them as nested template literals\n- **Solution**: Recreated the file with properly escaped backticks (\\`) in template literal strings\n- **Validation**: Build now succeeds completely with no compilation errors\n\n### Files Fixed:\n- `src/prompts.ts` - All prompt constants now compile correctly\n- `src/types.ts` - Updated import to use correct LangChain export\n\nThe project now has a solid foundation with all core configuration files compiling successfully, ready for implementing the remaining tools and functionality." }, { "index": 6, "plan": "Implement `src/tools.ts` replicating Python `tools.py` functionality (writeTodos, ls, readFile, writeFile, editFile) using LangGraph’s `tool()` helper and correct `Command` return types.", "completed": false }, { "index": 7, "plan": "Implement `src/sub-agent.ts` with `_createTaskTool`, sub-agent registry, and the `task` tool, using strict TypeScript typing and LangGraph APIs.", "completed": false }, { "index": 8, "plan": "Implement `src/graph.ts` containing `createDeepAgent` that assembles built-in tools with user tools, constructs the prompt, creates the task tool, and returns a `createReactAgent` instance, mirroring Python logic.", "completed": false }, { "index": 9, "plan": "Create `src/index.ts` that re-exports public APIs (`createDeepAgent`, `DeepAgentState`, `SubAgent`, `getDefaultModel`, tool functions, etc.).", "completed": false }, { "index": 10, "plan": "After implementing the above, run `npm run build` and ensure the TypeScript compiler reports zero errors.", "completed": false }, { "index": 11, "plan": "(Optional but recommended) Add basic unit tests or an example to demonstrate usage and verify runtime behaviour.", "completed": false } ], "createdAt": 1754327189505, "createdBy": "agent" } ], "activeRevisionIndex": 1, "pullRequestNumber": 3 } ], "activeTaskIndex": 0 } </open-swe-do-not-edit-task-plan> <open-swe-do-not-edit-proposed-plan> [ "**Set up project structure and dependencies** - Create `package.json` with required LangChain packages (`@langchain/core`, `@langchain/langgraph`, `@langchain/langgraph-sdk`, `@langchain/anthropic`, `zod` for validation), create `tsconfig.json` with proper TypeScript configuration, and set up `src/` directory structure matching the Python module organization.", "**Implement TypeScript type definitions in `src/types.ts`** - Define core interfaces including `SubAgent` interface (with `name`, `description`, `prompt`, and optional `tools` properties), `Todo` interface with `content` and `status` literal types, and generic type utilities for state schema management that mirror the Python `TypeVar` and `Type` patterns.", "**Create state management system in `src/state.ts`** - Implement `DeepAgentState` using LangGraph's `Annotation.Root()` pattern with `todos` array and `files` dictionary channels, create file reducer function that merges file objects (equivalent to Python's `file_reducer`), and define proper TypeScript types that extend the base agent state pattern.", "**Implement model configuration in `src/model.ts`** - Create `getDefaultModel()` function that returns a configured `ChatAnthropic` instance with model name `claude-sonnet-4-20250514` and `maxTokens: 64000`, matching the exact Python configuration, and export proper TypeScript types for model interfaces.", "**Create prompt templates in `src/prompts.ts`** - Export all prompt constants as TypeScript string literals: `WRITE_TODOS_DESCRIPTION`, `TASK_DESCRIPTION_PREFIX`, `TASK_DESCRIPTION_SUFFIX`, `EDIT_DESCRIPTION`, and `TOOL_DESCRIPTION`, copying the exact text content from the Python version to maintain 1:1 functionality.", "**Implement core tools in `src/tools.ts`** - Create `writeTodos`, `readFile`, `writeFile`, `editFile`, and `ls` tools using LangGraph's `tool()` function with Zod schemas for validation, implement state injection patterns using LangGraph's state management, ensure each tool returns proper `Command` objects for state updates, and maintain exact same functionality as Python versions including error handling and file system simulation.", "**Build sub-agent system in `src/sub-agent.ts`** - Implement `_createTaskTool` function that creates dynamic task delegation tool, build agent registry system that maps agent names to `createReactAgent` instances, create the main `task` tool that handles sub-agent invocation with proper state management and tool filtering, and ensure proper TypeScript typing throughout the sub-agent creation process.", "**Create main graph factory in `src/graph.ts`** - Implement `createDeepAgent` function with exact same signature as Python version (tools, instructions, model, subagents, stateSchema parameters), combine built-in tools with user-provided tools, create task tool using sub-agent system, use `createReactAgent` from LangGraph prebuilt with proper prompt construction, and ensure proper TypeScript generics for state schema handling.", "**Add index file and exports in `src/index.ts`** - Export all public APIs including `createDeepAgent`, `DeepAgentState`, `SubAgent` interface, `getDefaultModel`, and all tool functions, ensuring the TypeScript module provides the same public interface as the Python package for seamless migration." ] </open-swe-do-not-edit-proposed-plan> </details> </details>
yindo closed this issue 2026-06-05 17:20:52 -04:00
Author
Owner

@Palashio commented on GitHub (Aug 4, 2025):

we can use "@langchain/langgraph-sdk": by the way

<!-- gh-comment-id:3151534761 --> @Palashio commented on GitHub (Aug 4, 2025): we can use "@langchain/langgraph-sdk": by the way
Author
Owner

@open-swe[bot] commented on GitHub (Aug 4, 2025):

🟠 Plan Ready for Approval 🟠

I've generated a plan for this issue and it's ready for your review.

Plan: Create TypeScript Implementation of Deep Agents with 1:1 Python Mapping

  • Task 1:
**Set up project structure and dependencies** - Create `package.json` with required LangChain packages (`@langchain/core`, `@langchain/langgraph`, `@langchain/langgraph-sdk`, `@langchain/anthropic`, `zod` for validation), create `tsconfig.json` with proper TypeScript configuration, and set up `src/` directory structure matching the Python module organization.
  • Task 2:
**Implement TypeScript type definitions in `src/types.ts`** - Define core interfaces including `SubAgent` interface (with `name`, `description`, `prompt`, and optional `tools` properties), `Todo` interface with `content` and `status` literal types, and generic type utilities for state schema management that mirror the Python `TypeVar` and `Type` patterns.
  • Task 3:
**Create state management system in `src/state.ts`** - Implement `DeepAgentState` using LangGraph's `Annotation.Root()` pattern with `todos` array and `files` dictionary channels, create file reducer function that merges file objects (equivalent to Python's `file_reducer`), and define proper TypeScript types that extend the base agent state pattern.
  • Task 4:
**Implement model configuration in `src/model.ts`** - Create `getDefaultModel()` function that returns a configured `ChatAnthropic` instance with model name `claude-sonnet-4-20250514` and `maxTokens: 64000`, matching the exact Python configuration, and export proper TypeScript types for model interfaces.
  • Task 5:
**Create prompt templates in `src/prompts.ts`** - Export all prompt constants as TypeScript string literals: `WRITE_TODOS_DESCRIPTION`, `TASK_DESCRIPTION_PREFIX`, `TASK_DESCRIPTION_SUFFIX`, `EDIT_DESCRIPTION`, and `TOOL_DESCRIPTION`, copying the exact text content from the Python version to maintain 1:1 functionality.
  • Task 6:
**Implement core tools in `src/tools.ts`** - Create `writeTodos`, `readFile`, `writeFile`, `editFile`, and `ls` tools using LangGraph's `tool()` function with Zod schemas for validation, implement state injection patterns using LangGraph's state management, ensure each tool returns proper `Command` objects for state updates, and maintain exact same functionality as Python versions including error handling and file system simulation.
  • Task 7:
**Build sub-agent system in `src/sub-agent.ts`** - Implement `_createTaskTool` function that creates dynamic task delegation tool, build agent registry system that maps agent names to `createReactAgent` instances, create the main `task` tool that handles sub-agent invocation with proper state management and tool filtering, and ensure proper TypeScript typing throughout the sub-agent creation process.
  • Task 8:
**Create main graph factory in `src/graph.ts`** - Implement `createDeepAgent` function with exact same signature as Python version (tools, instructions, model, subagents, stateSchema parameters), combine built-in tools with user-provided tools, create task tool using sub-agent system, use `createReactAgent` from LangGraph prebuilt with proper prompt construction, and ensure proper TypeScript generics for state schema handling.
  • Task 9:
**Add index file and exports in `src/index.ts`** - Export all public APIs including `createDeepAgent`, `DeepAgentState`, `SubAgent` interface, `getDefaultModel`, and all tool functions, ensuring the TypeScript module provides the same public interface as the Python package for seamless migration.

Please review the plan and let me know if you'd like me to proceed, make changes, or if you have any feedback.

Plan Accepted

The proposed plan was accepted.

Plan: Create TypeScript Implementation of Deep Agents with 1:1 Python Mapping

  • Task 1:
**Set up project structure and dependencies** - Create `package.json` with required LangChain packages (`@langchain/core`, `@langchain/langgraph`, `@langchain/langgraph-sdk`, `@langchain/anthropic`, `zod` for validation), create `tsconfig.json` with proper TypeScript configuration, and set up `src/` directory structure matching the Python module organization.
  • Task 2:
**Implement TypeScript type definitions in `src/types.ts`** - Define core interfaces including `SubAgent` interface (with `name`, `description`, `prompt`, and optional `tools` properties), `Todo` interface with `content` and `status` literal types, and generic type utilities for state schema management that mirror the Python `TypeVar` and `Type` patterns.
  • Task 3:
**Create state management system in `src/state.ts`** - Implement `DeepAgentState` using LangGraph's `Annotation.Root()` pattern with `todos` array and `files` dictionary channels, create file reducer function that merges file objects (equivalent to Python's `file_reducer`), and define proper TypeScript types that extend the base agent state pattern.
  • Task 4:
**Implement model configuration in `src/model.ts`** - Create `getDefaultModel()` function that returns a configured `ChatAnthropic` instance with model name `claude-sonnet-4-20250514` and `maxTokens: 64000`, matching the exact Python configuration, and export proper TypeScript types for model interfaces.
  • Task 5:
**Create prompt templates in `src/prompts.ts`** - Export all prompt constants as TypeScript string literals: `WRITE_TODOS_DESCRIPTION`, `TASK_DESCRIPTION_PREFIX`, `TASK_DESCRIPTION_SUFFIX`, `EDIT_DESCRIPTION`, and `TOOL_DESCRIPTION`, copying the exact text content from the Python version to maintain 1:1 functionality.
  • Task 6:
**Implement core tools in `src/tools.ts`** - Create `writeTodos`, `readFile`, `writeFile`, `editFile`, and `ls` tools using LangGraph's `tool()` function with Zod schemas for validation, implement state injection patterns using LangGraph's state management, ensure each tool returns proper `Command` objects for state updates, and maintain exact same functionality as Python versions including error handling and file system simulation.
  • Task 7:
**Build sub-agent system in `src/sub-agent.ts`** - Implement `_createTaskTool` function that creates dynamic task delegation tool, build agent registry system that maps agent names to `createReactAgent` instances, create the main `task` tool that handles sub-agent invocation with proper state management and tool filtering, and ensure proper TypeScript typing throughout the sub-agent creation process.
  • Task 8:
**Create main graph factory in `src/graph.ts`** - Implement `createDeepAgent` function with exact same signature as Python version (tools, instructions, model, subagents, stateSchema parameters), combine built-in tools with user-provided tools, create task tool using sub-agent system, use `createReactAgent` from LangGraph prebuilt with proper prompt construction, and ensure proper TypeScript generics for state schema handling.
  • Task 9:
**Add index file and exports in `src/index.ts`** - Export all public APIs including `createDeepAgent`, `DeepAgentState`, `SubAgent` interface, `getDefaultModel`, and all tool functions, ensuring the TypeScript module provides the same public interface as the Python package for seamless migration.

Proceeding to implementation...

<!-- gh-comment-id:3151544732 --> @open-swe[bot] commented on GitHub (Aug 4, 2025): ### 🟠 Plan Ready for Approval 🟠 I've generated a plan for this issue and it's ready for your review. **Plan: Create TypeScript Implementation of Deep Agents with 1:1 Python Mapping** - Task 1: ``` **Set up project structure and dependencies** - Create `package.json` with required LangChain packages (`@langchain/core`, `@langchain/langgraph`, `@langchain/langgraph-sdk`, `@langchain/anthropic`, `zod` for validation), create `tsconfig.json` with proper TypeScript configuration, and set up `src/` directory structure matching the Python module organization. ``` - Task 2: ``` **Implement TypeScript type definitions in `src/types.ts`** - Define core interfaces including `SubAgent` interface (with `name`, `description`, `prompt`, and optional `tools` properties), `Todo` interface with `content` and `status` literal types, and generic type utilities for state schema management that mirror the Python `TypeVar` and `Type` patterns. ``` - Task 3: ``` **Create state management system in `src/state.ts`** - Implement `DeepAgentState` using LangGraph's `Annotation.Root()` pattern with `todos` array and `files` dictionary channels, create file reducer function that merges file objects (equivalent to Python's `file_reducer`), and define proper TypeScript types that extend the base agent state pattern. ``` - Task 4: ``` **Implement model configuration in `src/model.ts`** - Create `getDefaultModel()` function that returns a configured `ChatAnthropic` instance with model name `claude-sonnet-4-20250514` and `maxTokens: 64000`, matching the exact Python configuration, and export proper TypeScript types for model interfaces. ``` - Task 5: ``` **Create prompt templates in `src/prompts.ts`** - Export all prompt constants as TypeScript string literals: `WRITE_TODOS_DESCRIPTION`, `TASK_DESCRIPTION_PREFIX`, `TASK_DESCRIPTION_SUFFIX`, `EDIT_DESCRIPTION`, and `TOOL_DESCRIPTION`, copying the exact text content from the Python version to maintain 1:1 functionality. ``` - Task 6: ``` **Implement core tools in `src/tools.ts`** - Create `writeTodos`, `readFile`, `writeFile`, `editFile`, and `ls` tools using LangGraph's `tool()` function with Zod schemas for validation, implement state injection patterns using LangGraph's state management, ensure each tool returns proper `Command` objects for state updates, and maintain exact same functionality as Python versions including error handling and file system simulation. ``` - Task 7: ``` **Build sub-agent system in `src/sub-agent.ts`** - Implement `_createTaskTool` function that creates dynamic task delegation tool, build agent registry system that maps agent names to `createReactAgent` instances, create the main `task` tool that handles sub-agent invocation with proper state management and tool filtering, and ensure proper TypeScript typing throughout the sub-agent creation process. ``` - Task 8: ``` **Create main graph factory in `src/graph.ts`** - Implement `createDeepAgent` function with exact same signature as Python version (tools, instructions, model, subagents, stateSchema parameters), combine built-in tools with user-provided tools, create task tool using sub-agent system, use `createReactAgent` from LangGraph prebuilt with proper prompt construction, and ensure proper TypeScript generics for state schema handling. ``` - Task 9: ``` **Add index file and exports in `src/index.ts`** - Export all public APIs including `createDeepAgent`, `DeepAgentState`, `SubAgent` interface, `getDefaultModel`, and all tool functions, ensuring the TypeScript module provides the same public interface as the Python package for seamless migration. ``` Please review the plan and let me know if you'd like me to proceed, make changes, or if you have any feedback. <open-swe-plan-message> ### ✅ Plan Accepted ✅ The proposed plan was accepted. **Plan: Create TypeScript Implementation of Deep Agents with 1:1 Python Mapping** - Task 1: ``` **Set up project structure and dependencies** - Create `package.json` with required LangChain packages (`@langchain/core`, `@langchain/langgraph`, `@langchain/langgraph-sdk`, `@langchain/anthropic`, `zod` for validation), create `tsconfig.json` with proper TypeScript configuration, and set up `src/` directory structure matching the Python module organization. ``` - Task 2: ``` **Implement TypeScript type definitions in `src/types.ts`** - Define core interfaces including `SubAgent` interface (with `name`, `description`, `prompt`, and optional `tools` properties), `Todo` interface with `content` and `status` literal types, and generic type utilities for state schema management that mirror the Python `TypeVar` and `Type` patterns. ``` - Task 3: ``` **Create state management system in `src/state.ts`** - Implement `DeepAgentState` using LangGraph's `Annotation.Root()` pattern with `todos` array and `files` dictionary channels, create file reducer function that merges file objects (equivalent to Python's `file_reducer`), and define proper TypeScript types that extend the base agent state pattern. ``` - Task 4: ``` **Implement model configuration in `src/model.ts`** - Create `getDefaultModel()` function that returns a configured `ChatAnthropic` instance with model name `claude-sonnet-4-20250514` and `maxTokens: 64000`, matching the exact Python configuration, and export proper TypeScript types for model interfaces. ``` - Task 5: ``` **Create prompt templates in `src/prompts.ts`** - Export all prompt constants as TypeScript string literals: `WRITE_TODOS_DESCRIPTION`, `TASK_DESCRIPTION_PREFIX`, `TASK_DESCRIPTION_SUFFIX`, `EDIT_DESCRIPTION`, and `TOOL_DESCRIPTION`, copying the exact text content from the Python version to maintain 1:1 functionality. ``` - Task 6: ``` **Implement core tools in `src/tools.ts`** - Create `writeTodos`, `readFile`, `writeFile`, `editFile`, and `ls` tools using LangGraph's `tool()` function with Zod schemas for validation, implement state injection patterns using LangGraph's state management, ensure each tool returns proper `Command` objects for state updates, and maintain exact same functionality as Python versions including error handling and file system simulation. ``` - Task 7: ``` **Build sub-agent system in `src/sub-agent.ts`** - Implement `_createTaskTool` function that creates dynamic task delegation tool, build agent registry system that maps agent names to `createReactAgent` instances, create the main `task` tool that handles sub-agent invocation with proper state management and tool filtering, and ensure proper TypeScript typing throughout the sub-agent creation process. ``` - Task 8: ``` **Create main graph factory in `src/graph.ts`** - Implement `createDeepAgent` function with exact same signature as Python version (tools, instructions, model, subagents, stateSchema parameters), combine built-in tools with user-provided tools, create task tool using sub-agent system, use `createReactAgent` from LangGraph prebuilt with proper prompt construction, and ensure proper TypeScript generics for state schema handling. ``` - Task 9: ``` **Add index file and exports in `src/index.ts`** - Export all public APIs including `createDeepAgent`, `DeepAgentState`, `SubAgent` interface, `getDefaultModel`, and all tool functions, ensuring the TypeScript module provides the same public interface as the Python package for seamless migration. ``` Proceeding to implementation... </open-swe-plan-message>
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/deepagentsjs#231