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, 04:45 UTC
| 1 | # composio-google-adk |
| 2 | |
| 3 | Adapts Composio tools to [Google ADK](https://google.github.io/adk-docs/) `FunctionTool` objects, so your ADK agents can take action across 1000+ apps. |
| 4 | |
| 5 | ## Installation |
| 6 | |
| 7 | ```bash |
| 8 | pip install composio composio-google-adk google-adk |
| 9 | ``` |
| 10 | |
| 11 | Set `COMPOSIO_API_KEY` (from the [dashboard](https://dashboard.composio.dev/settings)) and `GOOGLE_API_KEY` in your environment. |
| 12 | |
| 13 | ## Quickstart |
| 14 | |
| 15 | ```python |
| 16 | from composio import Composio |
| 17 | from composio_google_adk import GoogleAdkProvider |
| 18 | from google.adk.agents import Agent |
| 19 | from google.adk.runners import Runner |
| 20 | from google.adk.sessions import InMemorySessionService |
| 21 | from google.genai import types |
| 22 | |
| 23 | composio = Composio(provider=GoogleAdkProvider()) |
| 24 | |
| 25 | # Each Composio session is scoped to one of your users |
| 26 | composio_session = composio.create(user_id="user_123") |
| 27 | tools = composio_session.tools() |
| 28 | |
| 29 | agent = Agent( |
| 30 | name="personal_assistant", |
| 31 | model="gemini-2.0-flash", |
| 32 | instruction="You are a helpful assistant. Use Composio tools to take action.", |
| 33 | tools=tools, |
| 34 | ) |
| 35 | |
| 36 | session_service = InMemorySessionService() |
| 37 | session_service.create_session_sync( |
| 38 | app_name="personal_assistant", |
| 39 | user_id="user_123", |
| 40 | session_id="1234", |
| 41 | ) |
| 42 | runner = Runner( |
| 43 | agent=agent, |
| 44 | app_name="personal_assistant", |
| 45 | session_service=session_service, |
| 46 | ) |
| 47 | |
| 48 | events = runner.run( |
| 49 | user_id="user_123", |
| 50 | session_id="1234", |
| 51 | new_message=types.Content( |
| 52 | role="user", |
| 53 | parts=[types.Part(text="Star the repository composiohq/composio on GitHub")], |
| 54 | ), |
| 55 | ) |
| 56 | for event in events: |
| 57 | if event.is_final_response() and event.content and event.content.parts: |
| 58 | print(event.content.parts[0].text) |
| 59 | ``` |
| 60 | |
| 61 | For multi-turn use, store `composio_session.session_id` and reuse it with `composio.use(session_id)` instead of calling `create()` again. |
| 62 | |
| 63 | ## How tools are wrapped |
| 64 | |
| 65 | `GoogleAdkProvider` turns each Composio tool into a `google.adk.tools.FunctionTool` with a Python signature and docstring generated from the tool's schema, so ADK can pass them to Gemini as regular function declarations. |
| 66 | |
| 67 | ## Links |
| 68 | |
| 69 | - [Quickstart](https://docs.composio.dev/docs/quickstart) |
| 70 | - [Composio documentation](https://docs.composio.dev) |