Help - How to use Google Gemini Models with createDeepAgent

Hey,

TLDR: How do I get Gemini models to work with createDeepAgent?

createDeepAgent({
    model: 'google_genai:gemini-3-flash-preview',
    systemPrompt: buildSystemPrompt(config.utcISODate),
    tools: asDeepAgentTools(campaignTools),
  });
};

This code snippet is my setup, in my env vars I have GOOGLE_API_KEY setup properly and I am using the Google Gen AI API and not Google Vertex AI for context.

When the model is anthropic:claude-sonnet-4-20250514 and I have the ANTHROPIC_API_KEY this works fine. But for Gemini models for some reason this does not work and I get the following error when invoking the agent:

Unable to infer model provider for { model: google_genai:gemini-3-flash-preview }, please specify modelProvider directly.

For added context here are my package.json dependencies in case it’s to do with package versions:

"@langchain/community": "^1.0.0",
    "@langchain/core": "^1.0.6",
    "@langchain/google-genai": "^1.0.3",
    "@langchain/google-webauth": "^1.0.3",
    "@langchain/langgraph": "^1.0.0",
    "@langchain/openai": "^1.0.3",
    "countries-list": "^3.1.1",
    "deepagents": "^1.5.0",
    "langchain": "^1.0.6",
    "langsmith": "^0.3.80",
    "zod": "^3.24.1"

Appreciate any help :slight_smile:

hi @sa64r

try this:

createDeepAgent({
  model: "google-genai:gemini-3-flash-preview",
  systemPrompt: buildSystemPrompt(config.utcISODate),
  tools: asDeepAgentTools(campaignTools),
});
1 Like