Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions cookbook/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

This cookbook collects small, focused recipes showing how to accomplish common tasks with the GitHub Copilot SDK across languages. Each recipe is intentionally short and practical, with copy‑pasteable snippets and pointers to fuller examples and tests.

## Prerequisites

Refer to the [Getting Started guide](../docs/getting-started.md#prerequisites) for installation instructions across all supported languages.

## Recipes by Language

### .NET (C#)
Expand All @@ -22,11 +26,16 @@ This cookbook collects small, focused recipes showing how to accomplish common t

### Python

- [Custom Agents](python/custom-agents.md): Create specialized agents with custom system prompts and behaviors.
- [Custom Providers](python/custom-providers.md): Implement custom model providers for specialized AI backends.
- [Custom Tools](python/custom-tools.md): Build custom tools to extend agent capabilities with domain-specific functions.
- [Error Handling](python/error-handling.md): Handle errors gracefully including connection failures, timeouts, and cleanup.
- [Multiple Sessions](python/multiple-sessions.md): Manage multiple independent conversations simultaneously.
- [Managing Local Files](python/managing-local-files.md): Organize files by metadata using AI-powered grouping strategies.
- [PR Visualization](python/pr-visualization.md): Generate interactive PR age charts using GitHub MCP Server.
- [MCP Servers](python/mcp-servers.md): Integrate Model Context Protocol servers for extended functionality.
- [Multiple Sessions](python/multiple-sessions.md): Manage multiple independent conversations simultaneously.
- [Persisting Sessions](python/persisting-sessions.md): Save and resume sessions across restarts.
- [PR Visualization](python/pr-visualization.md): Generate interactive PR age charts using GitHub MCP Server.
- [Streaming Responses](python/streaming-responses.md): Stream AI responses in real-time for better user experience.

### Go

Expand Down Expand Up @@ -80,7 +89,3 @@ go run <filename>.go

- Propose or add a new recipe by creating a markdown file in your language's `cookbook/` folder and a runnable example in `recipe/`
- Follow repository guidance in [CONTRIBUTING.md](../CONTRIBUTING.md)

## Status

Cookbook structure is complete with 4 recipes across all 4 supported languages. Each recipe includes both markdown documentation and runnable examples.
63 changes: 52 additions & 11 deletions cookbook/python/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,60 @@
# GitHub Copilot SDK Cookbook — Python

This folder hosts short, practical recipes for using the GitHub Copilot SDK with Python. Each recipe is concise, copy‑pasteable, and points to fuller examples and tests.
Practical recipes for the GitHub Copilot SDK with Python. Each recipe is self-contained and ready to run.

## Recipes
## Installation **Copilot CLI:**

- [Error Handling](error-handling.md): Handle errors gracefully including connection failures, timeouts, and cleanup.
- [Multiple Sessions](multiple-sessions.md): Manage multiple independent conversations simultaneously.
- [Managing Local Files](managing-local-files.md): Organize files by metadata using AI-powered grouping strategies.
- [PR Visualization](pr-visualization.md): Generate interactive PR age charts using GitHub MCP Server.
- [Persisting Sessions](persisting-sessions.md): Save and resume sessions across restarts.
Refer to the [Getting Started guide](../docs/getting-started.md#prerequisites) for installation instructions.

## Contributing
## 📚 Recipes

Add a new recipe by creating a markdown file in this folder and linking it above. Follow repository guidance in [CONTRIBUTING.md](../../CONTRIBUTING.md).
| Recipe | Level | Description |
| -------- | ------- | ------------- |
| [Error Handling](error-handling.md) | Beginner | Exceptions, retries, graceful shutdown |
| [Multiple Sessions](multiple-sessions.md) | Beginner | Managing independent conversations |
| [Persisting Sessions](persisting-sessions.md) | Beginner | Save and resume sessions |
| [Managing Local Files](managing-local-files.md) | Intermediate | AI-powered file organization |
| [Streaming Responses](streaming-responses.md) | Intermediate | Real-time response streaming |
| [Custom Tools](custom-tools.md) | Intermediate | Extend Copilot with custom tools |
| [PR Visualization](pr-visualization.md) | Intermediate | Generate PR analytics charts |
| [Custom Providers](custom-providers.md) | Advanced | BYOK for custom AI providers |
| [MCP Servers](mcp-servers.md) | Advanced | Model Context Protocol integration |
| [Custom Agents](custom-agents.md) | Advanced | Build specialized assistants |

## Status
## 🚀 Quick Start

This README is a scaffold; recipe files are placeholders until populated.
```bash
cd cookbook/python/recipe
pip install -r requirements.txt

# Run any recipe
python error_handling.py
python pr_visualization.py --repo github/copilot-sdk
```

## 📦 Requirements

- Python 3.9+ (supports up to 3.14)
- Copilot CLI installed and authenticated

## 🔧 Troubleshooting

| Issue | Solution |
| ------- | ---------- |
| `FileNotFoundError: Copilot CLI not found` | Install the Copilot CLI |
| `ConnectionError` | Check network and CLI status |
| `TimeoutError` | Increase timeout in `send_and_wait()` |

Enable debug logging:

```python
client = CopilotClient({"log_level": "debug"})
```

## 📝 Contributing

1. Add a Python file in `recipe/`
2. Add a matching `.md` file here
3. Update this README

See [CONTRIBUTING.md](../../CONTRIBUTING.md) for details.
Loading
Loading