Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 21, 03:37 UTC
| 1 | --- |
| 2 | title: 'Gemini Manual Function Calling Runs as the Right User' |
| 3 | description: 'The Python Gemini provider no longer executes a manually handled function call as whichever user fetched the tools last' |
| 4 | date: '2026-10-27' |
| 5 | --- |
| 6 | |
| 7 | With Automatic Function Calling turned off, `GeminiProvider.handle_response(response)` in `composio-gemini` executed each function call with the executor stored by the latest `tools.get()` or `session.tools()` for that tool. When one `Composio` instance served several users, a call from Alice's conversation could run with Bob's `user_id` and connected account, and Bob's result went back into Alice's chat. The callables used by Automatic Function Calling were not affected. |
| 8 | |
| 9 | ### Bug Fixes |
| 10 | |
| 11 | - **Gemini** (`composio-gemini`): `handle_response` accepts `user_id=` or `session=`, with the same names as `GoogleProvider.handle_response` in `composio-google`. Each call runs exactly as the tool fetched for that user or Tool Router session would: validated against the schema from that fetch (including its schema modifiers), with the modifiers given to `tools.get()`, and through the session's routing, so local custom tools in a `COMPOSIO_MULTI_EXECUTE_TOOL` batch run in process. |
| 12 | - Without a user or session, `handle_response` keeps working for a process that has fetched tools for a single user or session. Once the provider has wrapped tools for more than one, it raises a `ValueError` instead of picking one, and executes nothing. |
| 13 | |
| 14 | **Before:** |
| 15 | |
| 16 | ```python |
| 17 | alice_tools = composio.tools.get(user_id="alice", tools=["GMAIL_FETCH_EMAILS"]) |
| 18 | bob_tools = composio.tools.get(user_id="bob", tools=["GMAIL_FETCH_EMAILS"]) |
| 19 | |
| 20 | # response comes from Alice's conversation |
| 21 | composio.provider.handle_response(response) |
| 22 | # The tool executed as bob |
| 23 | ``` |
| 24 | |
| 25 | **After:** |
| 26 | |
| 27 | ```python |
| 28 | composio.provider.handle_response(response, user_id="alice") |
| 29 | # The tool executes as alice |
| 30 | |
| 31 | composio.provider.handle_response(response) |
| 32 | # ValueError: tools were wrapped for more than one user or session |
| 33 | ``` |