Skip to main content
Human-in-the-loop research: the agent proposes a plan, you refine it, then approve it to run the full research. The flow chains turns through previous_interaction_id:
  1. collaborative_planning=True → agent returns a research plan.
  2. collaborative_planning=True → refine the plan (optional).
  3. collaborative_planning=False → agent executes the approved plan.
collaborative_planning is read fresh on every request, so flipping it on the model between turns switches plan-mode to execute-mode within the same conversation.

Code

cookbook/90_models/google/gemini_interactions/deep_research_collaborative_planning.py
Mutating agent.model.collaborative_planning mid-conversation is safe only when the model instance is not shared across concurrent runs. For concurrent use, prefer two separate agents (a planner and an executor) sharing a session.

Usage

1

Set up your virtual environment

2

Set your API key

3

Install dependencies

4

Run Agent