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.1.tar.gz (25.4 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.1-py3-none-any.whl (30.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: eldros_sdk-0.2.1.tar.gz
  • Upload date:
  • Size: 25.4 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.1.tar.gz
Algorithm Hash digest
SHA256 684aac6d41c6552f433d8bd7de3946e2cd0b569f954c703a51a91836fceafbc4
MD5 a1f4ae6dcacd01e2ada88a0dab15099d
BLAKE2b-256 1e0a039e07607d65b4209de4059b25f12d731301d09a6b11cd9ed250dab5ebb6

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: eldros_sdk-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 30.6 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 94721583a8004c92928866c0aea0e5e9857b5bd8c352505657adcb016f91f61c
MD5 d867212f10d8a66c297da35e61e7925c
BLAKE2b-256 9fb0dd9050389f29db02185823ff167e4a2667ef2a8b4dfe5599339754c67c2d

See more details on using hashes here.

Provenance

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