Bird
0
0

You have three async agents: agentA, agentB, and agentC. agentC requires results from both agentA and agentB. Which async execution pattern correctly handles this dependency in Python?

hard📝 Application Q8 of 15
Agentic AI - Production Agent Architecture
You have three async agents: agentA, agentB, and agentC. agentC requires results from both agentA and agentB. Which async execution pattern correctly handles this dependency in Python?
ARun agentA and agentB concurrently with <code>asyncio.gather</code>, await their results, then run agentC with those results.
BRun agentC first, then run agentA and agentB concurrently.
CRun all three agents concurrently with <code>asyncio.gather</code> without awaiting intermediate results.
DRun agentA, agentB, and agentC sequentially without using async features.
Step-by-Step Solution
Solution:
  1. Step 1: Concurrently run agentA and agentB

    Use asyncio.gather(agentA(), agentB()) to run both simultaneously.
  2. Step 2: Await their results

    Wait for both to complete to get their outputs.
  3. Step 3: Run agentC with results

    Pass the awaited results to agentC and await its completion.
  4. Final Answer:

    Run agentA and agentB concurrently with asyncio.gather, await their results, then run agentC with those results. -> Option A
  5. Quick Check:

    Await dependencies before dependent agent runs [OK]
Quick Trick: Await dependencies before running dependent async agents [OK]
Common Mistakes:
  • Running dependent agent before dependencies complete
  • Running all agents concurrently ignoring dependencies
  • Not awaiting results before passing to dependent agent

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Agentic AI Quizzes