<CodeGroup>
    ```ts Google
    import { tool } from "langchain";
    import { TavilySearch } from "@langchain/tavily";
    import { createDeepAgent, type SubAgent } from "deepagents";
    import { z } from "zod";
    
    const internetSearch = tool(
      async ({
        query,
        maxResults = 5,
        topic = "general",
        includeRawContent = false,
      }: {
        query: string;
        maxResults?: number;
        topic?: "general" | "news" | "finance";
        includeRawContent?: boolean;
      }) => {
        const tavilySearch = new TavilySearch({
          maxResults,
          tavilyApiKey: process.env.TAVILY_API_KEY,
          includeRawContent,
          topic,
        });
        return await tavilySearch._call({ query });
      },
      {
        name: "internet_search",
        description: "Run a web search",
        schema: z.object({
          query: z.string().describe("The search query"),
          maxResults: z.number().optional().default(5),
          topic: z
            .enum(["general", "news", "finance"])
            .optional()
            .default("general"),
          includeRawContent: z.boolean().optional().default(false),
        }),
      },
    );
    
    const researchSubagent: SubAgent = {
      name: "research-agent",
      description: "Used to research more in depth questions",
      systemPrompt: "You are a great researcher",
      tools: [internetSearch],
      model: "google-genai:gemini-3.6-flash", // Optional override, defaults to main agent model
    };
    const subagents = [researchSubagent];
    
    const agent = createDeepAgent({
      model: "google_genai:gemini-3.6-flash",
      subagents,
    });
    ```

    ```ts OpenAI
    import { tool } from "langchain";
    import { TavilySearch } from "@langchain/tavily";
    import { createDeepAgent, type SubAgent } from "deepagents";
    import { z } from "zod";
    
    const internetSearch = tool(
      async ({
        query,
        maxResults = 5,
        topic = "general",
        includeRawContent = false,
      }: {
        query: string;
        maxResults?: number;
        topic?: "general" | "news" | "finance";
        includeRawContent?: boolean;
      }) => {
        const tavilySearch = new TavilySearch({
          maxResults,
          tavilyApiKey: process.env.TAVILY_API_KEY,
          includeRawContent,
          topic,
        });
        return await tavilySearch._call({ query });
      },
      {
        name: "internet_search",
        description: "Run a web search",
        schema: z.object({
          query: z.string().describe("The search query"),
          maxResults: z.number().optional().default(5),
          topic: z
            .enum(["general", "news", "finance"])
            .optional()
            .default("general"),
          includeRawContent: z.boolean().optional().default(false),
        }),
      },
    );
    
    const researchSubagent: SubAgent = {
      name: "research-agent",
      description: "Used to research more in depth questions",
      systemPrompt: "You are a great researcher",
      tools: [internetSearch],
      model: "openai:gpt-5.5", // Optional override, defaults to main agent model
    };
    const subagents = [researchSubagent];
    
    const agent = createDeepAgent({
      model: "google_genai:gemini-3.6-flash",
      subagents,
    });
    ```

    ```ts Anthropic
    import { tool } from "langchain";
    import { TavilySearch } from "@langchain/tavily";
    import { createDeepAgent, type SubAgent } from "deepagents";
    import { z } from "zod";
    
    const internetSearch = tool(
      async ({
        query,
        maxResults = 5,
        topic = "general",
        includeRawContent = false,
      }: {
        query: string;
        maxResults?: number;
        topic?: "general" | "news" | "finance";
        includeRawContent?: boolean;
      }) => {
        const tavilySearch = new TavilySearch({
          maxResults,
          tavilyApiKey: process.env.TAVILY_API_KEY,
          includeRawContent,
          topic,
        });
        return await tavilySearch._call({ query });
      },
      {
        name: "internet_search",
        description: "Run a web search",
        schema: z.object({
          query: z.string().describe("The search query"),
          maxResults: z.number().optional().default(5),
          topic: z
            .enum(["general", "news", "finance"])
            .optional()
            .default("general"),
          includeRawContent: z.boolean().optional().default(false),
        }),
      },
    );
    
    const researchSubagent: SubAgent = {
      name: "research-agent",
      description: "Used to research more in depth questions",
      systemPrompt: "You are a great researcher",
      tools: [internetSearch],
      model: "anthropic:claude-sonnet-4-6", // Optional override, defaults to main agent model
    };
    const subagents = [researchSubagent];
    
    const agent = createDeepAgent({
      model: "google_genai:gemini-3.6-flash",
      subagents,
    });
    ```

    ```ts OpenRouter
    import { tool } from "langchain";
    import { TavilySearch } from "@langchain/tavily";
    import { createDeepAgent, type SubAgent } from "deepagents";
    import { z } from "zod";
    
    const internetSearch = tool(
      async ({
        query,
        maxResults = 5,
        topic = "general",
        includeRawContent = false,
      }: {
        query: string;
        maxResults?: number;
        topic?: "general" | "news" | "finance";
        includeRawContent?: boolean;
      }) => {
        const tavilySearch = new TavilySearch({
          maxResults,
          tavilyApiKey: process.env.TAVILY_API_KEY,
          includeRawContent,
          topic,
        });
        return await tavilySearch._call({ query });
      },
      {
        name: "internet_search",
        description: "Run a web search",
        schema: z.object({
          query: z.string().describe("The search query"),
          maxResults: z.number().optional().default(5),
          topic: z
            .enum(["general", "news", "finance"])
            .optional()
            .default("general"),
          includeRawContent: z.boolean().optional().default(false),
        }),
      },
    );
    
    const researchSubagent: SubAgent = {
      name: "research-agent",
      description: "Used to research more in depth questions",
      systemPrompt: "You are a great researcher",
      tools: [internetSearch],
      model: "openrouter:openrouter:z-ai/glm-5.2", // Optional override, defaults to main agent model
    };
    const subagents = [researchSubagent];
    
    const agent = createDeepAgent({
      model: "google_genai:gemini-3.6-flash",
      subagents,
    });
    ```

    ```ts Fireworks
    import { tool } from "langchain";
    import { TavilySearch } from "@langchain/tavily";
    import { createDeepAgent, type SubAgent } from "deepagents";
    import { z } from "zod";
    
    const internetSearch = tool(
      async ({
        query,
        maxResults = 5,
        topic = "general",
        includeRawContent = false,
      }: {
        query: string;
        maxResults?: number;
        topic?: "general" | "news" | "finance";
        includeRawContent?: boolean;
      }) => {
        const tavilySearch = new TavilySearch({
          maxResults,
          tavilyApiKey: process.env.TAVILY_API_KEY,
          includeRawContent,
          topic,
        });
        return await tavilySearch._call({ query });
      },
      {
        name: "internet_search",
        description: "Run a web search",
        schema: z.object({
          query: z.string().describe("The search query"),
          maxResults: z.number().optional().default(5),
          topic: z
            .enum(["general", "news", "finance"])
            .optional()
            .default("general"),
          includeRawContent: z.boolean().optional().default(false),
        }),
      },
    );
    
    const researchSubagent: SubAgent = {
      name: "research-agent",
      description: "Used to research more in depth questions",
      systemPrompt: "You are a great researcher",
      tools: [internetSearch],
      model: "fireworks:accounts/fireworks/models/glm-5p2", // Optional override, defaults to main agent model
    };
    const subagents = [researchSubagent];
    
    const agent = createDeepAgent({
      model: "google_genai:gemini-3.6-flash",
      subagents,
    });
    ```

    ```ts Baseten
    import { tool } from "langchain";
    import { TavilySearch } from "@langchain/tavily";
    import { createDeepAgent, type SubAgent } from "deepagents";
    import { z } from "zod";
    
    const internetSearch = tool(
      async ({
        query,
        maxResults = 5,
        topic = "general",
        includeRawContent = false,
      }: {
        query: string;
        maxResults?: number;
        topic?: "general" | "news" | "finance";
        includeRawContent?: boolean;
      }) => {
        const tavilySearch = new TavilySearch({
          maxResults,
          tavilyApiKey: process.env.TAVILY_API_KEY,
          includeRawContent,
          topic,
        });
        return await tavilySearch._call({ query });
      },
      {
        name: "internet_search",
        description: "Run a web search",
        schema: z.object({
          query: z.string().describe("The search query"),
          maxResults: z.number().optional().default(5),
          topic: z
            .enum(["general", "news", "finance"])
            .optional()
            .default("general"),
          includeRawContent: z.boolean().optional().default(false),
        }),
      },
    );
    
    const researchSubagent: SubAgent = {
      name: "research-agent",
      description: "Used to research more in depth questions",
      systemPrompt: "You are a great researcher",
      tools: [internetSearch],
      model: "baseten:zai-org/GLM-5.2", // Optional override, defaults to main agent model
    };
    const subagents = [researchSubagent];
    
    const agent = createDeepAgent({
      model: "google_genai:gemini-3.6-flash",
      subagents,
    });
    ```

    ```ts Ollama
    import { tool } from "langchain";
    import { TavilySearch } from "@langchain/tavily";
    import { createDeepAgent, type SubAgent } from "deepagents";
    import { z } from "zod";
    
    const internetSearch = tool(
      async ({
        query,
        maxResults = 5,
        topic = "general",
        includeRawContent = false,
      }: {
        query: string;
        maxResults?: number;
        topic?: "general" | "news" | "finance";
        includeRawContent?: boolean;
      }) => {
        const tavilySearch = new TavilySearch({
          maxResults,
          tavilyApiKey: process.env.TAVILY_API_KEY,
          includeRawContent,
          topic,
        });
        return await tavilySearch._call({ query });
      },
      {
        name: "internet_search",
        description: "Run a web search",
        schema: z.object({
          query: z.string().describe("The search query"),
          maxResults: z.number().optional().default(5),
          topic: z
            .enum(["general", "news", "finance"])
            .optional()
            .default("general"),
          includeRawContent: z.boolean().optional().default(false),
        }),
      },
    );
    
    const researchSubagent: SubAgent = {
      name: "research-agent",
      description: "Used to research more in depth questions",
      systemPrompt: "You are a great researcher",
      tools: [internetSearch],
      model: "ollama:north-mini-code-1.0", // Optional override, defaults to main agent model
    };
    const subagents = [researchSubagent];
    
    const agent = createDeepAgent({
      model: "google_genai:gemini-3.6-flash",
      subagents,
    });
    ```
</CodeGroup>
