Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
| 1 | from composio_google_adk import GoogleAdkProvider |
| 2 | from google.adk.agents import Agent |
| 3 | from google.adk.runners import Runner |
| 4 | from google.adk.sessions import InMemorySessionService |
| 5 | from google.genai import types |
| 6 | |
| 7 | from composio import Composio |
| 8 | |
| 9 | # ADK config |
| 10 | model = "gemini-2.0-flash" |
| 11 | app_name = "weather_sentiment_agent" |
| 12 | session_id = "1234" |
| 13 | user_id = "user1234" |
| 14 | |
| 15 | # Initialize composio tools |
| 16 | composio = Composio(provider=GoogleAdkProvider()) |
| 17 | tools = composio.tools.get(user_id=user_id, toolkits=["GITHUB"]) |
| 18 | |
| 19 | # Agent |
| 20 | weather_sentiment_agent = Agent( |
| 21 | name=app_name, |
| 22 | model=model, |
| 23 | instruction="You are a github utility agent with ability to interact with github APIs", |
| 24 | tools=tools, |
| 25 | ) |
| 26 | |
| 27 | # Session and Runner |
| 28 | session_service = InMemorySessionService() |
| 29 | session = session_service.create_session_sync( |
| 30 | app_name=app_name, |
| 31 | user_id=user_id, |
| 32 | session_id=session_id, |
| 33 | ) |
| 34 | runner = Runner( |
| 35 | agent=weather_sentiment_agent, |
| 36 | app_name=app_name, |
| 37 | session_service=session_service, |
| 38 | ) |
| 39 | |
| 40 | |
| 41 | # Agent Interaction |
| 42 | content = types.Content( |
| 43 | role="user", |
| 44 | parts=[ |
| 45 | types.Part( |
| 46 | text="Star github repository composiohq/composio", |
| 47 | ) |
| 48 | ], |
| 49 | ) |
| 50 | events = runner.run( |
| 51 | user_id=user_id, |
| 52 | session_id=session_id, |
| 53 | new_message=content, |
| 54 | ) |
| 55 | for event in events: |
| 56 | if ( |
| 57 | event.is_final_response() |
| 58 | and event.content is not None |
| 59 | and event.content.parts |
| 60 | and len(event.content.parts) > 0 |
| 61 | ): |
| 62 | print("Agent Response: ", event.content.parts[0].text) |