{"id":28308319,"url":"https://github.com/paulfruitful/gemini-tool-agent","last_synced_at":"2026-06-08T16:06:23.645Z","repository":{"id":294528083,"uuid":"987266732","full_name":"paulfruitful/gemini-tool-agent","owner":"paulfruitful","description":"This is a simple sdk for building gemini agents that can call tools + work with mcp servers","archived":false,"fork":false,"pushed_at":"2025-05-20T23:12:09.000Z","size":15,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-09T21:14:39.328Z","etag":null,"topics":["agents","ai","aiagentsframework","gemini","gemini-ai","mcp-client","mcp-server","python"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/gemini-tool-agent/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paulfruitful.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-20T20:27:42.000Z","updated_at":"2025-05-20T23:12:13.000Z","dependencies_parsed_at":"2025-06-21T12:42:20.784Z","dependency_job_id":null,"html_url":"https://github.com/paulfruitful/gemini-tool-agent","commit_stats":null,"previous_names":["paulfruitful/gemini-tool-agent"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/paulfruitful/gemini-tool-agent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulfruitful%2Fgemini-tool-agent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulfruitful%2Fgemini-tool-agent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulfruitful%2Fgemini-tool-agent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulfruitful%2Fgemini-tool-agent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paulfruitful","download_url":"https://codeload.github.com/paulfruitful/gemini-tool-agent/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulfruitful%2Fgemini-tool-agent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34069540,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-08T02:00:07.615Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agents","ai","aiagentsframework","gemini","gemini-ai","mcp-client","mcp-server","python"],"created_at":"2025-05-24T07:09:36.967Z","updated_at":"2026-06-08T16:06:23.628Z","avatar_url":"https://github.com/paulfruitful.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gemini Tool Agent\n\nA lightweight, tool-aware Gemini agent to handle structured prompts and tool usage in conversations.\n\n## Overview\n\nGemini Tool Agent is a Python library that provides a simple interface for creating tool-aware agents powered by Google's Gemini AI models. It enables developers to define custom tools with structured input schemas and seamlessly integrate them into conversational flows.\n\n## Features\n\n- Tool-aware conversation handling\n- Structured prompt processing\n- Automatic context management\n- JSON response parsing\n- Conversation history tracking\n\n## Installation\n\n```bash\npip install gemini-tool-agent\n```\n\n## Requirements\n\n- Python 3.8 or higher\n- Google Generative AI Python SDK (google-genai \u003e= 0.3.2)\n\n## Usage\n\n```python\nfrom gemini_tool_agent.agent import Agent\n\n# Initialize the agent with your API key\nagent = Agent(key=\"your-api-key\")\n\n# Define your tools\nagent.tools = [\n    {\n        \"name\": \"save_note\",\n        \"description\": \"Save a note to the database\",\n        \"input_schema\": {\n            \"title\": \"string\",\n            \"content\": \"string\"\n        }\n    }\n]\n\n# Process a query that might use tools\nresponse = agent.process_query(\"Save a note about AI agents\")\nprint(response)\n```\n\n## Response Format\n\nThe agent returns a structured response in JSON format:\n\n```json\n{\n  \"needs_tool\": true,\n  \"tool_name\": \"save_note\",\n  \"needs_direct_response\": true,\n  \"direct_response_first\": false,\n  \"reasoning\": \"The query explicitly asks to save a note, which requires the save_note tool\",\n  \"direct_response\": \"AI agents are software entities that can perform tasks autonomously...\"\n}\n```\n### Tool Parameter Extraction\n\nAfter identifying that a tool needs to be used, you can extract parameters from the conversation:\n\n```python\n# First process the query to determine if a tool is needed\nresponse = agent.process_query(\"Save a note titled 'AI Agents' with content about machine learning\")\n\n# If a tool is needed, extract the parameters\nif response.get(\"needs_tool\", False):\n    tool_name = response.get(\"tool_name\")\n    tool_params = agent.process_use_tool(tool_name)\n    \n    # Now you can use the extracted parameters to execute the tool\n    print(tool_params)\n    # Output: {'tool_name': 'save_note', 'input': {'title': 'AI Agents', 'content': '...'}}  \n    #You can then execute the tool with the extracted parameters\n```\n\n### Optimized Response Generation\n\nThe agent automatically handles large prompts for memory efficiency:\n\n```python\n# For direct usage (normally used internally by the agent)\nresponse_text = agent.generate_response(large_prompt)\n\n# The method automatically optimizes prompts over 10,000 characters by:\n# - Trimming conversation history to the most recent 15 lines when needed\n# - Truncating large direct responses while preserving start and end content\n```\n\n\n\n## Advanced Usage\n\nYou can access the conversation history:\n\n```python\n# Get the conversation history\nhistory = agent.history\n```\n\n## License\n\nMIT\n\n## Author\n\nPaul Fruitful (fruitful2007@outlook.com)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaulfruitful%2Fgemini-tool-agent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaulfruitful%2Fgemini-tool-agent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaulfruitful%2Fgemini-tool-agent/lists"}