Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opentelemetry traces should include agent names and the executed Python code #1011

Closed
jploski opened this issue Mar 17, 2025 · 1 comment
Closed
Labels
enhancement New feature or request

Comments

@jploski
Copy link

jploski commented Mar 17, 2025

The current OTEL instrumentation does not output the agent names, which makes understanding multi-agent traces difficult (although confusingly enough it does output managed_agents). Instead of outputting "Step 1", it would be better to have "{agent.name} Step 1", same for "CodeAgent.run" - better "{agent.name} CodeAgent.run". Based on a quick hack, it seems that this can be improved simply by replacing span_name assignments in _wrappers.py (and maybe also by adding it to _smolagent_run_attributes).

Furthermore, given that Python execution errors are the most common type of errors occurring for CodeAgents during the runs, it is important that the actual Python code (not just error messages) is captured via OTEL. For that it seems like adding a _PythonExecutorWrapper similar to _ToolCallWrapper in _wrappers.py should be sufficient. (I got it to work with my LocalPythonExecutor, but I can't test it with other types, which is why I'm not providing a direct patch/PR.)

@jploski jploski added the enhancement New feature or request label Mar 17, 2025
@albertvillanova
Copy link
Member

Thanks, @jploski.

Feel free to open an issue in the GitHub repository of OpenTelemetry:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants