Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

docs: fix Gemini Python example to use composio_gemini with google-genai (#3839)

Aditya Painuli183a274d9950
diff --git a/docs/content/docs/providers/google.mdx b/docs/content/docs/providers/google.mdx
index 52464a7b5..7a47a7afc 100644
--- a/docs/content/docs/providers/google.mdx
+++ b/docs/content/docs/providers/google.mdx
@@ -13,7 +13,7 @@ The Google provider formats Composio tools for [Gemini](https://ai.google.dev/)
<IntegrationContent value="gemini">
-The Google Generative AI provider transforms Composio tools into Gemini function declarations. Gemini is non-agentic, so the model returns function calls and you run the loop: execute each call with `composio.provider.executeToolCall`, feed the result back, and repeat until the model replies with text.
+In Python, the Gemini provider (`composio_gemini`) wraps Composio tools as typed callables, and the `google-genai` SDK's Automatic Function Calling executes tool calls inside the chat loop for you. In TypeScript, the Google provider transforms Composio tools into Gemini function declarations, and you run the loop: execute each call with `composio.provider.executeToolCall`, feed the result back, and repeat until the model replies with text.
<Steps>
<Step>
@@ -21,7 +21,7 @@ The Google Generative AI provider transforms Composio tools into Gemini function
<Tabs groupId="language" items={["Python", "TypeScript"]} persist>
<Tab value="Python">
-<PackageInstall ecosystem="python" packages="composio composio_google google-genai" />
+<PackageInstall ecosystem="python" packages="composio composio_gemini google-genai" />
</Tab>
<Tab value="TypeScript">
<PackageInstall packages="@composio/core @composio/google @google/genai" />
@@ -49,11 +49,11 @@ GOOGLE_API_KEY=xxxxxxxxx
<Tab value="Python">
```python
from composio import Composio
-from composio_google import GoogleProvider
+from composio_gemini import GeminiProvider
from google import genai
from google.genai import types
-composio = Composio(provider=GoogleProvider())
+composio = Composio(provider=GeminiProvider())
client = genai.Client()
# Create a session for your user
@@ -62,16 +62,11 @@ tools = session.tools()
config = types.GenerateContentConfig(tools=tools)
chat = client.chats.create(model="gemini-3-pro-preview", config=config)
-response = chat.send_message("Send an email to [email protected] with the subject 'Hello' and body 'Hello from Composio!'")
-
-# Agentic loop: keep executing tool calls until the model responds with text
-while response.function_calls:
- parts = []
- for fc in response.function_calls:
- result = composio.provider.execute_tool_call(user_id="user_123", function_call=fc)
- parts.append(types.Part.from_function_response(name=fc.name, response=result))
- response = chat.send_message(parts)
+# Automatic Function Calling executes tool calls inside the chat loop
+response = chat.send_message(
+ "Send an email to [email protected] with the subject 'Hello' and body 'Hello from Composio!'"
+)
print(response.text)
```
</Tab>
diff --git a/docs/tests/static/content.test.ts b/docs/tests/static/content.test.ts
index 15f4bde92..dcf154ab8 100644
--- a/docs/tests/static/content.test.ts
+++ b/docs/tests/static/content.test.ts
@@ -11,6 +11,7 @@ import { join, relative } from "path";
const DOCS_DIR = join(import.meta.dir, "../../content/docs");
const EXAMPLES_DIR = join(import.meta.dir, "../../content/examples");
const CHANGELOG_DIR = join(import.meta.dir, "../../content/changelog");
+const GOOGLE_PROVIDER_DOC = join(DOCS_DIR, "providers/google.mdx");
/** Recursively find all .mdx files */
async function findMdxFiles(dir: string): Promise<string[]> {
@@ -100,6 +101,19 @@ describe("Content - no empty pages", () => {
});
});
+describe("Content - provider compatibility", () => {
+ test("Gemini Python docs use the google-genai-compatible provider", async () => {
+ const content = await readFile(GOOGLE_PROVIDER_DOC, "utf-8");
+
+ expect(content).toContain(
+ '<PackageInstall ecosystem="python" packages="composio composio_gemini google-genai" />',
+ );
+ expect(content).toContain("from composio_gemini import GeminiProvider");
+ expect(content).toContain("Composio(provider=GeminiProvider())");
+ expect(content).not.toContain("composio_google google-genai");
+ });
+});
+
describe("Content - changelog validation", () => {
test("changelog files use MM-DD-YY naming pattern", async () => {
let entries;