Skip to main content
A ready-to-run example is available here!
Use ask_agent() to get quick responses from the agent about the current conversation state without interrupting the main execution flow.

Key Features

The ask_agent() method provides several important capabilities:

Context-Aware Responses

The agent has access to the full conversation history when answering questions:

Non-Intrusive Operation

Questions don’t interrupt the main conversation flow - they’re processed separately:

Works During and After Execution

You can ask questions while the agent is running or after it has completed:

Use Cases

  • Progress Monitoring: Check on long-running tasks
  • Status Updates: Get real-time information about agent activities
  • User Interfaces: Provide sidebar information in chat applications

Ready-to-run Example

This example is available on GitHub: examples/01_standalone_sdk/28_ask_agent_example.py
Example demonstrating the ask_agent functionality for getting sidebar replies from the agent for a running conversation. This example shows how to use ask_agent() to get quick responses from the agent about the current conversation state without interrupting the main execution flow.
examples/01_standalone_sdk/28_ask_agent_example.py
You can run the example code as-is.
The model name should follow the LiteLLM convention: provider/model_name (e.g., anthropic/claude-sonnet-4-5-20250929, openai/gpt-4o). The LLM_API_KEY should be the API key for your chosen provider.
ChatGPT Plus/Pro subscribers: You can use LLM.subscription_login() to authenticate with your ChatGPT account and access Codex models without consuming API credits. See the LLM Subscriptions guide for details.

Next Steps