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 Langfuse credentials 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 Langfuse credentials from the Eldros platform at startup — you never configure Langfuse 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 Langfuse credentials — 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 Langfuse 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 Langfuse
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 Langfuse')
"

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.
  • Langfuse via OTLP/HTTP. No Langfuse SDK dependency — spans are exported as OTel protobuf over HTTP with basic auth.
  • 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 Langfuse 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.4.tar.gz (14.9 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.4-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: eldros_sdk-0.1.4.tar.gz
  • Upload date:
  • Size: 14.9 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.4.tar.gz
Algorithm Hash digest
SHA256 80b4e159db7c8e21be6dd84423fe1f6508ad3a8ce5ff0c2c9b835b06eb333cee
MD5 8cf5a6d0b901cb37e0a6145b86610282
BLAKE2b-256 db54754ebb061359e48787be240a1c1437d4b0585784a4935e4d79cae95ad6f4

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: eldros_sdk-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 17.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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5b6ca4ab94d88b242ec198feb23698735dd735872e96e07ae00ebbbc2d074306
MD5 df2534817968de92e83d3b004ec1e71f
BLAKE2b-256 56577c8ca4696e45a9a96a8be21f7ba33d125c3db10c17bef3c690847ea68c15

See more details on using hashes here.

Provenance

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