langchain-deepagents
LangChain Deep Agents (Python) — build, deploy, and customize stateful long-running agents with virtual filesystems, subagents, human-in-the-loop, and LangSmith observability. Also covers LangGraph, LangChain OSS chains/retrievers, and Agent Server API.
Best use case
langchain-deepagents is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
LangChain Deep Agents (Python) — build, deploy, and customize stateful long-running agents with virtual filesystems, subagents, human-in-the-loop, and LangSmith observability. Also covers LangGraph, LangChain OSS chains/retrievers, and Agent Server API.
Teams using langchain-deepagents should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/langchain-deepagents/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How langchain-deepagents Compares
| Feature / Agent | langchain-deepagents | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
LangChain Deep Agents (Python) — build, deploy, and customize stateful long-running agents with virtual filesystems, subagents, human-in-the-loop, and LangSmith observability. Also covers LangGraph, LangChain OSS chains/retrievers, and Agent Server API.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# LangChain Deep Agents Skill
Expert assistance for building LangChain Deep Agents in Python: stateful agents with virtual filesystems, parallel subagents, tool permissions, human-in-the-loop, and deployment via LangSmith.
Reference corpus: **1473 pages** of official docs in `references/llms-txt.md` (5.4 MB) and `references/llms-full.md` (10 MB). Use `view references/llms-full.md` when detailed implementation is needed.
## When to Use This Skill
Activate when:
- **Building a Deep Agent** — creating a stateful agent with virtual filesystem, backends, or subagents
- **Configuring subagents** — setting up parallel or async subagents with permission inheritance
- **Implementing human-in-the-loop** — adding approval gates for sensitive tool calls
- **Deploying to LangSmith** — setting up `langgraph.json`, Agent Server, or deployment pipelines
- **Tracing and evaluating** — instrumenting agents with `@traceable`, running `client.evaluate()`
- **Debugging LangGraph state** — working with `StateGraph`, checkpointers, or thread state
- **Using Agent Server API** — managing threads, runs, assistants, crons, or streaming
- **Integrating retrievers or chains** — connecting vector stores, RAG pipelines, or tool middleware
## Quick Reference
### Create a basic Deep Agent with state and checkpointer
```python
from langgraph.graph import StateGraph, MessagesState
from langgraph.checkpoint.memory import InMemorySaver
from langchain.agents import create_agent
# Checkpointer persists agent state across runs
checkpointer = InMemorySaver()
agent = create_agent(
skills=[...], # Skill middleware layers
checkpointer=checkpointer,
)
```
### Trace agent functions with LangSmith
```python
from langsmith import traceable
from langsmith.schemas import Attachment
from pathlib import Path
@traceable
def my_agent_step(inputs: dict) -> dict:
# Automatically traced in LangSmith
return {"output": process(inputs)}
# Attach files to traces
@traceable
def analyze_file(path: Path) -> dict:
attachment = Attachment(mime_type="text/plain", data=path.read_bytes())
return {"result": process(attachment)}
```
### Evaluate agent with LangSmith client
```python
from langsmith import Client
client = Client()
def target(inputs):
return {"output": my_agent.invoke(inputs)}
def accuracy_evaluator(run, example):
score = evaluate_output(run.outputs, example.outputs)
return {"key": "accuracy", "score": score}
# Non-blocking: stream results as they arrive
results = client.evaluate(
target,
data="my_test_dataset",
evaluators=[accuracy_evaluator],
blocking=False,
)
for result in results:
print(result)
```
### Distributed tracing across services (LangGraph)
```python
import langsmith as ls
from langgraph.graph import StateGraph, MessagesState
# Accept trace context propagated from upstream callers
# Headers passed via config["configurable"]["langsmith-trace"]
def my_node(state: MessagesState, config: dict):
trace_headers = config.get("configurable", {})
with ls.trace(headers=trace_headers):
return process(state)
```
### Subagent permission scoping
```python
# Subagents inherit parent permissions by default.
# Setting permissions REPLACES (does not extend) parent rules.
subagent_spec = {
"name": "restricted-subagent",
"permissions": [
{"path": "/workspace", "access": "read-write"},
# Parent's other permissions are NOT inherited
]
}
```
### LangSmith custom authentication handler
```python
from langgraph_sdk.auth import Auth
auth = Auth()
@auth.authenticate
async def handler(request):
user = await validate_token(request.headers.get("Authorization"))
return {
"identity": user.id,
"role": user.role,
# Accessible in graph via config["configurable"]["langgraph_auth_user"]
}
```
## Reference Files
| File | Size | Contents |
|------|------|----------|
| `references/llms-txt.md` | 5.4 MB | Full doc corpus — summaries of 1473 pages |
| `references/llms-full.md` | 10 MB | Complete page content with all code examples |
| `references/llms.md` | 104 KB | Site index — all doc URLs with descriptions |
| `references/index.md` | 1 KB | Category index |
**To find specific content:** Search `references/llms.md` for topic URLs, then look up full content in `references/llms-full.md`.
## Key Deep Agents Topics (Python)
From `references/llms.md` — Python-specific deep agents docs at `/oss/python/deepagents/`:
- **Overview & quickstart**: `/oss/python/deepagents/overview`
- **Subagents**: `/oss/python/deepagents/subagents` — parallel execution, permission scoping
- **Human-in-the-loop**: `/oss/python/deepagents/human-in-the-loop` — approval gates for tool calls
- **Backends & filesystem**: `/oss/python/deepagents/backends` — CompositeBackend, virtual FS, route prefixes
- **Context engineering**: `/oss/python/deepagents/context-engineering` — managing long-running context
- **Frontend (todo list pattern)**: `/oss/python/deepagents/frontend/todo-list` — `useStream` + custom state keys
- **Data analysis example**: `/oss/python/deepagents/data-analysis`
- **Deep research example**: `/oss/python/deepagents/deep-research`
## Agent Server API Quick Reference
| Operation | Method + Path |
|-----------|--------------|
| Create thread | `POST /threads` |
| Stream run | `POST /threads/{id}/runs/stream` |
| Create assistant | `POST /assistants` |
| Schedule cron | `POST /crons` |
| Store/retrieve state | `PUT/GET /store/{namespace}/{key}` |
| Health check | `GET /ok` |
| Server info | `GET /info` |
## Security Best Practices for Sandboxed Agents
- Enable human-in-the-loop for **all** tool calls when using sensitive credentials
- Block or restrict sandbox network access to limit data exfiltration paths
- Use narrowest possible credential scope with shortest possible lifetime
- `CompositeBackend` requires explicit route prefixes — path restrictions alone cannot prevent sandbox filesystem access via shell commands
- Treat all sandbox outputs as **untrusted input** before acting on them
- Apply middleware to filter/redact sensitive patterns in tool outputs
## Updating
To re-scrape with tighter scope (deep agents section only):
```bash
skill-seekers scrape --url "https://docs.langchain.com/oss/python/deepagents/overview" --name langchain-deepagents
```Related Skills
langchain
LangChain Python package — new create_agent() factory (builds a LangGraph agent from a model string + tools + middleware), plus a comprehensive middleware system covering HITL, PII redaction, model fallback, rate limiting, auto-summarization, context editing, shell tools, and todo planning.
langchain-redis
LangChain Redis integration — RedisVectorStore for RAG, RedisCache and RedisSemanticCache for LLM response caching, RedisChatMessageHistory for persistent conversation memory, and RedisConfig for connection management. Requires Redis Stack (redis/redis-stack-server).
langchain-postgres
LangChain PostgreSQL integration — PGVectorStore (v2, recommended) and PGVector (v1 legacy) for pgvector RAG, PostgresChatMessageHistory for persistent chat, HNSW/IVFFlat index management, hybrid search, async-first engine via PGEngine, and custom metadata columns.
langchain-perplexity
LangChain Perplexity AI integration — ChatPerplexity (chat model with built-in web search and date/domain filtering), PerplexitySearchRetriever for RAG, PerplexitySearchResults tool, PerplexityEmbeddings, and reasoning output parsers (ReasoningJsonOutputParser, strip_think_tags).
langchain-openrouter
LangChain OpenRouter integration — ChatOpenRouter gives access to hundreds of models (Claude, GPT-4o, Gemini, Llama, etc.) through a single API key. Supports provider routing preferences, reasoning models, plugins, tool calling, structured output, and request attribution/tracing.
langchain-ollama
LangChain Ollama integration — run local LLMs with ChatOllama (chat completions, tool calling, structured output, reasoning/thinking mode), OllamaLLM (raw text completions), and OllamaEmbeddings. Connects to a local Ollama server at localhost:11434.
langchain-neo4j
LangChain Neo4j integration — Neo4jGraph for Cypher queries and schema inspection, GraphCypherQAChain for natural-language-to-Cypher Q&A, Neo4jVector for vector/hybrid RAG, Neo4jSaver LangGraph checkpointer, Neo4jChatMessageHistory, and GraphDocument/Node/Relationship for knowledge graph construction.
langchain-mcp-adapters
LangChain MCP Adapters — connect LangChain agents to MCP (Model Context Protocol) servers. Load MCP tools, prompts, and resources as LangChain-compatible objects. Supports stdio, SSE, StreamableHTTP, and WebSocket transports. Includes interceptors, callbacks, and multi-server management.
langchain-exa
LangChain Exa integration — semantic web search with ExaSearchRetriever (RAG), ExaSearchResults (agent tool), and ExaFindSimilarResults (find similar URLs). Unique features: use_autoprompt (LLM query rewriting), highlights (excerpts), summary (per-result LLM summaries), livecrawl (real-time), and date filtering.
langchain-aws
LangChain AWS integration — ChatBedrockConverse (Claude/Nova/Llama/Mistral on Bedrock), BedrockEmbeddings, AmazonKnowledgeBasesRetriever, BedrockAgentsRunnable, BedrockRerank, BedrockPromptCachingMiddleware, CodeInterpreterToolkit, BrowserToolkit (computer use), Neptune graph chains, and SageMaker endpoint.
langchainjs
LangChain.js - TypeScript framework for building LLM-powered applications with agents, chains, RAG, tools, memory, and integrations for OpenAI, Anthropic, Google, and hundreds of other providers
web-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use for complex artifacts requiring state management, routing, or shadcn/ui components - not for simple single-file HTML/JSX artifacts.