Skip to main content
A ready-to-run example is available here!
Use ask_oracle when the active agent should ask a stronger or more specialized saved LLM profile for a second opinion without switching its own active profile.

When to Use It

ask_oracle is useful when an agent is stuck, comparing approaches, or wants another model to review a risky decision. The Oracle call is stateless from the Oracle’s point of view: it receives a dedicated Oracle system prompt plus the agent’s question and optional context, returns a text recommendation, and does not take over the conversation.

Configure the Oracle Profile

First save the LLM you want to use as the Oracle with LLMProfileStore. Then set oracle_llm_profile on OpenHandsAgentSettings to the saved profile name.
from openhands.sdk import LLM, OpenHandsAgentSettings

settings = OpenHandsAgentSettings(
    llm=LLM(model="openai/gpt-5-nano"),
    oracle_llm_profile="oracle",
)
agent = settings.create_agent()
When oracle_llm_profile is unset, the tool is not added. When it is set, the agent receives an ask_oracle tool and can consult that saved profile while keeping its regular LLM unchanged.

Ready-to-run Example

This example is available on GitHub: examples/01_standalone_sdk/54_ask_oracle_tool/main.py
examples/01_standalone_sdk/54_ask_oracle_tool/main.py
# content is auto-synced