# WSO2 Agent Manager Instrumentation

Zero-code OpenTelemetry instrumentation for Python agents using the Traceloop SDK, with trace visibility in the WSO2 Agent Manager.

## Overview[​](#overview "Direct link to Overview")

`amp-instrumentation` enables zero-code instrumentation for Python agents, automatically capturing traces for LLM calls, MCP requests, and other operations. It seamlessly wraps your agent’s execution with OpenTelemetry tracing powered by the Traceloop SDK.

## Features[​](#features "Direct link to Features")

* **Zero Code Changes**: Instrument existing applications without modifying code
* **Automatic Tracing**: Traces LLM calls, MCP requests, database queries, and more
* **OpenTelemetry Compatible**: Uses industry-standard OpenTelemetry protocol
* **Flexible Configuration**: Configure via environment variables
* **Framework Agnostic**: Works with any Python application built using a wide range of agent frameworks supported by the TraceLoop SDK

## Installation[​](#installation "Direct link to Installation")

```
pip install amp-instrumentation
```

## Quick Start[​](#quick-start "Direct link to Quick Start")

### 1. Register Your Agent[​](#1-register-your-agent "Direct link to 1. Register Your Agent")

First, register your agent at the [WSO2 Agent Manager](https://github.com/wso2/agent-manager) to obtain your agent API key and configuration details.

### 2. Set Required Environment Variables[​](#2-set-required-environment-variables "Direct link to 2. Set Required Environment Variables")

```
export AMP_OTEL_ENDPOINT="https://amp-otel-endpoint.com" # AMP OTEL endpoint
export AMP_AGENT_API_KEY="your-agent-api-key" # Agent-specific key generated after registration
```

### 3. Run Your Application[​](#3-run-your-application "Direct link to 3. Run Your Application")

Use the `amp-instrument` command to wrap your application run command:

```
# Run a Python script
amp-instrument python my_script.py

# Run with uvicorn
amp-instrument uvicorn app:main --reload

# Run with any package manager
amp-instrument poetry run python script.py
amp-instrument uv run python script.py
```

That's it! Your application is now instrumented and sending traces to the WSO2 Agent Manager.
