Skip to content

feat: support end_user_id for agentex agents & automatically include in spans - #477

Draft
smustaqa-scale wants to merge 1 commit into
mainfrom
sameer/default-user-identifier-in-traces
Draft

feat: support end_user_id for agentex agents & automatically include in spans#477
smustaqa-scale wants to merge 1 commit into
mainfrom
sameer/default-user-identifier-in-traces

Conversation

@smustaqa-scale

Copy link
Copy Markdown

Propagates a caller-supplied end_user_id onto trace spans automatically, so agents get end-user attribution without threading the value through their own code.

The identifier arrives as a new optional field on the four ACP routes (seen in companion agentex PR scaleapi/scale-agentex#386)

The framework then includes this field as a context var. Sync agent handling is simple, however temporal require a interceptor that harvests it from the workflow's start and signal args and rehydrates it per activity for async ones.

Trace.start_span then merges it into span.data, which has to happen at span construction rather than at export because export runs on a shared background task that no longer knows which request a given span came from.

Extensibility: Adding another request-scoped value (tenant id, correlation id, experiment variant) means widening one contextvar behind an allowlist rather than touching the tracing code.

@smustaqa-scale smustaqa-scale changed the title Support end_user_id for agentex agents & automatically include in spans feat: support end_user_id for agentex agents & automatically include in spans Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant