Files
awesome-copilot/cookbook/copilot-sdk/dotnet/recipe
Anthony Shaw d8fc473383 Add RALPH-loop recipe to Copilot SDK cookbook
Add iterative RALPH-loop (Read, Act, Log, Persist, Halt) pattern
implementations for all four supported languages:

- C#/.NET: ralph-loop.cs with documentation
- Node.js/TypeScript: ralph-loop.ts with documentation
- Python: ralph_loop.py with documentation (async API)
- Go: ralph-loop.go with documentation

Each recipe demonstrates:
- Self-referential iteration where AI reviews its own output
- Completion promise detection to halt the loop
- Max iteration safety limits
- File persistence between iterations

Verified against real Copilot SDK APIs:
- Python: fully verified end-to-end with github-copilot-sdk
- Node.js: fully verified end-to-end with @github/copilot-sdk
- C#: compiles and runs successfully with GitHub.Copilot.SDK
- Go: compiles against github.com/github/copilot-sdk/go v0.1.23
2026-02-11 04:59:20 -08:00
..

Runnable Recipe Examples

This folder contains standalone, executable C# examples for each cookbook recipe. These are file-based apps that can be run directly with dotnet run.

Prerequisites

  • .NET 10.0 or later
  • GitHub Copilot SDK package (referenced automatically)

Running Examples

Each .cs file is a complete, runnable program. Simply use:

dotnet run <filename>.cs

Available Recipes

Recipe Command Description
Error Handling dotnet run error-handling.cs Demonstrates error handling patterns
Multiple Sessions dotnet run multiple-sessions.cs Manages multiple independent conversations
Managing Local Files dotnet run managing-local-files.cs Organizes files using AI grouping
PR Visualization dotnet run pr-visualization.cs Generates PR age charts
Persisting Sessions dotnet run persisting-sessions.cs Save and resume sessions across restarts

Examples with Arguments

PR Visualization with specific repo:

dotnet run pr-visualization.cs -- --repo github/copilot-sdk

Managing Local Files (edit the file to change target folder):

# Edit the targetFolder variable in managing-local-files.cs first
dotnet run managing-local-files.cs

File-Based Apps

These examples use .NET's file-based app feature, which allows single-file C# programs to:

  • Run without a project file
  • Automatically reference common packages
  • Support top-level statements

Learning Resources