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
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 W3Ctraceparent + baggage headers with the test run’s identity. Continue them
with trace_context — same handler, one extra line around it:
trace_context accepts any header mapping.
HTTP / REST / A2A (per-request):
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 — andinit(enabled=False)hard-disables everything. - Exceptions inside a turn are recorded on the span and re-raised — capture never swallows your errors.