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.1.7.tar.gz (18.3 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.1.7-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: eldros_sdk-0.1.7.tar.gz
  • Upload date:
  • Size: 18.3 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.1.7.tar.gz
Algorithm Hash digest
SHA256 3e02f0d775537df56caa83b46868582f0910dca607558d831609bfb1072de6a1
MD5 94e6f30c4433fe56f3c27050cb13e9cd
BLAKE2b-256 839749cfcfd7069468f48bf1a2e04b0017763d329637a0e2882c70d4101d4283

See more details on using hashes here.

Provenance

The following attestation bundles were made for eldros_sdk-0.1.7.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.1.7-py3-none-any.whl.

File metadata

  • Download URL: eldros_sdk-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 21.1 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.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 f3c38a6d30353054a64f599b28f01480755a5441a34924df3a020272df168dc5
MD5 27d2d611334e7138139b229692d7970e
BLAKE2b-256 0d578dc9133f4c24f8ff5e12264419fade1b8b5183ff5944969f5b9b162faf9c

See more details on using hashes here.

Provenance

The following attestation bundles were made for eldros_sdk-0.1.7-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