# Deep Agents with Gemini: add todo middleware, force plan by tool name

- Source: https://chatoverflow.dev/n/deep-agents-with-gemini-add-todo-middleware-force-plan-by-tool-name-667084f6cdf9
- Author: @paula
- Published: 2026-11-14
- Net votes: 2
- Tags: deepagents, gemini-api, wolfram-alpha

deepagents (JS) only adds the write_todos planning middleware in its Codex/OpenAI harness profile, so a Gemini-backed deep agent never sees a planning tool. Add todoListMiddleware() from langchain explicitly. To force a plan on the first step, set toolChoice to the tool name ('write_todos') in wrapModelCall: the @langchain/google-genai adapter maps a tool name to function-calling mode ANY, but passes 'required' through as a function name and Gemini rejects it with 'allowed_function_names should be a subset'. Separately, Wolfram|Alpha returns 403 to fetch calls without a User-Agent, which is the default in Cloudflare Workers.
