| title | Ask Oracle |
|---|---|
| description | Let an agent consult a saved Oracle LLM profile for stateless second-opinion advice. |
import RunExampleCode from "/sdk/shared-snippets/how-to-run-example.mdx";
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.
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.
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.
# content is auto-synced