Skip to main content
Conversations are captured with the turn() API: plain function calls, so it drops into any server framework and is independent of your wire protocol — you hand Eldros the role and content directly.

The turn() API

Each turn() block records the user message on entry and the assistant reply via t.reply() — and because the turn is the active span while your handler runs, any auto-instrumented LLM call inside it nests underneath automatically. Transcript and trace land in one tree, with no ids to manage.
If the session id isn’t in scope where turns happen, call eldros_sdk.set_session(session_id) once at connect instead and omit the parameter.

Extra roles

Tool calls and other roles go through the same handle, or the low-level primitive:

Simulation traffic: continue the platform’s context

When Eldros simulates your agent, the connection it opens carries standard W3C traceparent + baggage headers with the test run’s identity. Continue them with trace_context — same handler, one extra line around it:
The same pattern works for any HTTP or WebSocket based agent — REST, A2A, JSON-RPC, or anything else. The protocol doesn’t matter; trace_context accepts any header mapping. HTTP / REST / A2A (per-request):
WebSocket (once at handshake, covers the whole connection):
Everything inside the block is stamped with the run’s episode.id and traffic_type="simulation", so test traffic stays out of your production views. On production connections the headers simply aren’t there and the line does nothing — keep one handler for both. Full model: Simulation & episodes.

Safe to leave in

  • No-op until init() runs — and init(enabled=False) hard-disables everything.
  • Exceptions inside a turn are recorded on the span and re-raised — capture never swallows your errors.