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_credentials:', cfg.has_credentials)
"

# 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 {public_key, secret_key, host} for your org's Langfuse project. The Langfuse secret key is never stored on the client.
  • 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.2.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.2-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: eldros_sdk-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 ee2ecb774ed06885e73bfe98b6177b7ee5101ca5da1a0c4327dc57a2c294af11
MD5 050c0b1e8b97b5e6ed2bfba96940ceb9
BLAKE2b-256 c2e4af08cfaa9444428d591777226f71407ec90eeb1f31224d8139021bdc284f

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: eldros_sdk-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 400f1625442dc4fc0de2dc86c35c8819f4b5f2d2aef77bf502d385f9aa25b849
MD5 3f09dff6396922fb065fe8ea243af189
BLAKE2b-256 8931174c4bdb38c0c94da38781355915004f9f3fa190d2f896c160d4663e7ec8

See more details on using hashes here.

Provenance

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