Skip to content
Discussion options

You must be logged in to vote

ParallelAgent also supports custom BaseAgent subclasses. It runs their async event streams concurrently; it does not automatically move synchronous work into separate threads.

Check the implementation of each custom agent's _run_async_impl. A synchronous HTTP request, time.sleep(), or a long computation inside that method blocks the shared event loop, even though the method is declared async.

For blocking I/O, use an async client and await it, or move the existing synchronous operation to a thread:

import asyncio

# Inside your custom agent's async _run_async_impl:
result = await asyncio.to_thread(blocking_extract, document)
# Yield your normal ADK Event containing the result here.

asynci…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by sanketpatil06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants