From eaf9de596e0e54cb5fdb94e7bd3239aad30b1f8c Mon Sep 17 00:00:00 2001 From: Chirag Patil Date: Tue, 6 Jan 2026 22:48:13 +0530 Subject: [PATCH] feat: rename jarvis to github_wizard, add GitHub MCP tools, and update docs --- README.md | 4 +++ agents/github_wizard/README.md | 23 ++++++++++++++++ agents/{jarvis => github_wizard}/__init__.py | 0 agents/github_wizard/agent.py | 23 ++++++++++++++++ agents/github_wizard/tools/github_mcp.py | 20 ++++++++++++++ agents/jarvis/agent.py | 28 -------------------- agents/jarvis/sub_agents/researcher.py | 22 --------------- agents/jarvis/tools/calculator.py | 13 --------- 8 files changed, 70 insertions(+), 63 deletions(-) create mode 100644 agents/github_wizard/README.md rename agents/{jarvis => github_wizard}/__init__.py (100%) create mode 100644 agents/github_wizard/agent.py create mode 100644 agents/github_wizard/tools/github_mcp.py delete mode 100644 agents/jarvis/agent.py delete mode 100644 agents/jarvis/sub_agents/researcher.py delete mode 100644 agents/jarvis/tools/calculator.py diff --git a/README.md b/README.md index 90f9184..1b8ea6f 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,10 @@ For production or clean local environments, use Docker. - **Tools**: Add functions to `agents//tools/` - **Main Logic**: Edit `agents//agent.py` +## Available Agents + +- **GitHub Wizard** (`agents/github_wizard`): An agent equipped with GitHub MCP tools to assist with repository tasks. Requires `GITHUB_TOKEN`. + ## Why not `adk web --session_service_uri ...`? ADK’s CLI defaults to local SQLite session storage unless you pass diff --git a/agents/github_wizard/README.md b/agents/github_wizard/README.md new file mode 100644 index 0000000..7ff021f --- /dev/null +++ b/agents/github_wizard/README.md @@ -0,0 +1,23 @@ +# GitHub Wizard Agent + +The **GitHub Wizard** is a specialized agent designed to assist with GitHub-related tasks using the Model Context Protocol (MCP). + +## Features + +- **GitHub Integration**: Connects to GitHub using the GitHub Copilot MCP server. +- **Task Assistance**: Helps answer questions and perform actions related to GitHub repositories, issues, and pull requests. + +## Configuration + +To use this agent, you must provide a valid GitHub token. + +1. Obtain a GitHub Personal Access Token (PAT) with appropriate permissions. +2. Set the `GITHUB_TOKEN` environment variable in your `.env` file or environment. + +```env +GITHUB_TOKEN=your_github_token_here +``` + +## Tools + +- **GitHub MCP Tools**: Automatically loaded if `GITHUB_TOKEN` is present. diff --git a/agents/jarvis/__init__.py b/agents/github_wizard/__init__.py similarity index 100% rename from agents/jarvis/__init__.py rename to agents/github_wizard/__init__.py diff --git a/agents/github_wizard/agent.py b/agents/github_wizard/agent.py new file mode 100644 index 0000000..4e56e55 --- /dev/null +++ b/agents/github_wizard/agent.py @@ -0,0 +1,23 @@ +import os +from google.adk.agents.llm_agent import Agent +from google.adk.models.lite_llm import LiteLlm + +# Import tools +from .tools.github_mcp import github_mcp_tools + +api_base_url = "https://openrouter.ai/api/v1" + +root_agent = Agent( + model=LiteLlm( + model="openrouter/openai/gpt-oss-120b", + api_base=api_base_url, + api_key=os.getenv("OPENROUTER_API_KEY"), + ), + name="github_wizard", + description="A helpful assistant for GitHub related tasks.", + instruction=""" + Answer user questions to the best of your knowledge using the provided GitHub tools. + """, + # Give the agent tools to do its job + tools=github_mcp_tools, +) diff --git a/agents/github_wizard/tools/github_mcp.py b/agents/github_wizard/tools/github_mcp.py new file mode 100644 index 0000000..ee43ba3 --- /dev/null +++ b/agents/github_wizard/tools/github_mcp.py @@ -0,0 +1,20 @@ +import os +from google.adk.tools.mcp_tool.mcp_toolset import McpToolset, StreamableHTTPConnectionParams + +def _get_github_mcp_tools(): + github_token = os.getenv("GITHUB_TOKEN") + tools = [] + if github_token: + tools = [ + McpToolset( + connection_params=StreamableHTTPConnectionParams( + url="https://api.githubcopilot.com/mcp/", + headers={"Authorization": f"Bearer {github_token}"} + ) + ) + ] + else: + print("Warning: GITHUB_TOKEN not found. GitHub MCP tools will not be available.") + return tools + +github_mcp_tools = _get_github_mcp_tools() diff --git a/agents/jarvis/agent.py b/agents/jarvis/agent.py deleted file mode 100644 index 002827a..0000000 --- a/agents/jarvis/agent.py +++ /dev/null @@ -1,28 +0,0 @@ -import os -from google.adk.agents.llm_agent import Agent -from google.adk.models.lite_llm import LiteLlm - -# Import tools and sub-agents -from .tools.calculator import add_tool, multiply_tool -from .sub_agents.researcher import researcher_agent - -api_base_url = "https://openrouter.ai/api/v1" - -root_agent = Agent( - model=LiteLlm( - model="openrouter/openai/gpt-oss-20b", - api_base=api_base_url, - api_key=os.getenv("OPENROUTER_API_KEY"), - ), - name="root_agent", - description="A helpful assistant for user questions.", - instruction=""" - Answer user questions to the best of your knowledge. - You can use the 'researcher' agent for complex topics by using the transfer tool. - You have calculator tools for math. - """, - # Register the sub-agent structurally - sub_agents=[researcher_agent()], - # Give the agent tools to do its job (including transferring) - tools=[add_tool, multiply_tool], -) diff --git a/agents/jarvis/sub_agents/researcher.py b/agents/jarvis/sub_agents/researcher.py deleted file mode 100644 index 6df6ac2..0000000 --- a/agents/jarvis/sub_agents/researcher.py +++ /dev/null @@ -1,22 +0,0 @@ -import os -from google.adk.agents.llm_agent import Agent -from google.adk.models.lite_llm import LiteLlm - -def researcher_agent() -> Agent: - # Shared model config (could be different for this agent) - api_base_url = "https://openrouter.ai/api/v1" - model=LiteLlm( - model="openrouter/openai/gpt-oss-20b", - api_base=api_base_url, - api_key=os.getenv("OPENROUTER_API_KEY"), - ) - - return Agent( - model=model, - name="researcher", - description="Can perform detailed research on a topic.", - instruction=""" - You are a researcher. When asked to research something, provide a detailed summary. - If you don't know, just say you don't know. - """, - ) diff --git a/agents/jarvis/tools/calculator.py b/agents/jarvis/tools/calculator.py deleted file mode 100644 index eaf59a5..0000000 --- a/agents/jarvis/tools/calculator.py +++ /dev/null @@ -1,13 +0,0 @@ -from google.adk.tools import function_tool - -def add(a: int, b: int) -> int: - """Adds two integers.""" - return a + b - -def multiply(a: int, b: int) -> int: - """Multiplies two integers.""" - return a * b - -# Create tools that the Agent can use -add_tool = function_tool.FunctionTool(add) -multiply_tool = function_tool.FunctionTool(multiply)