Skip to content

Conversation

@yodeee9
Copy link

@yodeee9 yodeee9 commented Jan 30, 2026

Remove the fixed time.sleep(2) that ran after handling required_actions (tool execution) and before sending the next chat request in run_async.

Every tool-call round added a fixed 2-second wait for all users. The value 2 seconds is a magic number. It is not specified by the API, not configurable, and not justified by any documented OCI/GenAI requirement or constants.

And retry is already implemented at a lower level:

  • AgentClient builds GenerativeAiAgentRuntimeClient with retry_strategy=oci.retry.DEFAULT_RETRY_STRATEGY (agent_client.py ~line 116).
  • DEFAULT_RETRY_STRATEGY (src/oci/retry/init.py) retries on HTTP 429 (throttles) with exponential backoff (up to 8 attempts, 600s total).
  • So when _handle_chatclient.chat()_rt_client.chat() is called, the runtime client already retries on 429. The fixed 2s sleep does not replace or improve that; it only adds delay when no throttle occurs.

Copilot AI review requested due to automatic review settings January 30, 2026 05:14
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Jan 30, 2026
@yodeee9 yodeee9 changed the title Remove unjustified 2s sleep after tool execution in run_async in agent.py Remove unjustified 2s sleep after tool execution in run_async (ADK module) Jan 30, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes an unconditional 2-second delay that was applied after each tool-call round in run_async, eliminating unnecessary latency during agent execution.

Changes:

  • Removed the fixed time.sleep(2) call (and its throttle-related comment) from the run_async loop.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant