### Install Provider Package from Shell Source: https://docs.langchain.com/oss/python/deepagents/code/providers Use the `dcode --install` command in the shell to install provider packages. This example installs the 'groq' package. ```bash dcode --install groq ``` -------------------------------- ### Install Provider Package in Session Source: https://docs.langchain.com/oss/python/deepagents/code/providers Use the `/install` command within a session to add provider packages. This example installs the 'groq' package. ```txt /install groq ``` -------------------------------- ### Project Setup and Dependency Installation Source: https://docs.langchain.com/oss/python/deepagents/going-to-production This snippet demonstrates how to clone a repository and install its dependencies using the Deepagents client. It initiates a thread and streams updates for the cloning and installation process. ```python thread_1 = await client.threads.create() async for chunk in client.runs.stream( thread_1["thread_id"], "agent", input={"messages": [{"role": "human", "content": "Clone https://github.com/org/repo and install dependencies"}]}, stream_mode="updates", ): print(chunk.data) ``` -------------------------------- ### Setup Script for Cloning and Configuration Source: https://docs.langchain.com/oss/python/deepagents/code/remote-sandboxes This script clones a GitHub repository using a provided token, installs dependencies, and configures persistent environment variables in the sandbox's bashrc. It relies on local environment variables being expanded by Deep Agents Code. ```bash #!/bin/bash set -e # Clone repository using GitHub token git clone https://x-access-token:${GITHUB_TOKEN}@github.com/username/repo.git $HOME/workspace cd $HOME/workspace # Make environment variables persistent cat >> ~/.bashrc <<'EOF' export GITHUB_TOKEN="${GITHUB_TOKEN}" export OPENAI_API_KEY="${OPENAI_API_KEY}" cd $HOME/workspace EOF source ~/.bashrc ``` -------------------------------- ### Verify Server Command Source: https://docs.langchain.com/oss/python/deepagents/code/mcp-tools To troubleshoot a server failing to start, verify that the command works correctly outside of Deep Agents Code. This example uses `npx` to run a filesystem server. ```bash npx -y @modelcontextprotocol/server-filesystem /tmp ``` -------------------------------- ### Install langchain-nvidia-openshell Source: https://docs.langchain.com/oss/python/deepagents/sandboxes Install the langchain-nvidia-openshell package using pip or uv. ```bash pip install langchain-nvidia-openshell ``` ```bash uv add langchain-nvidia-openshell ``` -------------------------------- ### Create Agent with StoreBackend (Baseten) Source: https://docs.langchain.com/oss/python/deepagents/backends Example of creating a DeepAgent using StoreBackend with a Baseten model. Includes setup for local development with InMemoryStore. ```python from deepagents import create_deep_agent from deepagents.backends import StoreBackend from langgraph.store.memory import InMemoryStore agent = create_deep_agent( model="baseten:zai-org/GLM-5.2", backend=StoreBackend( namespace=lambda rt: (rt.server_info.user.identity,), ), store=InMemoryStore(), # Good for local dev; omit for LangSmith Deployment ) ``` -------------------------------- ### Install langchain-vercel-sandbox Source: https://docs.langchain.com/oss/python/deepagents/sandboxes Install the langchain-vercel-sandbox package using pip or uv. ```bash pip install langchain-vercel-sandbox ``` ```bash uv add langchain-vercel-sandbox ``` -------------------------------- ### Create Agent with StoreBackend (Ollama) Source: https://docs.langchain.com/oss/python/deepagents/backends Example of creating a DeepAgent using StoreBackend with an Ollama model. Includes setup for local development with InMemoryStore. ```python from deepagents import create_deep_agent from deepagents.backends import StoreBackend from langgraph.store.memory import InMemoryStore agent = create_deep_agent( model="ollama:north-mini-code-1.0", backend=StoreBackend( namespace=lambda rt: (rt.server_info.user.identity,), ), store=InMemoryStore(), # Good for local dev; omit for LangSmith Deployment ) ``` -------------------------------- ### Create Agent with StoreBackend (OpenAI) Source: https://docs.langchain.com/oss/python/deepagents/backends Example of creating a DeepAgent using StoreBackend with an OpenAI model. Includes setup for local development with InMemoryStore. ```python from deepagents import create_deep_agent from deepagents.backends import StoreBackend from langgraph.store.memory import InMemoryStore agent = create_deep_agent( model="openai:gpt-5.5", backend=StoreBackend( namespace=lambda rt: (rt.server_info.user.identity,), ), store=InMemoryStore(), # Good for local dev; omit for LangSmith Deployment ) ``` -------------------------------- ### Create Agent with StoreBackend (Google) Source: https://docs.langchain.com/oss/python/deepagents/backends Example of creating a DeepAgent using StoreBackend with a Google Gemini model. Includes setup for local development with InMemoryStore. ```python from deepagents import create_deep_agent from deepagents.backends import StoreBackend from langgraph.store.memory import InMemoryStore agent = create_deep_agent( model="google_genai:gemini-3.5-flash", backend=StoreBackend( namespace=lambda rt: (rt.server_info.user.identity,), ), store=InMemoryStore(), # Good for local dev; omit for LangSmith Deployment ) ``` -------------------------------- ### Install langchain-modal Source: https://docs.langchain.com/oss/python/deepagents/sandboxes Install the langchain-modal package using pip or uv. ```bash pip install langchain-modal ``` ```bash uv add langchain-modal ``` -------------------------------- ### Install langchain-runloop Source: https://docs.langchain.com/oss/python/deepagents/sandboxes Install the langchain-runloop package using pip or uv. ```bash pip install langchain-runloop ``` ```bash uv add langchain-runloop ``` -------------------------------- ### Install Community Skills Source: https://docs.langchain.com/oss/python/deepagents/code/memory-and-skills Install community skills using the Skills CLI. Use the -g flag for global installation. ```bash npx skills add vercel-labs/agent-skills --skill web-design-guidelines -a deepagents -g -y npx skills ls -a deepagents -g ``` -------------------------------- ### Create Agent with StoreBackend (OpenRouter) Source: https://docs.langchain.com/oss/python/deepagents/backends Example of creating a DeepAgent using StoreBackend with an OpenRouter model. Includes setup for local development with InMemoryStore. ```python from deepagents import create_deep_agent from deepagents.backends import StoreBackend from langgraph.store.memory import InMemoryStore agent = create_deep_agent( model="openrouter:z-ai/glm-5.2", backend=StoreBackend( namespace=lambda rt: (rt.server_info.user.identity,), ), store=InMemoryStore(), # Good for local dev; omit for LangSmith Deployment ) ``` -------------------------------- ### Install E2B Package Source: https://docs.langchain.com/oss/python/deepagents/sandboxes Install the `langchain-e2b` package using pip or uv. ```bash pip install langchain-e2b ``` ```bash uv add langchain-e2b ``` -------------------------------- ### Install Daytona Sandbox Package with uv Source: https://docs.langchain.com/oss/python/deepagents/sandboxes Install the LangChain Daytona integration package using uv. ```bash uv add langchain-daytona ``` -------------------------------- ### Install Daytona Package Source: https://docs.langchain.com/oss/python/deepagents/sandboxes Installs the `langchain-daytona` package using pip or uv. ```bash pip install langchain-daytona ``` ```bash uv add langchain-daytona ``` -------------------------------- ### Install HuggingFace Integration Source: https://docs.langchain.com/oss/python/deepagents/customization Install the necessary package for HuggingFace integration. ```shell pip install -U "langchain[huggingface]" ``` -------------------------------- ### Install langchain-mcp-adapters Source: https://docs.langchain.com/oss/python/deepagents/mcp Install the necessary library to enable LangChain agents to use tools defined on MCP servers. ```bash pip install langchain-mcp-adapters ``` -------------------------------- ### Install LiteLLM provider via CLI Source: https://docs.langchain.com/oss/python/deepagents/code/providers Install the LiteLLM provider using the Deep Agents Code command-line interface. This is an alternative to installing within a session. ```bash dcode --install litellm ``` -------------------------------- ### Install E2B Sandbox Package with uv Source: https://docs.langchain.com/oss/python/deepagents/sandboxes Install the LangChain E2B integration package using uv. ```bash uv add langchain-e2b ``` -------------------------------- ### Install FastMCP Source: https://docs.langchain.com/oss/python/deepagents/mcp Install the FastMCP library using pip. ```bash pip install fastmcp ``` -------------------------------- ### Install AgentCore Provider Source: https://docs.langchain.com/oss/python/deepagents/code/remote-sandboxes Install the AgentCore provider dependency for Deep Agents Code. Use '/install' within a session or 'dcode --install' from the shell. ```txt /install agentcore ``` ```bash dcode --install agentcore ``` -------------------------------- ### Install langchain-runloop using uv Source: https://docs.langchain.com/oss/python/deepagents/sandboxes Install the langchain-runloop package using uv. This is an alternative package manager. ```bash uv add langchain-runloop ``` -------------------------------- ### Install LangSmith Sandbox with uv Source: https://docs.langchain.com/oss/python/deepagents/sandboxes Install the necessary package for LangSmith sandbox integration using uv. ```bash uv add "langsmith[sandbox]" ``` -------------------------------- ### Install LangSmith Sandbox Source: https://docs.langchain.com/oss/python/deepagents/customization Install the LangSmith sandbox integration using pip or uv. ```bash pip install "langsmith[sandbox]" ``` ```bash uv add "langsmith[sandbox]" ``` -------------------------------- ### Install Deep Agents and Tavily with Pip Source: https://docs.langchain.com/oss/python/deepagents/quickstart Install the deepagents and tavily-python packages using pip. This is the basic installation command for getting started. ```bash pip install deepagents tavily-python ``` -------------------------------- ### Execute Startup Command and Summarize Directory Source: https://docs.langchain.com/oss/python/deepagents/code-link Run a command before submitting the first prompt. The command's output is not accessible to the prompt. Useful for setting context. ```bash # list directory contents, then summarize directory as first prompt—the command runs first, then the prompt is submitted # the prompt does NOT have access to the command output dcode --startup-cmd "ls -la" -m "Summarize what's in this directory" ``` -------------------------------- ### Preinstall Provider Packages during CLI Install Source: https://docs.langchain.com/oss/python/deepagents/code/providers Set the `DEEPAGENTS_CODE_EXTRAS` environment variable to preinstall provider packages during the initial CLI installation. This example installs 'baseten' and 'groq'. ```bash DEEPAGENTS_CODE_EXTRAS="baseten,groq" curl -LsSf https://langch.in/dcode | bash ``` -------------------------------- ### Use a Third-Party Sandbox Provider Source: https://docs.langchain.com/oss/python/deepagents/code/remote-sandboxes Install a package that publishes a sandbox provider and then use the `--sandbox` flag to select it. Ensure your credentials are set if required by the provider. ```bash dcode --install langchain-e2b --package export E2B_API_KEY="..." dcode --sandbox e2b ``` -------------------------------- ### Clone deepagents repo and install dependencies Source: https://docs.langchain.com/oss/python/deepagents/acp Clone the deepagents repository and install its dependencies using uv. This is part of the setup for integrating with Zed. ```bash git clone https://github.com/langchain-ai/deepagents.git cd deepagents/libs/acp uv sync --all-groups chmod +x run_demo_agent.sh ``` -------------------------------- ### Configure credentials for demo agent Source: https://docs.langchain.com/oss/python/deepagents/acp Copy the example environment file and configure API keys for the demo agent. This step is necessary before running the demo agent. ```bash cp .env.example .env ``` -------------------------------- ### Instantiate Custom Model with Parameters Source: https://docs.langchain.com/oss/python/deepagents/code/configuration Example of how a custom model specified via `class_path` is instantiated, showing how model name and configuration parameters are passed. ```python MyChatModel(model="my-model-v1", base_url="...", api_key="...", temperature=0, max_tokens=4096) ``` -------------------------------- ### Full Migration Example: CompositeBackend with StateBackend and StoreBackend Source: https://docs.langchain.com/oss/python/deepagents/backends Compares the deprecated factory pattern with the new direct instance instantiation for creating a deep agent with CompositeBackend. ```python # Before (deprecated) from deepagents import create_deep_agent from deepagents.backends import CompositeBackend, StateBackend, StoreBackend agent = create_deep_agent( model="google_genai:gemini-3.5-flash", backend=lambda rt: CompositeBackend( default=StateBackend(rt), routes={"/memories/": StoreBackend(rt, namespace=lambda rt: (rt.server_info.user.identity,))}, ), ) # After agent = create_deep_agent( model="google_genai:gemini-3.5-flash", backend=CompositeBackend( default=StateBackend(), routes={"/memories/": StoreBackend(namespace=lambda rt: (rt.server_info.user.identity,))}, ), ) ``` -------------------------------- ### Create Agent with StoreBackend (Fireworks) Source: https://docs.langchain.com/oss/python/deepagents/backends Example of creating a DeepAgent using StoreBackend with a Fireworks AI model. Includes setup for local development with InMemoryStore. ```python from deepagents import create_deep_agent from deepagents.backends import StoreBackend from langgraph.store.memory import InMemoryStore agent = create_deep_agent( model="fireworks:accounts/fireworks/models/kimi-k2p7-code", backend=StoreBackend( namespace=lambda rt: (rt.server_info.user.identity,), ), store=InMemoryStore(), # Good for local dev; omit for LangSmith Deployment ) ``` -------------------------------- ### Create Agent with StoreBackend (Anthropic) Source: https://docs.langchain.com/oss/python/deepagents/backends Example of creating a DeepAgent using StoreBackend with an Anthropic Claude model. Includes setup for local development with InMemoryStore. ```python from deepagents import create_deep_agent from deepagents.backends import StoreBackend from langgraph.store.memory import InMemoryStore agent = create_deep_agent( model="anthropic:claude-sonnet-4-6", backend=StoreBackend( namespace=lambda rt: (rt.server_info.user.identity,), ), store=InMemoryStore(), # Good for local dev; omit for LangSmith Deployment ) ``` -------------------------------- ### Default StateBackend Initialization Source: https://docs.langchain.com/oss/python/deepagents/customization Demonstrates how to create a Deep Agent, which by default uses a StateBackend. Shows the explicit way to initialize StateBackend as well. ```python from deepagents import create_deep_agent from deepagents.backends import StateBackend # By default we provide a StateBackend agent = create_deep_agent(model="google_genai:gemini-3.5-flash") # Under the hood, it looks like agent2 = create_deep_agent( model="openai:gpt-5.5", backend=StateBackend(), ) ``` ```python from deepagents import create_deep_agent from deepagents.backends import StateBackend # By default we provide a StateBackend agent = create_deep_agent(model="openai:gpt-5.5") # Under the hood, it looks like agent2 = create_deep_agent( model="openai:gpt-5.5", backend=StateBackend(), ) ``` ```python from deepagents import create_deep_agent from deepagents.backends import StateBackend # By default we provide a StateBackend agent = create_deep_agent(model="anthropic:claude-sonnet-4-6") # Under the hood, it looks like agent2 = create_deep_agent( model="openai:gpt-5.5", backend=StateBackend(), ) ``` ```python from deepagents import create_deep_agent from deepagents.backends import StateBackend # By default we provide a StateBackend agent = create_deep_agent(model="openrouter:z-ai/glm-5.2") # Under the hood, it looks like agent2 = create_deep_agent( model="openai:gpt-5.5", backend=StateBackend(), ) ``` ```python from deepagents import create_deep_agent from deepagents.backends import StateBackend # By default we provide a StateBackend agent = create_deep_agent(model="fireworks:accounts/fireworks/models/kimi-k2p7-code") # Under the hood, it looks like agent2 = create_deep_agent( model="openai:gpt-5.5", backend=StateBackend(), ) ``` ```python from deepagents import create_deep_agent from deepagents.backends import StateBackend # By default we provide a StateBackend agent = create_deep_agent(model="baseten:zai-org/GLM-5.2") # Under the hood, it looks like agent2 = create_deep_agent( model="openai:gpt-5.5", backend=StateBackend(), ) ``` ```python from deepagents import create_deep_agent from deepagents.backends import StateBackend # By default we provide a StateBackend agent = create_deep_agent(model="ollama") ``` -------------------------------- ### Install and Select Baseten Model for Deep Agents Code Source: https://docs.langchain.com/oss/python/deepagents/code/providers Install the Baseten integration and select a Baseten-hosted model. Requires a Baseten API key. ```txt /install baseten /model ``` ```bash dcode --install baseten BASETEN_API_KEY="your-api-key" dcode --model baseten:moonshotai/Kimi-K2.7-Code ``` -------------------------------- ### Basic Hook Configuration for Logging Events Source: https://docs.langchain.com/oss/python/deepagents/code/configuration Configure ~/.deepagents/hooks.json to log session start and end events to a file. This demonstrates a simple hook setup for event tracking. ```json { "hooks": [ { "command": ["bash", "-c", "cat >> ~/deepagents-events.log"], "events": ["session.start", "session.end"] } ] } ``` -------------------------------- ### Use Default Sandbox from Configuration Source: https://docs.langchain.com/oss/python/deepagents/code/remote-sandboxes Uses the sandbox provider specified as the default in your configuration file. This is a convenient way to consistently use your preferred sandbox. ```bash dcode --sandbox ``` -------------------------------- ### Invoking Assistant-Scoped Agent Source: https://docs.langchain.com/oss/python/deepagents/going-to-production Illustrates invoking a deployed agent for assistant-scoped conversations. This example assumes a shared sandbox for all threads associated with the same assistant, useful for persistent state like installed dependencies or cloned repositories. ```python from langgraph_sdk import get_client client = get_client(url="", api_key="") ``` -------------------------------- ### Create Deep Agent with Baseten Source: https://docs.langchain.com/oss/python/deepagents/overview Installs the necessary packages and creates a Deep Agent using Baseten. This agent is configured with a weather-fetching tool. Further model and system prompt configuration would be needed for a complete agent setup. ```python # pip install -qU deepagents langchain-baseten from deepagents import create_deep_agent def get_weather(city: str) -> str: """Get weather for a given city.""" return f"It's always sunny in {city}!" ``` -------------------------------- ### Run Setup Script in Sandbox Source: https://docs.langchain.com/oss/python/deepagents/code/remote-sandboxes Executes a specified setup script within the sandbox after its creation. This allows for custom initialization of the sandbox environment. ```bash dcode --sandbox modal --sandbox-setup ./setup.sh ``` -------------------------------- ### Example Command Output - Success Source: https://docs.langchain.com/oss/python/deepagents/sandboxes Illustrates the output format when a command executes successfully. ```text 4 [Command succeeded with exit code 0] ``` -------------------------------- ### Advanced Hook Configuration with Multiple Commands and Event Filters Source: https://docs.langchain.com/oss/python/deepagents/code/configuration Example of a hooks.json file with multiple hook configurations. One hook processes specific events (session start, task complete) with a Python script, while another logs all events using a bash script. ```json { "hooks": [ { "command": ["python3", "my_handler.py"], "events": ["session.start", "task.complete"] }, { "command": ["bash", "log_everything.sh"] } ] } ``` -------------------------------- ### Full Example: Isolated Memory and Skills Across Users Source: https://docs.langchain.com/oss/python/deepagents/memory This comprehensive example demonstrates seeding per-user memories and skills, then invoking the agent as different users. It highlights how each user interacts with their isolated data and preferences. ```python from langchain_core.utils.uuid import uuid7 from deepagents import create_deep_agent from deepagents.backends import CompositeBackend, StateBackend, StoreBackend from deepagents.backends.utils import create_file_data from langgraph.store.memory import InMemoryStore store = InMemoryStore() # Use platform store when deploying to LangSmith # Seed preferences for two users store.put( ("user-alice",), "/memories/preferences.md", create_file_data("## Preferences\n - Likes concise bullet points\n - Prefers Python examples\n"), ) store.put( ("user-bob",), "/memories/preferences.md", create_file_data("## Preferences\n - Likes detailed explanations\n - Prefers TypeScript examples\n"), ) # Seed a skill for Alice store.put( ("user-alice",), "/skills/langgraph-docs/SKILL.md", create_file_data("--- \nname: langgraph-docs \ndescription: Fetch relevant LangGraph documentation to provide accurate guidance. \n---\n\n# langgraph-docs\n\nUse the fetch_url tool to read https://docs.langchain.com/llms.txt, then fetch relevant pages.\n"), ) agent = create_deep_agent( model="google_genai:gemini-3.5-flash", memory=["/memories/preferences.md"], skills=["/skills/"], backend=lambda rt: CompositeBackend( default=StateBackend(rt), routes={ "/memories/": StoreBackend( rt, namespace=lambda rt: (rt.server_info.user.identity,), ), "/skills/": StoreBackend( rt, namespace=lambda rt: (rt.server_info.user.identity,), ), }, ), store=store, ) # When deployed, each authenticated request resolves # `rt.server_info.user.identity` to the calling user, so Alice and Bob # automatically see only their own preferences. agent.invoke( {"messages": [{"role": "user", "content": "How do I read a CSV file?"}]}, config={"configurable": {"thread_id": str(uuid7())}}, ) ``` -------------------------------- ### Create and Use E2B Sandbox Agent Source: https://docs.langchain.com/oss/python/deepagents/sandboxes Demonstrates creating an E2B sandbox and initializing a Deep Agent with it. Further agent interaction would follow. ```python from e2b import Sandbox from deepagents import create_deep_agent from langchain_anthropic import ChatAnthropic from langchain_e2b import E2BSandbox e2b_sandbox = Sandbox.create() backend = E2BSandbox(sandbox=e2b_sandbox) agent = create_deep_agent( model=ChatAnthropic(model="claude-sonnet-4-6"), system_prompt="You are a Python coding assistant with sandbox access.", backend=backend, ) ``` -------------------------------- ### Install OpenRouter provider via CLI Source: https://docs.langchain.com/oss/python/deepagents/code/providers Install the OpenRouter provider using the Deep Agents Code command-line interface. This is an alternative to installing within a session. ```bash dcode --install openrouter ``` -------------------------------- ### Configure CompositeBackend with Scoped Permissions Source: https://docs.langchain.com/oss/python/deepagents/permissions Demonstrates setting up a `CompositeBackend` with a sandbox default and routing specific paths to different backends. Permissions are then applied, scoped to a known route prefix (`/memories/`) to ensure proper filesystem access control. ```python from deepagents.backends import CompositeBackend composite = CompositeBackend( default=sandbox, routes={"/memories/": memories_backend}, ) # Works: permissions are scoped to the /memories/ route agent = create_deep_agent( model=model, backend=composite, permissions=[ FilesystemPermission( operations=["write"], paths=["/memories/**"], mode="deny", ), ], ) ``` -------------------------------- ### Install Vercel Provider Source: https://docs.langchain.com/oss/python/deepagents/code/remote-sandboxes Install the Vercel provider dependency for Deep Agents Code. Use '/install' within a session or 'dcode --install' from the shell. ```txt /install vercel ``` ```bash dcode --install vercel ``` -------------------------------- ### Install Runloop Provider Source: https://docs.langchain.com/oss/python/deepagents/code/remote-sandboxes Install the Runloop provider dependency for Deep Agents Code. Use '/install' within a session or 'dcode --install' from the shell. ```txt /install runloop ``` ```bash dcode --install runloop ``` -------------------------------- ### Execute Command in Daytona Sandbox Source: https://docs.langchain.com/oss/python/deepagents/sandboxes Demonstrates creating a Daytona sandbox and executing a command using the `DaytonaSandbox` backend. This requires the `daytona` library to be installed. ```python from daytona import Daytona from langchain_daytona import DaytonaSandbox sandbox = Daytona().create() backend = DaytonaSandbox(sandbox=sandbox) result = backend.execute("python --version") print(result.output) ``` -------------------------------- ### Install Modal Provider Source: https://docs.langchain.com/oss/python/deepagents/code/remote-sandboxes Install the Modal provider dependency for Deep Agents Code. Use '/install' within a session or 'dcode --install' from the shell. ```txt /install modal ``` ```bash dcode --install modal ``` -------------------------------- ### Install Daytona Provider Source: https://docs.langchain.com/oss/python/deepagents/code/remote-sandboxes Install the Daytona provider dependency for Deep Agents Code. Use '/install' within a session or 'dcode --install' from the shell. ```txt /install daytona ``` ```bash dcode --install daytona ``` -------------------------------- ### Connect to MCP Servers and Load Tools Source: https://docs.langchain.com/oss/python/deepagents/customization Use `MultiServerMCPClient` to connect to MCP servers, retrieve available tools, and pass them to `create_deep_agent`. This example uses an asynchronous approach. ```python import asyncio from langchain_mcp_adapters.client import MultiServerMCPClient from deepagents import create_deep_agent async def main(): async with MultiServerMCPClient( { "my_server": { "transport": "http", "url": "http://localhost:8000/mcp", } } ) as client: tools = await client.get_tools() agent = create_deep_agent( model="openai:gpt-5.5", tools=tools, ) result = await agent.ainvoke( {"messages": [{"role": "user", "content": "Use the MCP server to help me."}]}, config={"configurable": {"thread_id": "1"}}, ) asyncio.run(main()) ``` -------------------------------- ### Configure DeepAgent with Baseten Memory Source: https://docs.langchain.com/oss/python/deepagents/customization This example demonstrates setting up a DeepAgent using the Baseten model. It includes the necessary FilesystemBackend, MemorySaver checkpointer, and interrupt configurations for file operations. ```python from deepagents import create_deep_agent from deepagents.backends import FilesystemBackend from langgraph.checkpoint.memory import MemorySaver # Checkpointer is REQUIRED for human-in-the-loop checkpointer = MemorySaver() agent = create_deep_agent( model="baseten:zai-org/GLM-5.2", backend=FilesystemBackend(root_dir="/Users/user/{project}"), memory=[ "./AGENTS.md" ], interrupt_on={ "write_file": True, # Default: approve, edit, reject "read_file": False, # No interrupts needed "edit_file": True, # Default: approve, edit, reject }, checkpointer=checkpointer, # Required! ) result = agent.invoke( { "messages": [ { "role": "user", "content": "Please tell me what's in your memory files.", } ], }, config={"configurable": {"thread_id": "12345"}}, ) ``` -------------------------------- ### Configure Agent with Google StoreBackend Source: https://docs.langchain.com/oss/python/deepagents/customization Shows how to configure an agent with a Google StoreBackend and an InMemoryStore for checkpointing. This setup is useful for managing agent state and memory. ```python from urllib.request import urlopen from deepagents import create_deep_agent from deepagents.backends import StoreBackend from deepagents.backends.utils import create_file_data from langgraph.store.memory import InMemoryStore with urlopen( "https://raw.githubusercontent.com/langchain-ai/deepagents/refs/heads/main/examples/text-to-sql-agent/AGENTS.md" ) as response: agents_md = response.read().decode("utf-8") ``` -------------------------------- ### Pin Deep Agents Code Install Version Source: https://docs.langchain.com/oss/python/deepagents/code/configuration Pin an exact version for reproducible installs across the fleet by setting the `DEEPAGENTS_CODE_VERSION` environment variable when running the install script. ```bash # Pin an exact version for reproducible installs across the fleet curl -LsSf https://langch.in/dcode | DEEPAGENTS_CODE_VERSION="0.1.16" bash ```