Problem Statement
I am trying to identify messages corresponding to an agent that is dynamically created using the workflow tool. Right now, the agent name which is under 'gen_ai.agent.name' attribute in a span, is always 'Strands Agents' which is the default. We have different 'trace_id' for different agent spans but its not clear how to form a map between the 'trace_id's and the agents.
Proposed Solution
Add 'task_id' value as agent's name while dynamically instantiating an agent for a task. This can be done when starting a workflow using the workflow tool's 'start' action.
Use Case
This will be useful in tracking agent interactions to generate input to the InteractionsEvaluator in strands/evals SDK for example. In the current setup, its difficult to identify messages corresponding to an agent that is created dynamically using the workflow tool.
Alternatives Solutions
If task_id cannot be used for some reason, we can add a new property 'name' to the task definition which will be assigned as the respective agent's name.
Additional Context
Below is the code snippet that would change in strands_tools/workflow.py in _create_task_agent() method of WorkflowManager class.
task_id = task.get("task_id")
task_agent = Agent(
name=task_id, #newly added line.
model=selected_model,
system_prompt=system_prompt,
tools=filtered_tools,
trace_attributes=(self.parent_agent.trace_attributes if self.parent_agent else None),
)``
Problem Statement
I am trying to identify messages corresponding to an agent that is dynamically created using the workflow tool. Right now, the agent name which is under 'gen_ai.agent.name' attribute in a span, is always 'Strands Agents' which is the default. We have different 'trace_id' for different agent spans but its not clear how to form a map between the 'trace_id's and the agents.
Proposed Solution
Add 'task_id' value as agent's name while dynamically instantiating an agent for a task. This can be done when starting a workflow using the workflow tool's 'start' action.
Use Case
This will be useful in tracking agent interactions to generate input to the InteractionsEvaluator in strands/evals SDK for example. In the current setup, its difficult to identify messages corresponding to an agent that is created dynamically using the workflow tool.
Alternatives Solutions
If task_id cannot be used for some reason, we can add a new property 'name' to the task definition which will be assigned as the respective agent's name.
Additional Context
Below is the code snippet that would change in strands_tools/workflow.py in _create_task_agent() method of WorkflowManager
class.