Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Environment:Mistralai Client python Agents Environment

From Leeroopedia
Knowledge Sources
Domains Infrastructure, Agents
Last Updated 2026-02-15 14:00 GMT

Overview

Extension environment with MCP, griffe, and authlib for Mistral AI agent features including tool integration and OAuth.

Description

This environment extends the core Python SDK environment with dependencies needed for the Mistral Agents framework. It includes the Model Context Protocol (MCP) for tool server integration, griffe for Python function docstring parsing (used to auto-generate tool schemas), and authlib for OAuth authentication with MCP servers.

Usage

Use this environment when working with Mistral Agents features: creating agents with function tools, connecting to MCP tool servers, or using the agent conversation API with automatic tool execution.

System Requirements

Category Requirement Notes
OS Linux, macOS, Windows Same as core SDK
Python >= 3.10 Same as core SDK

Dependencies

Python Packages

Credentials

  • `MISTRAL_API_KEY`: Required (same as core SDK).
  • `MISTRAL_AGENT_ID`: Agent identifier for conversation-based workflows.
  • MCP server-specific OAuth credentials may be required depending on the tool servers used.

Quick Install

# Install with agents extra
pip install "mistralai[agents]"

Code Evidence

Agent dependencies declared in `pyproject.toml:27-31`:

agents = [
    "mcp >=1.0,<2.0",
    "griffe >=1.7.3,<2.0",
    "authlib >=1.5.2,<2.0",
]

Docstring parsing using griffe in `src/mistralai/extra/run/tools.py:158-159`:

docstring = Docstring(doc, parser="google")
docstring_sections = docstring.parse(warnings=False)

Agent ID usage from example files:

agent_id = os.environ.get("MISTRAL_AGENT_ID", "")

Common Errors

Error Message Cause Solution
`ImportError: No module named 'mcp'` MCP package not installed `pip install "mistralai[agents]"`
`ImportError: No module named 'griffe'` griffe package not installed `pip install "mistralai[agents]"`
Warning: `Function 'X' without a docstring is being parsed` Function tool has no docstring Add a Google-style docstring to the function for accurate schema generation

Compatibility Notes

  • MCP protocol: The SDK uses MCP 1.x. MCP 2.x is not yet supported.
  • Docstring format: Google-style docstrings are expected by the griffe parser. Other formats may produce incomplete tool schemas.
  • OAuth: authlib is used for MCP server OAuth flows. Not all MCP servers require OAuth.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment