0

Providers

Providers explains the overview layer of MTPX with practical guidance for building inspectable, tool-using agents.

Pr
Providers
Chapter 015ProvidersOverviewIndex
01Orientation

Providers 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 providers affects a real MTPX agent before you wire it into an application.

  • What providers 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 ↗

MTP supports both:

  • short ergonomic aliases (Agno-style), for example Groq
  • explicit provider class names, for example GroqToolCallingProvider

Both styles are equivalent.

Install provider extras

Use official extras instead of remembering each SDK package:

bashpip install "mtpx[groq]"
pip install "mtpx[openai]"
pip install "mtpx[lmstudio]"
pip install "mtpx[ollama]"
pip install "mtpx[anthropic]"
pip install "mtpx[gemini]"
pip install "mtpx[cohere]"
pip install "mtpx[mistral]"

OpenAI-compatible provider families:

bashpip install "mtpx[openrouter]"
pip install "mtpx[sambanova]"
pip install "mtpx[cerebras]"
pip install "mtpx[deepseek]"
pip install "mtpx[togetherai]"
pip install "mtpx[fireworksai]"
pip install "mtpx[xiaomi]"

Install most provider SDKs at once:

bashpip install "mtpx[providers]"

Capability contract (enforceable)

Each provider adapter exposes:

pythondef capabilities(self) -> ProviderCapabilities

ProviderCapabilities includes:

  • supports_tool_calling
  • supports_parallel_tool_calls
  • input_modalities (subset of text, image, audio, video, file)
  • supports_tool_media_output
  • supports_finalize_streaming
  • usage_metrics_quality (none, basic, rich)
  • supports_reasoning_metadata
  • structured_output_support (none, client_validated, native_json_object, native_json_schema)
  • supports_native_async
  • allow_finalize_stream_fallback

Runtime guardrails in Agent/MTPAgent enforce this contract:

  • Unsupported requested input modality => fail fast with clear error.
  • Unsupported native finalize streaming => fail fast, unless fallback is explicitly allowed.

This prevents providers from silently over-promising features in production.

Built-in usage (alias style)

pythonfrom mtp.providers import Groq

provider = Groq(model="llama-3.3-70b-versatile")

Built-in usage (explicit style)

pythonfrom mtp.providers import GroqToolCallingProvider

provider = GroqToolCallingProvider(model="llama-3.3-70b-versatile")

Add a new provider

1) Create provider file

Example: src/mtp/providers/anthropic_provider.py

pythonfrom mtp.agent import AgentAction, ProviderAdapter

class AnthropicToolCallingProvider(ProviderAdapter):
    def next_action(self, messages, tools) -> AgentAction:
        ...

    def finalize(self, messages, tool_results) -> str:
        ...

    async def anext_action(self, messages, tools) -> AgentAction:
        ...

    async def afinalize(self, messages, tool_results) -> str:
        ...

2) Export provider class

In src/mtp/providers/__init__.py:

pythonfrom .anthropic_provider import AnthropicToolCallingProvider

3) Use provider directly

pythonfrom mtp import Agent
from mtp.providers import AnthropicToolCallingProvider

provider = AnthropicToolCallingProvider(model="claude-...")
registry = Agent.ToolRegistry()
agent = Agent.MTPAgent(provider=provider, tools=registry)

Notes

  • Alias names available (when matching optional SDKs are installed):
  • Groq, OpenRouter, OpenAI, LMStudio, Ollama, Gemini, Anthropic, SambaNova
  • Cerebras, DeepSeek, Mistral, Cohere, TogetherAI, FireworksAI, Xiaomi
  • Local deterministic planner provider is also available as MockPlannerProvider (class alias for SimplePlannerProvider).
  • Provider exports are dependency-optional: missing SDKs no longer block importing other providers.
  • Provider symbols are lazily loaded to avoid import-time circular dependencies.
  • Explicit class names remain fully supported and unchanged.
  • No provider is defaulted by core Agent / MTPAgent.
  • Different providers can expose different constructor parameters safely.
  • Async provider hooks are optional. If omitted, async agent APIs fall back to running sync provider methods in threads.

Related:

Local providers quick reference

LM Studio

LMStudio targets the OpenAI-compatible LM Studio local server.

pythonfrom mtp.providers import LMStudio

provider = LMStudio(
    model="qwen3-4b-thinking-2507",
    base_url="http://127.0.0.1:1234/v1",
    temperature=0.0,
)

Notes:

  • No cloud API key is required for local LM Studio usage.
  • The LM Studio API server must be started and a model must be loaded.

Ollama

Ollama targets a local Ollama host using the native Ollama client SDK.

pythonfrom mtp.providers import Ollama

provider = Ollama(
    model="qwen3:1.7b",
    host="http://localhost:11434",
    think=True,
    options={"temperature": 0},
)

Notes:

  • For local Ollama usage, no cloud API key is required.
  • Ensure the model is pulled first (ollama pull ...) and the service is running.

Detailed setup and troubleshooting:

01

Read

Understand where Providers 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 docProvider Guides