Implement generative AI and agentic solutions 2.3 Optimize and operationalize generative AI systems

An orchestrator agent invokes two sub-agents, and each sub-agent calls tools.

Study guide skill: Set up observability by implementing tracing, token analytics, safety signals, and latency breakdowns

Question B4-028

An orchestrator agent invokes two sub-agents, and each sub-agent calls tools. In the agent's traces, which follow the OpenTelemetry GenAI semantic conventions, you want to separate time spent in tool executions from time spent in sub-agent invocations. Which spans should you look at?

Select one answer.

  • A search_memory spans for tool executions, and execute_tool spans for sub-agent invocations
  • B invoke_workflow spans for tool executions, and plan spans for sub-agent invocations
  • C execute_tool spans for tool executions, and invoke_agent child spans under the orchestrator's invoke_agent span for sub-agent invocations ✓ Correct answer
  • D plan spans for tool executions, and invoke_workflow spans for sub-agent invocations

Answer: C

In the multi-agent conventions, execute_tool records a tool execution, and an invoke_agent child span under an invoke_agent span traces an invocation of another agent. A plan span records a planning or task decomposition phase, invoke_workflow invokes a coordinated workflow, and search_memory records a memory operation. Spans carry start and end times, so comparing these spans breaks down latency by step.

Deep dive

How it works

Foundry agent tracing follows the OpenTelemetry GenAI semantic conventions, extended for multi-agent workflows. Each span captures start and end times and attributes, and spans nest to show the full call stack, which is what lets you break latency down by step.

The span types to know:

  • invoke_agent: invokes an agent, remotely or in the same process. A child invoke_agent span under another invoke_agent span traces an invocation of another agent through the parent-child relationship.
  • execute_tool: a child span of invoke_agent or invoke_workflow that records a tool execution.
  • plan: a child of invoke_agent that records a planning or task decomposition phase.
  • invoke_workflow: invokes a coordinated workflow that contains agents or other generative AI operations.
  • create_memory, search_memory, update_memory, upsert_memory, delete_memory: memory operations.

For the orchestrator, tool time is in the execute_tool spans (under each sub-agent's span), and sub-agent time is in the child invoke_agent spans under the orchestrator's invoke_agent span.

The other options, and when you'd use them

  • search_memory for tools, execute_tool for sub-agents: search_memory records a memory operation, and execute_tool records tool executions, not agent invocations.
  • invoke_workflow for tools, plan for sub-agents: invoke_workflow invokes a workflow, and plan records planning.
  • plan for tools, invoke_workflow for sub-agents: Same mix-up the other way round. Neither span type traces a tool execution or an agent invocation.

Exam tip

Tool time = execute_tool. Sub-agent time = child invoke_agent. plan = planning, invoke_workflow = workflows, the memory spans = memory.

References

Last reviewed:

Ready to test yourself? The quiz asks this and every other AI-103 question, with instant feedback. Practice this in a quiz →

All Generative AI & agents questions · AI-103 study guide

Thanks for your feedback!