0

DeepSeek Provider

DeepSeek Provider explains the cloud layer of MTPX with practical guidance for building inspectable, tool-using agents.

De
DeepSeek Provider
Chapter 030ProvidersCloudIndex
01Orientation

DeepSeek Provider belongs to the providers track. The page breaks the idea into responsibilities, implementation rules, failure modes, and the signals you should expose in a product UI.

Use this when

Use this when you need to understand how deepseek provider affects a real MTPX agent before you wire it into an application.

  • What deepseek provider owns in the runtime.
  • How it connects to planning, tool execution, events, providers, or storage.
  • What to log, test, and expose to users when this layer is active.
  • Common mistakes that make agent systems hard to inspect.
02 / syntax starter
from mtp import Agent
from mtp.providers import Groq

agent = Agent.MTPAgent(
    provider=Groq(model="llama-3.3-70b-versatile"),
    tools=tools,
)
03 / manual

Read the system

The complete source manual—syntax, examples, linked references, edge cases, and implementation notes.

Documentation index ↗

DeepSeek offers powerful reasoning models with OpenAI-compatible API. The R1 reasoner exposes chain-of-thought reasoning traces.

Install

bashpip install "mtpx[deepseek]"

This installs the openai SDK (used for the OpenAI-compatible API):

bashpip install openai

API Key Setup

  1. Install dotenv support:
bash   pip install python-dotenv

Or with the MTP extra:

bash   pip install "mtpx[dotenv]"
  1. Create a .env file in your project root:
text   DEEPSEEK_API_KEY=sk-your_key_here
  1. Load it in your code before creating the provider:
python   from mtp import Agent

   Agent.load_dotenv_if_available()  # reads .env file

Get an API key at platform.deepseek.com. Free tier credits available on signup.

Option 2: System environment variable

bash# Linux/macOS
export DEEPSEEK_API_KEY="sk-..."

# Windows PowerShell
$env:DEEPSEEK_API_KEY="sk-..."

Quick Start

pythonfrom mtp import Agent
from mtp.providers import DeepSeek

Agent.load_dotenv_if_available()  # loads DEEPSEEK_API_KEY from .env

provider = DeepSeek(model="deepseek-chat")
tools = Agent.ToolRegistry()
agent = Agent(provider=provider, tools=tools)

reply = agent.run_loop("What is 25 * 4 + 10?")
print(reply)

Parameters

ParameterTypeDefaultDescription
modelstr"deepseek-chat"DeepSeek model ID
api_keystr | NoneNoneAPI key (falls back to DEEPSEEK_API_KEY env var)
temperaturefloat0.0Sampling temperature
tool_choicestr | dict"auto"Tool selection strategy
parallel_tool_callsboolTrueAllow parallel tool calls
capture_reasoningboolTrueCapture R1 chain-of-thought reasoning trace
clientAny | NoneNonePre-configured openai.OpenAI client instance

Capabilities

CapabilityValue
Tool callingYes (V3 only, not R1)
Parallel tool callsYes (V3 only)
Input modalitiestext
StreamingFallback
Usage metricsRich
Reasoning metadataYes (R1 models)
Native asyncNo (uses thread fallback)

Models

  • deepseek-chat — DeepSeek-V3, best general-purpose + tool calling (default)
  • deepseek-reasoner — DeepSeek-R1, chain-of-thought reasoning model

Important: deepseek-reasoner (R1) does NOT support tool calling. Use deepseek-chat (V3) for agent workflows with tools.

Reasoning Traces

When using deepseek-reasoner, the chain-of-thought reasoning is captured automatically:

pythonprovider = DeepSeek(
    model="deepseek-reasoner",
    capture_reasoning=True,
)

The reasoning trace is available in action_meta["reasoning"] and included in serialized tool calls.

Full Example

pythonfrom mtp import Agent
from mtp.providers import DeepSeek

Agent.load_dotenv_if_available()

# V3 for tool calling
provider = DeepSeek(
    model="deepseek-chat",
    temperature=0.0,
    parallel_tool_calls=True,
    capture_reasoning=True,
)

tools = Agent.ToolRegistry()
agent = Agent(provider=provider, tools=tools, debug_mode=True)

reply = agent.run_loop(
    "Calculate (25 * 4) + 10",
    max_rounds=3,
)
print(reply)

Pricing

DeepSeek is extremely cheap (~$0.07 / 1M input tokens for V3 as of mid-2025). Free tier credits available on signup.

Source

src/mtp/providers/deepseek_provider.py

01

Read

Understand where DeepSeek Provider sits in the agent loop before adding abstractions.

02

Wire

Connect the smallest useful provider, registry, store, or event stream first.

03

Observe

Expose events, logs, results, and failure states while the runtime is still moving.

04

Harden

Add policy, tests, retries, and audit traces after the behavior is visible.

Next docFireworks AI Provider