Skip to main content

OpenTelemetry-native tracing SDK for Eldros AI agents

Project description

eldros-sdk

OpenTelemetry-native tracing SDK for Eldros AI agents. One init() call resolves your trace config from the Eldros platform, wires up OpenTelemetry, and auto-instruments your LLM provider clients. Drop a @trace decorator on your handler and you get a root span per call.

You need exactly one thing: an Eldros API key (agt_...). The SDK resolves trace config from the Eldros platform at startup — you never configure the trace backend directly.

Install

pip install eldros-sdk              # core
pip install "eldros-sdk[claude-agent-sdk]"    # + Claude Agent SDK instrumentation via LangSmith
pip install "eldros-sdk[openai]"    # + OpenAI auto-instrumentation
pip install "eldros-sdk[anthropic]" # + Anthropic auto-instrumentation
pip install "eldros-sdk[all]"       # everything

Quick start

export ELDROS_API_KEY=agt_...
from eldros_sdk import init, trace

init()   # api_key is read from ELDROS_API_KEY

@trace
async def handle_conversation(user_message: str) -> str:
    # OpenAI / Anthropic calls in here are auto-instrumented as child spans.
    ...

init() blocks briefly at startup to call the Eldros platform and fetch your trace config — call it before starting your event loop (e.g. at module import time or in your if __name__ == "__main__" block).

Configuration

Every argument can come from an environment variable. Explicit init(...) kwargs win over env vars.

init() arg Env var Default
api_key ELDROS_API_KEY (required)
api_base_url ELDROS_API_BASE_URL (required until official domain is live)
traffic_type / env ELDROS_TRAFFIC_TYPE prod
instrument_claude_agent_sdk ELDROS_INSTRUMENT_CLAUDE_AGENT_SDK auto-detected (True if claude_agent_sdk installed)
instrument_openai ELDROS_INSTRUMENT_OPENAI auto-detected (True if [openai] extra installed)
instrument_anthropic ELDROS_INSTRUMENT_ANTHROPIC auto-detected (True if [anthropic] extra installed)
capture_content ELDROS_CAPTURE_CONTENT true
debug ELDROS_TRACE_DEBUG false
enabled ELDROS_TRACE_ENABLED true
  • enabled=False makes the whole SDK a no-op — safe to leave in any environment.
  • debug=True (or ELDROS_TRACE_DEBUG=true) also prints spans to the console.
  • capture_content=False strips prompt/response text from OpenAI and Anthropic spans. Note: for Claude Agent SDK, LangSmith always captures content regardless of this setting.

Decorator options

@trace(name="checkout", capture_io=True, attributes={"tier": "pro"})
def run(payload: dict) -> dict:
    ...

@trace supports sync functions, coroutines, sync generators, and async generators (the span stays open across the whole generation).

Claude Agent SDK instrumentation

Install the [claude-agent-sdk] extra — instrumentation is automatic:

pip install "eldros-sdk[claude-agent-sdk]"
import eldros_sdk

eldros_sdk.init()  # auto-detects claude-agent-sdk and instruments it

init() is the single entry point. LangSmith patches ClaudeSDKClient and routes spans through the global TracerProvider — alongside @trace and LLM spans. Requires ClaudeSDKClient (not the module-level query()).

To opt out: init(instrument_claude_agent_sdk=False).

If LANGSMITH_API_KEY is also set, traces go to both your LangSmith account and Eldros's trace backend simultaneously (hybrid mode).

Lifecycle

from eldros_sdk import flush, shutdown

flush()      # force-export buffered spans (e.g. end of a serverless invocation)
shutdown()   # flush + tear down the provider

Testing the SDK

# Verify credential resolution
ELDROS_API_KEY=agt_... python3 -c "
import eldros_sdk
cfg = eldros_sdk.init()
print('has_trace_config:', cfg.has_trace_config)
"

# Verify a span reaches your trace backend
ELDROS_API_KEY=agt_... python3 -c "
import eldros_sdk
eldros_sdk.init(debug=True)

@eldros_sdk.trace
def hello():
    return 'world'

hello()
eldros_sdk.flush()
print('done — check your trace backend')
"

Design notes

  • Credential resolution. On init(), the SDK calls GET {api_base_url}/resolve with your ELDROS_API_KEY in the X-Client-API-Key header and receives {endpoint, headers, project, backend}. The SDK applies these blindly to the OTLP exporter — no backend-specific logic.
  • OTLP/HTTP. No vendor SDK dependency — spans are exported as OTel protobuf over HTTP.
  • Additive OTel. If a TracerProvider already exists (Datadog, etc.) the SDK attaches its exporter to it instead of replacing it — spans flow to both destinations. Call init() before any other tracing setup so the SDK's provider is detected first.
  • Claude Agent SDK spans use the global provider. LangSmith detects the global TracerProvider set by init() and routes all Claude Agent SDK OTel spans through it. This means any SpanProcessor you add to the global provider also receives those spans — you can route to your own trace backend or any OTel backend alongside ours.
  • Auto-instrumentation is optional. Provider instrumentors are extras; if a provider library isn't installed the SDK logs and continues.
  • Safe by default. Spans are non-recording until init() runs, so @trace never breaks code even if init() is missing.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eldros_sdk-0.2.0.tar.gz (20.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

eldros_sdk-0.2.0-py3-none-any.whl (23.9 kB view details)

Uploaded Python 3

File details

Details for the file eldros_sdk-0.2.0.tar.gz.

File metadata

  • Download URL: eldros_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 20.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for eldros_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 249b95d50bb0e6f6ec7a03f2d3b502f5774a02cb756252e016696a3670b2bd38
MD5 220edf277b3a08c361e51c08c3abce6f
BLAKE2b-256 43a4450ab6a2740a9e8bd92565e3281c8a0f04831175360e9d91bedffc9d4cda

See more details on using hashes here.

Provenance

The following attestation bundles were made for eldros_sdk-0.2.0.tar.gz:

Publisher: publish.yml on sentient-xyz/eldros-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file eldros_sdk-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: eldros_sdk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 23.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for eldros_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fac6910432511c269de8736fec7a62348e4ed7eb6c43cebc9a36b20ea7451fbd
MD5 05d68d2540324953a685df6dec366819
BLAKE2b-256 e9976046a60fa8033e9d622a40ebc735d7b4dae4b92e8ebd4abcadbf8398bf57

See more details on using hashes here.

Provenance

The following attestation bundles were made for eldros_sdk-0.2.0-py3-none-any.whl:

Publisher: publish.yml on sentient-xyz/eldros-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page