Quickstart: OpenInference
Esta página aún no está disponible en tu idioma.
OpenInference defines attributes for prompts, replies, and tool calls on OpenTelemetry spans. If your app already emits OpenInference spans, use the exporter settings below with your existing instrumentation. The Python example sends a sample trace and gives you a tool call to test.
Before you start
Section titled “Before you start”- A Mibo account with a verified email. Open the verification link in the browser you signed up with.
- Python 3.14 and uv for the example.
Tested with Python 3.14.10 and the package versions pinned below.
1. Create a Mibo API key
Section titled “1. Create a Mibo API key”Open the verification link in the browser you signed up with. If you open it in another browser where you’re signed out, Mibo asks you to choose a new password and revokes your existing API keys. If you own the workspace, create an API key in Settings and copy it. Mibo shows the key only once. If you’re a workspace member, ask the owner for a key.
2. Install the packages
Section titled “2. Install the packages”Run these commands in a new project directory to try the Python example.
uv venv --python 3.14uv pip install openinference-instrumentation==0.1.83 opentelemetry-sdk==1.45.2 \ opentelemetry-exporter-otlp-proto-http==1.45.23. Point the exporter at Mibo
Section titled “3. Point the exporter at Mibo”Set these values in the same shell. Replace <YOUR_MIBO_API_KEY> with the key you copied.
export OTEL_SERVICE_NAME=openinference-supportexport MIBO_OTLP_TRACES_ENDPOINT=https://api.mibo-ai.com/public/tracesexport MIBO_API_KEY='<YOUR_MIBO_API_KEY>'OTEL_SERVICE_NAME sets the service.name resource attribute. With a workspace key, Mibo routes by that name. If the name is new and the workspace has a free Agent slot, Mibo creates an Agent on the first trace. A key scoped to one Agent sends traces to that Agent. See trace routing.
In an existing app, pass the endpoint and the x-api-key header directly to the OTLP/HTTP exporter you configure for Mibo. If your exporter only takes a base URL and appends /v1/traces, use https://api.mibo-ai.com. In Python, attach the exporter and batch span processor to the tracer provider your instrumentor uses. If you already export through a collector, use Collector fan-out to send Mibo a copy.
4. Send your first trace
Section titled “4. Send your first trace”Save the following as support.py. It uses OpenInference’s Python tracing helpers and a local order lookup. The chat span stands in for a model call. Mibo records the trace’s model from an llm span that sets llm.model_name. Without one, the dashboard shows Model not reported.
import os
from openinference.instrumentation import ( TracerProvider, get_llm_input_message_attributes, get_llm_output_message_attributes,)from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporterfrom opentelemetry.sdk.resources import Resourcefrom opentelemetry.sdk.trace.export import BatchSpanProcessor
provider = TracerProvider( resource=Resource.create({"service.name": os.environ["OTEL_SERVICE_NAME"]}),)provider.add_span_processor( BatchSpanProcessor( OTLPSpanExporter( endpoint=os.environ["MIBO_OTLP_TRACES_ENDPOINT"], headers={"x-api-key": os.environ["MIBO_API_KEY"]}, timeout=10, ) ))tracer = provider.get_tracer(__name__)
@tracer.tooldef lookup_order(order_id: str) -> str: """Look up shipping status by order ID.""" orders = {"A-1042": "shipped"} return orders.get(order_id, "unknown")
try: with tracer.start_as_current_span("support_agent", openinference_span_kind="agent"): status = lookup_order("A-1042") reply = f"Order A-1042: {status}." with tracer.start_as_current_span("chat", openinference_span_kind="llm") as llm: llm.set_attribute("llm.model_name", "gpt-5.4-mini") llm.set_attributes(get_llm_input_message_attributes([ {"role": "user", "content": "What is the status of order A-1042?"}, ])) llm.set_attributes(get_llm_output_message_attributes([ {"role": "assistant", "content": reply}, ])) print(reply)finally: provider.shutdown()Run the script.
uv run --no-project python support.pyThe script prints Order A-1042: shipped. and shuts down the tracer provider, which exports the buffered spans. The Python exporter in the script always uses HTTP/protobuf.
Open Traces and select the Agent that received the trace by its current name. If Mibo created the Agent for this example, its initial name is openinference-support. Open the order trace and find lookup_order under What the agent did. Select View raw trace data to inspect the OpenInference attributes.
If the Python exporter logs 403 Forbidden, open Traces and check Waiting traces for an Agent limit notice. If you see it, set OTEL_SERVICE_NAME to the Service name of an active Agent or free an Agent slot. Then run the script again.
5. Create your first test
Section titled “5. Create your first test”- Wait for the trace to finish, then click Create test from this trace.
- Open Draft if the editor shows tabs. Set Name to
Looks up the orderand clear Checks a trace when so the test checks each new trace for this Agent. - Keep the Tool call check. If the draft omits it, choose Tool call from Does check. Set Tool name to
lookup_orderand select Must call. Remove the other checks and click Save test. - Run the script again. Open the new trace on Traces and look under Test results. The check passes when the trace records a call to
lookup_order.
For your own app, use the name of a tool you expect it to call. Keep message capture enabled so Mibo can use prompts and replies. If a trace is missing, check your instrumentor’s capture settings and look for llm.input_messages.* or llm.output_messages.* in the export. See content capture settings and Data handling.
What’s next
Section titled “What’s next”- LangGraph quickstart for Python apps that use LangGraph.
- OpenTelemetry (OTLP) for routing, batching, and response codes.
- Assertion reference for checks you can add to your test.