Mistral AI Integration with Future AGI for LLM Tracing

Integrate Mistral AI with Future AGI observability. Set up traceAI-mistralai to capture model calls and monitor inference performance automatically.

Trace Mistral AI agent requests in Future AGI.

1. Installation

Use Python 3.10 through 3.13 and install the traceAI package.

pip install traceAI-mistralai

2. Set Environment Variables

Set your Future AGI and Mistral AI credentials.

import os

os.environ["FI_API_KEY"] = "your-futureagi-api-key"
os.environ["FI_SECRET_KEY"] = "your-futureagi-secret-key"
os.environ["MISTRAL_API_KEY"] = "your-mistral-api-key"

3. Initialize Trace Provider

Set up the trace provider to create a new project in FutureAGI, establish telemetry data pipelines.

from fi_instrumentation import register
from fi_instrumentation.fi_types import ProjectType

trace_provider = register(
    project_type=ProjectType.OBSERVE,
    project_name="mistralai_project",
)

4. Instrument your Project

Instrument your Project with MistralAI Instrumentor. Instrument supported Mistral chat and agent calls.

from traceai_mistralai import MistralAIInstrumentor

MistralAIInstrumentor().instrument(tracer_provider=trace_provider)

5. Create Mistral AI Components

Use your Mistral AI client as usual. Replace agent_id with the ID of your Mistral agent.

from mistralai import Mistral

client = Mistral(api_key=os.environ["MISTRAL_API_KEY"])

response = client.agents.complete(
    agent_id="agent_id",
    messages=[
        {"role": "user", "content": "plan a vacation for me in Tbilisi"},
    ],
)

print(response)

View the trace

Open Observe in Future AGI and select the mistralai_project project to inspect the trace.

Was this page helpful?

Questions & Discussion