Deep Agents

repository·main·Indexed 12 days ago

https://github.com/langchain-ai/deepagents

An opinionated, batteries-included agent harness built on LangGraph and LangChain for long-horizon, multi-step tasks. It provides built-in capabilities for sub-agents, filesystem and context management, and persistent memory. Includes examples for async subagent servers using Agent Protocol, autonomous harness optimization via better-harness, and specialized implementations like a Content Builder Agent and Deep Research agent.

Tokens
151.1K
Snippets
382
Records
646
Agent score
98%

What's inside Deep Agents

  1. Overview of Deep Agents Evals

    main

    Deep Agents Evals is an end-to-end behavioral evaluation suite designed for the Deep Agents SDK. It evaluates agents by running them against real LLMs and capturing their full execution trajectory, including tool calls, file mutations, and final responses. The suite scores agents based on two primary metrics: correctness and efficiency.

    Key components include:

    • EVAL_CATALOG.md: Contains the full list of available evaluations and categories.
    • MODEL_GROUPS.md: Contains the model catalog used by the evaluation workflow.
    • Harbor Integration: Supports running sandboxed benchmarks, such as Terminal Bench 2.0.
  2. Overview of Deep Agents Code features

    main

    Deep Agents Code (dcode) is a pre-built coding agent for the terminal that works with any LLM supporting tool calling. Key features include:

    • Interactive TUI: A rich terminal interface with streaming responses.
    • Conversation Resume: Ability to continue previous sessions.
    • Web Search: Grounding responses in live web data.
    • Remote Sandboxes: Isolated execution environments (supports LangSmith, AgentCore, Daytona, Modal, Runloop, etc.).
    • Persistent Memory: Context retention across different conversations.
    • Custom Skills: Extension via custom slash commands.
    • Headless Mode: Non-interactive execution for CI/CD and scripting.
    • Human-in-the-loop: Manual approval/rejection of tool calls.
  3. Explore Deep Agents examples by category

    main

    The deepagents repository contains various implementation patterns and use cases. You can explore examples categorized by their primary function:

    Research

    • Deep Research: Multi-step web research using Tavily, parallel sub-agents, and strategic reflection.
    • MCP Docs Agent: A research agent that uses Model Context Protocol (MCP) tools over LangChain documentation.

    Coding

    • Coding Agent: An autonomous coding agent running in a LangSmith sandbox.
    • Nemotron Research Agent: Research agent using NVIDIA Nemotron Super with GPU-accelerated execution via RAPIDS.

    Content

    • Content Builder: Generates blog posts, LinkedIn posts, and tweets using memory (AGENTS.md), skills, and subagents.
    • Text-to-SQL: Converts natural language to SQL using planning and skill-based workflows on the Chinook demo database.
    • LLM Wiki: A script-first LLM wiki that can be synced via langsmith hub init/pull/push.

    Deployable Services

    • Content Writer: A content writer featuring per-user memory and Supabase authentication.
    • GTM Strategist: A Go-To-Market strategy agent that coordinates synchronous and asynchronous subagents.
    • Async Subagent Server: A self-hosted Agent Protocol server that exposes a researcher as an asynchronous subagent.

    Advanced Patterns

    • Ralph Loop: Autonomous looping with fresh context per iteration, utilizing the filesystem for persistence.
    • Agents as Folders: A pattern for downloading, unzipping, and running agents.
    • Better Harness: An eval-driven outer-loop optimization for a Deep Agents harness.
  4. Security and Threat Model for deepagents-cli

    main

    The deepagents-cli operates on a trust model where the user is the final gatekeeper for side-effecting actions. The project implements several layers of security to mitigate risks like prompt injection and malicious tool usage:

    Key Security Controls

    • Human-in-the-Loop (HITL): In interactive mode, every side-effecting tool call (e.g., file writes, shell commands, web searches, URL fetches, task delegation) requires explicit user approval via a dialog. The project uses agent._add_interrupt_on to ensure these gates exist.
    • Unicode/URL Safety: To prevent homoglyph attacks (e.g., using look-alike characters in URLs), the project uses check_url_safety and strip_dangerous_unicode. Warnings are surfaced in the HITL approval dialog.
    • Shell Security: Shell commands are restricted via an allow-list. In non-interactive mode, only commands on this allow-list are auto-approved.
    • Configuration Validation:
      • TOML schemas are used for configuration.
      • MCP (Model Context Protocol) configurations are validated via schema and fingerprinting (mcp_trust.compute_config_fingerprint).
      • JSON structure checks are performed for hooks.
    • Subagent Security: Custom subagents defined in .deepagents/agents/ are treated as user-authored content. Delegation to these subagents is gated by HITL on the task tool.

    Important Security Notes

    • Unencrypted Sessions: Session data is unencrypted at rest.
    • Environment Variables: In MCP subprocesses, arbitrary environment variables may be forwarded to the subprocess. In server IPC, parent environment variables are passed to child processes.
    • Sandbox Security: Security for sandboxes (Daytona, LangSmith, Modal, Runloop, AgentCore) is the responsibility of the third-party provider, not this project.
  5. Deep Agents core features and capabilities

    main

    Deep Agents provides a 'batteries-included' environment for long-horizon, multi-step tasks. Key features include:

    • Sub-agents: Delegate tasks to agents with isolated context windows.
    • Filesystem: Read, write, edit, or search via pluggable local, sandboxed, or remote backends.
    • Context management: Summarize long threads and offload tool outputs to disk.
    • Shell access: Run commands in a chosen sandbox.
    • Persistent memory: Pluggable state and store backends for cross-session recall.
    • Human-in-the-loop: Approve, edit, or reject tool calls before execution.
    • Skills: Reusable behaviors that can be loaded on demand.
    • Tools: Support for custom functions or any MCP (Model Context Protocol) server.

    Deep Agents is model-agnostic and works with any LLM that supports tool calling (frontier APIs, open-weight models, or local models via Ollama, vLLM, etc.).

  6. Choose the right Deep Agents package

    main

    The Deep Agents monorepo provides several packages depending on whether you want to use a pre-built tool or build your own agentic system:

    • deepagents: The Core SDK used to build custom agents via create_deep_agent, middleware, and pluggable backends.
    • code (deepagents-code): The pre-built terminal coding agent run via the dcode command.
    • cli (deepagents-cli): A deployment tool with init, dev, and deploy subcommands for shipping agents to the LangGraph Platform.
    • acp: Agent Client Protocol integration for running Deep Agents inside editors like Zed (can expose dcode as an ACP server).
    • evals: Evaluation suite and Harbor integration for benchmarking agent behavior.
    • talon: Experimental local runtime host for long-running agents (includes channel adapters and cron schedulers).
    • partners: Provider integrations for Daytona, Modal, Runloop, Vercel, and QuickJS.
  7. Understand the Deep Agents monorepo structure

    main

    Deep Agents is an extensible agent harness built on LangChain and LangGraph. It provides long-horizon features like filesystem/shell backends, planning, context management, skills, persistent memory, human approval, and subagents.

    The repository is organized as a monorepo of independently versioned Python packages located in libs/. There is no root pyproject.toml; instead, each package manages its own dependencies and lifecycle via its own pyproject.toml, uv.lock, and Makefile.

  8. Use cuML for GPU-accelerated Machine Learning

    main

    The cuml-machine-learning skill provides a scikit-learn-compatible API for running machine learning tasks on NVIDIA GPUs. This is ideal for datasets with 10K+ rows where GPU acceleration provides significant speedups.

    When to use this skill:

    • Classification: Predict categories, detect fraud, or classify text.
    • Regression: Forecast values, predict prices, or estimate quantities.
    • Clustering: Segment customers or group documents.
    • Dimensionality Reduction: Visualize high-dimensional data or compress features.
    • Preprocessing: Feature engineering on large datasets.
  9. What is Deep Agents and its core features?

    main

    Deep Agents is an open-source, opinionated agent harness designed for long-horizon, multi-step work. It is built on top of LangGraph and is model-agnostic, working with any LLM that supports tool calling (frontier, open-weight, or local via Ollama, vLLM, etc.).

    Core Features:

    • Sub-agents: Delegate tasks to agents with isolated context windows.
    • Filesystem: Read, write, edit, or search via pluggable local, sandboxed, or remote backends.
    • Context management: Summarize long threads and offload tool outputs to disk.
    • Shell access: Run commands in a chosen sandbox.
    • Persistent memory: Pluggable state and store backends for cross-session recall.
    • Human-in-the-loop: Approve, edit, or reject tool calls before execution.
    • Skills: Reusable behaviors loaded on demand.
    • Tools: Support for custom functions or any MCP server.
  10. Overview of Unified Evals

    main

    The unified evals CI job runs multiple models through a fixed battery of benchmarks to produce a cross-model comparison, including a leaderboard and a radar chart. It evaluates models as 'deep agents' across distinct capability axes using identical tasks, harnesses, and scoring to ensure comparability.

    Key capability axes include:

    • autonomous
    • conversation
    • research
    • context (available but not in the default set)
  11. What is Ralph Mode?

    main

    Ralph is an autonomous looping pattern designed for simple context management. Instead of managing complex conversation histories or worrying about token limits, each iteration starts with fresh context.

    Progress is tracked via the filesystem and git, which act as the agent's memory and worklog. The core logic follows a simple loop: the agent receives a prompt, performs work (creating files, etc.), and then the loop repeats with the same prompt but with the updated filesystem state.