AgentOpsAgentOps 0.4.21 · Python 3.10+
0%
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
11 small wins to finish your pathNext lesson

Installation and setup

agentops.init sets up OpenTelemetry tracing and instruments LLM libraries. Its defaults export traces and metrics to AgentOps' servers, with or without a key.

pip install agentops 0.4.21

Install the SDK, the OpenAI client used in lesson 5, and pytest. The version is pinned so the spans you see match the lessons.

pip install "agentops==0.4.21" openai pytest

Only lesson 9, on the hosted dashboard, needs AGENTOPS_API_KEY from an AgentOps account, and you can read it without one. The other lessons send spans to a collector on your own machine.

Where init sends spans

Exampleendpoints.py
import inspect

from agentops.sdk.core import setup_telemetry

for name, parameter in inspect.signature(setup_telemetry).parameters.items():
    if "endpoint" in name:
        print(f"{name:18} {parameter.default}")
Example
python endpoints.py

setup_telemetry is the function init calls to create the exporters. Traces and metrics go to otlp.agentops.ai unless you pass other endpoints. Reading the source matters here: init also accepts exporter and processor arguments, but in version 0.4.21 setup_telemetry never uses them, so a custom exporter does not stop the default one.

What init takes

ArgumentWhat it does
api_keyYour AgentOps key, or AGENTOPS_API_KEY. Without it, the SDK logs a warning and still exports spans.
exporter_endpointWhere spans are sent. Lesson 2 points it at your machine.
endpointThe AgentOps API, used for authentication and log uploads.
auto_start_sessionStart a trace at init. The course starts traces explicitly.
instrument_llm_callsPatch installed LLM libraries such as openai to record their calls. On by default.
env_data_opt_outStop collecting host details such as the operating system.
Know where your data goes
A trace holds the text your agent handled. Before adding any observability tool to a customer's system, find out where it sends data and who can read it; this lesson's check takes a minute.
Try it yourself
  • Print every parameter of agentops.init with inspect.signature.
  • Find AuthenticatedOTLPExporter in agentops/sdk/ and read what it adds to each request.
  • Look for env_data_opt_out in the source and list what it collects.

Little by little, you're building something great.