Python Agent
This repository ships two related packages:
| Package | PyPI name | Import | Role |
|---|---|---|---|
| otel-python-sdk | harness-sdk |
harness_sdk |
Generic OpenTelemetry-based instrumentation SDK (HTTP, gRPC, DB, GenAI, plugins). |
| Traceable agent | traceable-agent |
traceableai |
Extends the SDK with Traceable blocking (libtraceable), remote config, and sampling. Depends on harness-sdk. |
The SDK lives in otel-python-sdk/. The Traceable wrapper and native filter are under src/traceableai/.
Requirements: Python >= 3.10
Supported OS for libtraceable (blocking filter): Ubuntu 18.04+, CentOS 7+, Debian 10+, Amazon Linux 2+
Installation
Local development (both packages)
python3 -m venv venv
source venv/bin/activate
# Vendor GenAI instrumentation (needed for anthropic/openai tests and builds)
bash scripts/fetch-vendor.sh
python3 otel-python-sdk/scripts/bundle_vendor.py
# Editable SDK + Traceable agent
pip install -e "./otel-python-sdk[dev]"
pip install -r requirements.txt -r dev-requirements.txt
pip install -e .
Optional GenAI extras:
pip install -e "./otel-python-sdk[anthropic,openai,litellm]"
If grpc fails to compile, prepend: GRPC_PYTHON_BUILD_SYSTEM_ZLIB=true
Production install
pip install harness-sdk # SDK only
pip install traceable-agent # SDK + Traceable (includes libtraceable on supported Linux)
Configuration
Configuration is layered: defaults → YAML file → environment variables. Use separate files for SDK vs Traceable-specific settings.
| Setting | Config file env | Prefix | Examples |
|---|---|---|---|
| SDK (instrumentation, reporting, GenAI, plugins) | HA_CONFIG_FILE |
HA_* |
HA_SERVICE_NAME, HA_REPORTING_ENDPOINT, HA_CONTROL_PLUGINS |
| Traceable (blocking, remote config, sampling) | TA_CONFIG_FILE |
TA_* |
TA_BLOCKING_CONFIG_ENABLED, TA_REMOTE_CONFIG_ENABLED |
Legacy aliases AT_CONFIG_FILE / AT_* are still read for SDK settings during migration.
SDK config (HA_CONFIG_FILE)
Example agent-config.yaml:
service_name: my-service
enabled: true
reporting:
endpoint: http://localhost:4318/v1/traces
trace_reporter_type: OTLP # or ZIPKIN
secure: false
token: ""
data_capture:
http_headers:
request: true
response: true
http_body:
request: true
response: true
body_max_size_bytes: 131072
propagation_formats: ["TRACECONTEXT", "B3"]
gen_ai:
enabled: true
payload_capture_enabled: true
payload_evaluation_enabled: true
plugins:
control: [] # e.g. custom control plugins by name
observability:
- builtin_pipeline
- builtin_span_attributes
Point the agent at the file:
export HA_CONFIG_FILE=/path/to/agent-config.yaml
Common environment overrides:
export HA_SERVICE_NAME=my-service
export HA_REPORTING_ENDPOINT=http://otel-collector:4318/v1/traces
export HA_REPORTING_TRACE_REPORTER_TYPE=OTLP
export HA_ENABLED=true
export HA_GEN_AI_ENABLED=true
export HA_CONTROL_PLUGINS=traceable # comma-separated control plugin names
export HA_ENABLE_CONSOLE_SPAN_EXPORTER=true # dev only: print spans to stdout
Traceable config (TA_CONFIG_FILE)
Example traceable-config.yaml:
blocking_config:
enabled: true
evaluate_body: true
max_recursion_depth: 20
remote_config:
enabled: true
endpoint: localhost:5442
poll_period_seconds: 30
sampling:
enabled: false
export TA_CONFIG_FILE=/path/to/traceable-config.yaml
export TA_REMOTE_CONFIG_ENABLED=false # disable remote config polling in dev/tests
For integration tests, see test/traceableai/agent/integration-agent-config.yaml and test/traceableai/agent/traceable-integration-config.yaml.
Usage
SDK only (harness_sdk)
Use when you want instrumentation and OTLP/ZIPKIN export without Traceable blocking or remote config.
Code-based instrumentation
from harness_sdk.agent import Agent
app = Flask(__name__)
agent = Agent()
agent.instrument(app) # Flask + other supported libraries
Auto-instrumentation
export HA_CONFIG_FILE=/path/to/agent-config.yaml
harness-instrument flask run -p 5000
Traceable agent (traceableai)
Use for production Traceable deployments (blocking, remote config, libtraceable).
Code-based instrumentation
from traceableai.agent import Agent
app = Flask(__name__)
agent = Agent()
agent.instrument(app)
# Prefer plugins.control in HA_CONFIG_FILE; this remains for backward compatibility:
agent.add_traceable_filter()
Recommended: enable the Traceable control plugin via config instead of calling add_traceable_filter():
# agent-config.yaml (HA_CONFIG_FILE)
plugins:
control:
- traceable
Auto-instrumentation
export HA_CONFIG_FILE=/path/to/agent-config.yaml
export TA_CONFIG_FILE=/path/to/traceable-config.yaml
traceableai-instrument flask run -p 5000
traceableai-instrument loads sitecustomize, starts the agent, auto-instruments supported libraries, and registers the Traceable control plugin (unless deferred for gunicorn post-fork).
Developing
python3 -m venv venv
source venv/bin/activate
bash scripts/fetch-vendor.sh
python3 otel-python-sdk/scripts/bundle_vendor.py
pip install -e "./otel-python-sdk[dev,anthropic,openai,litellm]"
pip install -r requirements.txt -r dev-requirements.txt
pip install -e .
Testing
SDK unit tests (matches CI “SDK Unit Tests”):
./scripts/run-sdk-unit-tests.sh
# Full integration tests (mysql/postgres/docker):
RUN_SDK_INTEGRATION_TESTS=1 ./scripts/run-sdk-unit-tests.sh
Traceable unit tests (from repo root; skips native filter and duplicate instrumentation tree):
python3 -m pytest \
--ignore=test/traceableai/agent/instrumentation
Integration services (optional):
cd test/externalServices && docker compose up -d
Building
pip install -r requirements.txt
python3 -m build
# Or all wheel variants:
# CIBW_SKIP="*37* *38* ..." ./build_artifacts.sh
Docker-based unit test image (legacy):
docker build -f docker/test_apps/unittest.Dockerfile -t pythonunittest .
docker run --rm pythonunittest
Updating libtraceable
- Edit
./download.pyand bumpLIBTRACEABLE_VERSION(must be a published tag;python3 download.pyfetches the.soandlibtraceable.hfor it, and the cffi bindings are generated from that header at build time). - Run the unit tests and a real wheel build; mock-based tests do not exercise the C struct layout.
Updating protos
git submodule update --init --recursive
./scripts/build_proto.sh
Metadata
Release files for traceable-agent 2.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| traceable_agent-2.4.1.tar.gz | 20.7 kB | Without provenance | Details for traceable_agent-2.4.1.tar.gz |
Built distributions (wheels)
Total release size: 130.7 MB
Release files / traceable_agent-2.4.1.tar.gz
| Download URL | traceable_agent-2.4.1.tar.gz |
|---|---|
| Size | 20.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c2a0f569f415e5dbd0b4c14ab539423519bf916a05250710dfafffb4d0f0cefd
|
|
BLAKE2b-256 checksum How to use checksums |
62b6381d44d902f54fd2d3b4fa720867d6213a51eeb0f4eca570f45b4e27cc24
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / traceable_agent-2.4.1-cp314-cp314-musllinux_1_2_x86_64.whl
| Download URL | traceable_agent-2.4.1-cp314-cp314-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 13.6 MB |
| Tags | CPython 3.14 Linux musl 1.2+ x86-64 |
|
SHA-256 checksum How to use checksums |
ef00a062845e8c518395d3507ffe392f7de02c1536f3a99c6cd7e5f058bee6b5
|
|
BLAKE2b-256 checksum How to use checksums |
7342f9a42933e529565f87be5b80eb253d1df9c4503c9e1533898ca0638a769e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / traceable_agent-2.4.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | traceable_agent-2.4.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 12.5 MB |
| Tags | CPython 3.14 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
6735f9376b9e5181a8165503d3cd56df842ac29917c04b5d7298a484049e9806
|
|
BLAKE2b-256 checksum How to use checksums |
e3be871009250b0c21dc3e4effb93cf0e112e2914ff3cb6dfb294b1047ee953e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / traceable_agent-2.4.1-cp313-cp313-musllinux_1_2_x86_64.whl
| Download URL | traceable_agent-2.4.1-cp313-cp313-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 13.6 MB |
| Tags | CPython 3.13 Linux musl 1.2+ x86-64 |
|
SHA-256 checksum How to use checksums |
5aafac2f6b5a8b3410ae5360eb127504b8504276184416fc4f555d11ccb739c2
|
|
BLAKE2b-256 checksum How to use checksums |
d1267c84f0d9eb897ee0b5ae608d7176a4e70ddfcc0cbb9ba904b4c54e138dff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / traceable_agent-2.4.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | traceable_agent-2.4.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 12.5 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
ecfb28be22a85298edcf20ea86037c2006dc899c4995cd3667b0846724f2af5b
|
|
BLAKE2b-256 checksum How to use checksums |
bc91862f11376c6d00e64ced5916aae3e17ce5ff0bc3c73ae5dad607e2051ab4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / traceable_agent-2.4.1-cp312-cp312-musllinux_1_2_x86_64.whl
| Download URL | traceable_agent-2.4.1-cp312-cp312-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 13.6 MB |
| Tags | CPython 3.12 Linux musl 1.2+ x86-64 |
|
SHA-256 checksum How to use checksums |
47cd6af466255a521facb78787e105db1270f6d9649fba4e66b77e000a13e899
|
|
BLAKE2b-256 checksum How to use checksums |
17116e0bc4493db342e7c5e659132817469418d5a08409e631493dfa1cff1208
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / traceable_agent-2.4.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | traceable_agent-2.4.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 12.5 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
6a53aa443901e5b1f8ecd97d90b7d1797ddb6077fcae74ed7dea36c2a27ec974
|
|
BLAKE2b-256 checksum How to use checksums |
6ecc04cd2e47530e7239a0d6266cb77b6ffec1232b54bb36c0d9b194cd3ebc35
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / traceable_agent-2.4.1-cp311-cp311-musllinux_1_2_x86_64.whl
| Download URL | traceable_agent-2.4.1-cp311-cp311-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 13.6 MB |
| Tags | CPython 3.11 Linux musl 1.2+ x86-64 |
|
SHA-256 checksum How to use checksums |
d4bf7015218896b156b821555ddec0981fb19feb33c5ee664dea08da9dd3ff62
|
|
BLAKE2b-256 checksum How to use checksums |
18d2b735110191be06bc7da0ff134f8d79b14984f1893be2516119eeff23cf1e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / traceable_agent-2.4.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | traceable_agent-2.4.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 12.5 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
9af1406f8f87752fe2d416ec1756e5f7563a8324df60468999a07dc674dddece
|
|
BLAKE2b-256 checksum How to use checksums |
e8e0c3beb48097ff7ad8381d586765db5db6d5569955115da892444341aad45b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / traceable_agent-2.4.1-cp310-cp310-musllinux_1_2_x86_64.whl
| Download URL | traceable_agent-2.4.1-cp310-cp310-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 13.6 MB |
| Tags | CPython 3.10 Linux musl 1.2+ x86-64 |
|
SHA-256 checksum How to use checksums |
6578e8597add1ab9566560a6bcd9a1d3c3987c6ff75c8537060f64dc06ee5637
|
|
BLAKE2b-256 checksum How to use checksums |
c8cfbca3bd66db813245929af79e5cdd223bb2d44c4f441b9e958fdb2cbd452b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / traceable_agent-2.4.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | traceable_agent-2.4.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 12.5 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
635637c3565746fdd2b79e010afe67401017dfd3d776ffc461f08170538f2611
|
|
BLAKE2b-256 checksum How to use checksums |
c2e45bafb47ee9cf4cd6e4a509e98dabb4a1dc03060191216febe102fec5f7a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for traceable-agent 2.4.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.