Support for synchronous auth flow with separate re-entry #1724
Description
Description
I work on the Google ADK and we are adding support for PRM-based authentication. We would like to use the OAuthClientProvider reference library, but it is unfortunately incompatible with the existing ADK usage pattern.
Google ADK usage pattern
events = agent.run('call my tool') # without auth
for event in events:
# find auth request and handle it (e.g. open web url, etc.)
events = agent.run(/* auth response */)
for event in events:
# get tool call result
Reference for exact details (https://google.github.io/adk-docs/tools-custom/authentication)
This pattern requires that the authorization request URL be surfaced to the caller and the initial flow be ended, only to be re-started again later once the authorization code is available. This is similar to how the MCP typescript reference library functions, while the python library requires a continuous flow mediated by async callbacks.
If support for this additional pattern is acceptable with the python SDK maintainers, I'm able to make a contribution, and would like to get consensus on one of the following designs:
- Core implementation is refactored into the synchronous pattern, and the asynchronous pattern is maintained as a thin layer over this.
- A single implementation is maintained and accepts a constructor param governing which pattern it should use.
- A separate implementation is maintained for each pattern, re-using some core components of the library wherever possible.
Thanks!
References
No response
Activity
maxisbey commentedon Dec 8, 2025
Closing as duplicate - consolidated into #1743. The state machine / action-effect pattern proposed there directly enables the synchronous re-entry use case described here.