Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Python Quickstart Template

A ready-to-use template for building agentic applications with the GitHub Copilot SDK and Python.

Features

  • ✅ Pre-configured Python setup
  • ✅ Example custom tools (calculator, time)
  • ✅ Interactive CLI interface
  • ✅ Streaming responses
  • ✅ Environment variable support
  • ✅ Type hints and documentation

Quick Start

Option 1: Using venv (Standard)

  1. Create and activate virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  2. Install dependencies:

    pip install -r requirements.txt
  3. Create environment file:

    cp ../../.env.example .env
  4. Run the application:

    python src/main.py

Option 2: Using uv (Recommended, Faster)

  1. Create and activate virtual environment:

    uv venv
    source .venv/bin/activate  # On Windows: .venv\Scripts\activate
  2. Install dependencies:

    uv pip install -r requirements.txt
  3. Create environment file:

    cp ../../.env.example .env
  4. Run the application:

    python src/main.py

Project Structure

.
├── src/
│   ├── __init__.py    # Package marker
│   └── main.py        # Main application with example tools
├── requirements.txt   # Python dependencies
└── .env               # Environment variables (create from .env.example)

Customization

Adding Custom Tools

Edit src/main.py and add your tool using the @define_tool decorator:

@define_tool(description="Description of what your tool does")
async def my_tool(params: dict) -> dict:
    """
    Your tool documentation
    
    Args:
        params: Dictionary with your parameters
    """
    # Your tool logic here
    return {"result": "success"}

# Add to session:
session = await client.create_session({
    "tools": [my_tool, get_time, calculator],
})

Configuring the Model

Set the model in .env:

COPILOT_MODEL=gpt-4.1

Or modify directly in code:

session = await client.create_session({
    "model": "gpt-4.1",
})

Development

Installing Development Dependencies

pip install -r requirements.txt
pip install pytest black ruff mypy  # Optional dev tools

Code Formatting

black src/

Linting

ruff check src/

Type Checking

mypy src/

Next Steps

Troubleshooting

Issue: copilot: command not found

Solution: Install GitHub Copilot CLI:

gh extension install github/gh-copilot

Issue: Import errors

Solution: Ensure virtual environment is activated:

source venv/bin/activate  # or .venv/bin/activate
pip install -r requirements.txt

Issue: Module not found

Solution: Install in development mode:

pip install -e .