DEVUP Docs
Back to Dashboard

Integrations

Deep Agents

Deep Agents is an agent harness from the LangChain team for long, multi-step tasks. Connect it to DEVUP AI through langchain-openai's ChatOpenAI.

Prerequisites

Install

bash
pip install deepagents langchain-openai

Set your API key

export DEVUP_API_KEY="your-key"

Create a deep agent

Point ChatOpenAI at DEVUP AI, then pass it to create_deep_agent with your tools.

python
import os

from deepagents import create_deep_agent
from langchain_openai import ChatOpenAI

model = ChatOpenAI(
    model="deepseek-ai/DeepSeek-V4-Pro",
    base_url="https://api.devupai.com/v1",
    api_key=os.environ["DEVUP_API_KEY"],
)


def multiply(a: int, b: int) -> int:
    """Multiply two integers."""
    return a * b


agent = create_deep_agent(
    model=model,
    tools=[multiply],
    system_prompt="You are a precise assistant. Use the multiply tool for arithmetic.",
)

result = agent.invoke({"messages": [{"role": "user", "content": "What is 12 multiplied by 34? Reply with the number only."}]})
tool_calls = [call["name"] for message in result["messages"] for call in getattr(message, "tool_calls", [])]
print(tool_calls, result["messages"][-1].content)

Output: ['multiply'] 408

Virtual filesystem

The agent also gets file tools (ls, read_file, write_file, edit_file, glob, grep, delete); files it writes are returned in result["files"].

python
result = agent.invoke({"messages": [{"role": "user", "content": "Use write_file to save the text Salam DEVUP to /notes.md, then reply with done."}]})
print(sorted(result["files"]))

Output: ['/notes.md']

Choosing models

Use the exact catalog ID as the model name. Deep Agents works through tool calls, so choose a model whose catalog entry supports tool calling. See Models and Tool Calling.

Troubleshooting

  • Authentication error (401)Set DEVUP_API_KEY in the same terminal that runs your script, without a Bearer prefix.
  • Model not foundUse the exact catalog ID as the model name.
  • The agent does not call your toolChoose a model whose catalog entry supports tool calling, and give the function a clear docstring.