Pydantic Ai Github Agent banner
coleam00 coleam00

Pydantic Ai Github Agent

AI community

Description

The agent I built for my AI Agents series on YouTube - breaking down my entire process of building AI agents from idea to production!

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

Pydantic AI: GitHub Repository Analysis Agent

An intelligent GitHub repository analysis agent built using Pydantic AI, capable of analyzing GitHub repositories to answer user questions. The agent can fetch repository information, explore directory structures, and analyze file contents using the GitHub API.

Features

  • Repository information retrieval (size, description, etc.)
  • Directory structure analysis
  • File content examination
  • Support for both OpenAI and OpenRouter models
  • Available as both API endpoint and command-line interface

Prerequisites

  • Python 3.11+
  • GitHub Personal Access Token (for private repositories)
  • OpenRouter API key

Installation and Usage with Python

  1. Clone the repository:
git clone https://github.com/coleam00/ottomator-agents.git
cd ottomator-agents/pydantic-github-agent
  1. Install dependencies (recommended to use a Python virtual environment):
pip install -r requirements.txt
  1. Set up environment variables:
    • Rename .env.example to .env
    • Edit .env with your API keys and preferences:
    GITHUB_TOKEN=your_github_token  # Required for private repos
    OPEN_ROUTER_API_KEY=your_openrouter_api_key
    LLM_MODEL=your_chosen_model  # e.g., deepseek/deepseek-chat
    SUPABASE_URL=your_supabase_url  # Only needed for endpoint
    SUPABASE_SERVICE_KEY=your_supabase_key  # Only needed for endpoint

Running the FastAPI Endpoint

To run the agent as an API endpoint (also compatible with the oTTomator Live Agent Studio), run:

python github_agent_endpoint.py

The endpoint will be available at `http://localhost:8001`

Command Line Interface

For a simpler interactive experience, you can use the command-line interface:

python cli.py

Example queries you can ask: