| sidebar_position | 1 |
|---|---|
| title | Observe Your First Agent in WSO2 Agent Manager |
| description | Register an externally hosted agent, enable zero-code instrumentation, and view traces in the AMP Console. |
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';
This tutorial walks you through registering an externally-hosted agent with WSO2 Agent Manager, connecting it with zero-code instrumentation, and viewing its traces in the AMP Console.
WSO2 Agent Manager organises agents inside Projects.
- Open the AMP Console.
- Click the project switcher in the top navigation bar.
- Select an existing project (e.g. Default Project) or click + Create a Project, enter a name and description, then click Create.
- Inside your project, click + Add Agent.
- On the Add a New Agent screen, choose Externally-Hosted Agent — use this when your agent runs outside the AMP platform (locally, on your own infrastructure, or in a third-party cloud).
- Fill in the Agent Details:
- Name — e.g.
my-first-agent - Description (optional)
- Name — e.g.
- Click Register.
You are taken to the agent's Overview page. A Setup Agent panel opens automatically on the right.
The Zero-code Instrumentation Guide in the Setup Agent panel walks you through the setup steps. Use the Language dropdown at the top-right of the panel to select your agent's language — Python or Ballerina — and follow the corresponding instructions below.
pip install amp-instrumentationThis provides the ability to instrument your agent and export traces.
:::tip Using a virtual environment? Activate it before installing so the package is available on your path. :::
In the panel, select a Token Duration (e.g. 1 year) and click Generate. Copy the key immediately — it will not be shown again.
export AMP_OTEL_ENDPOINT="<INSTRUMENTATION_URL>"
export AMP_AGENT_API_KEY="<your-generated-api-key>"Set the above env variables.
Prefix your normal run command with amp-instrument:
amp-instrument <run_command>For example:
# Python script
amp-instrument python my_agent.py
# FastAPI / async service
amp-instrument uvicorn app:main --reload
# Poetry / uv managed projects
amp-instrument poetry run python agent.py
amp-instrument uv run python agent.pyNo changes to your agent code are required.
Add the following import to your Ballerina program:
import ballerinax/amp as _;Add the following to your Ballerina.toml to enable observability when building:
[build-options]
observabilityIncluded = trueEnable tracing and set the provider to AMP in your Config.toml:
[ballerina.observe]
tracingEnabled = true
tracingProvider = "amp"In the panel, select a Token Duration (e.g. 1 year) and click Generate. Copy the key immediately — it will not be shown again.
export BAL_CONFIG_VAR_BALLERINAX_AMP_OTELENDPOINT="<INSTRUMENTATION_URL>"
export BAL_CONFIG_VAR_BALLERINAX_AMP_APIKEY="<your-generated-api-key>"Set the above env variables.
Run your Ballerina program as usual:
bal runThe observability module is loaded automatically via the import.
Once your agent has handled a few requests:
- In the left sidebar, under OBSERVABILITY, click Traces.
- Each trace represents one end-to-end agent invocation. Click any trace to expand it:
- The root span shows end-to-end latency and the agent name.
- LLM spans show the model, token counts, and call latency.
- Tool spans show tool name, input, and output.