docs: update docs of python, introduce new recipes and fix few docs linking points#233
Closed
SilentDemonSD wants to merge 7 commits intogithub:mainfrom
Closed
docs: update docs of python, introduce new recipes and fix few docs linking points#233SilentDemonSD wants to merge 7 commits intogithub:mainfrom
SilentDemonSD wants to merge 7 commits intogithub:mainfrom
Conversation
* Initial plan * Wrap StreamJsonRpc exceptions with CopilotRpcException Co-authored-by: SteveSandersonMS <1101362+SteveSandersonMS@users.noreply.github.com> * Add explicit using System.IO for IOException Co-authored-by: SteveSandersonMS <1101362+SteveSandersonMS@users.noreply.github.com> * Only wrap RPC invocation calls in try-catch blocks Co-authored-by: SteveSandersonMS <1101362+SteveSandersonMS@users.noreply.github.com> * Remove implementation details from CopilotRpcException docs Co-authored-by: SteveSandersonMS <1101362+SteveSandersonMS@users.noreply.github.com> * Replace CopilotRpcException with IOException and add RPC wrapper methods Co-authored-by: SteveSandersonMS <1101362+SteveSandersonMS@users.noreply.github.com> * Catch RemoteRpcException, refactor Session.InvokeRpcAsync, remove unused using Co-authored-by: SteveSandersonMS <1101362+SteveSandersonMS@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: SteveSandersonMS <1101362+SteveSandersonMS@users.noreply.github.com>
- Remove type annotations (TYPE_CHECKING, type hints) from all 10 recipe files - Simplify function signatures for better readability - Create docs/core-concepts.md with common SDK concepts: - Architecture overview - Session lifecycle - Event types table - Error handling patterns - Custom tools, MCP, agents, providers - Simplify cookbook/python/README.md with link to core-concepts - Add new recipe files: custom_agents.py, custom_providers.py, custom_tools.py, mcp_servers.py, streaming_responses.py - Add new documentation: custom-agents.md, custom-providers.md, custom-tools.md, mcp-servers.md, streaming-responses.md - Fix requirements.txt path to local SDK - Update pyproject.toml for Python 3.13/3.14 support
…s multiple recipes and documentation updates. Added custom agents documentation and improved error handling patterns.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a complete Python cookbook with 10 practical recipes and enhances SDK documentation to include all four supported languages (Node.js/TypeScript, Python, Go, and .NET) for custom agents and MCP servers. It consolidates work from multiple related PRs (#138, #127, #214, #225) and addresses documentation issues (#166, #169).
Changes:
- New Python recipes: 10 comprehensive examples covering custom agents, providers, tools, error handling, file management, MCP servers, multiple sessions, persistence, PR visualization, and streaming
- Multi-language documentation: Updated
docs/custom-agents.md(new) anddocs/mcp.mdwith examples in all 4 languages - SDK improvements: Enhanced .NET error handling with
InvokeRpcAsyncwrapper, updated Python type definitions with expanded model list andSessionEventTypeexport
Reviewed changes
Copilot reviewed 34 out of 34 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
python/setup.py |
Updated Python version requirement from 3.8 to 3.9 |
python/pyproject.toml |
Added Python 3.13-3.14 support, upper version constraint |
python/copilot/types.py |
Exported SessionEventType, expanded model literal types |
dotnet/src/Client.cs |
Added InvokeRpcAsync wrapper for better error handling |
dotnet/src/Session.cs |
Refactored to use InvokeRpcAsync helper |
dotnet/test/SessionTests.cs |
Updated exception types from RemoteInvocationException to IOException |
dotnet/README.md |
Updated error handling examples |
docs/mcp.md |
Added multi-language quick start examples (Python, Go, .NET) |
docs/getting-started.md |
Updated SessionEventType import to use copilot.types |
docs/custom-agents.md |
New comprehensive guide with all 4 language examples |
cookbook/python/*.md |
10 new/updated recipe documentation files |
cookbook/python/recipe/*.py |
10 new recipe implementation files |
cookbook/python/recipe/requirements.txt |
Fixed SDK path reference |
cookbook/python/recipe/README.md |
Enhanced with SessionEventType reference and async patterns guide |
cookbook/python/README.md |
Complete rewrite with recipe listing and troubleshooting |
cookbook/README.md |
Updated Python recipe listings |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…g raised instead. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR adds a complete Python cookbook with practical recipes and enhances the SDK documentation and to include all four supported languages (Node.js/TypeScript, Python, Go, and .NET) for custom_agents.md and mcp.md in docs folder.
Changes
New Python Recipe Files (10 recipes)
custom_agents.py- Create specialized AI agents with custom prompts and behaviorscustom_providers.py- Implement custom model providers for specialized AI backendscustom_tools.py- Build custom tools to extend agent capabilitieserror_handling.py- Handle errors gracefully including retries and cleanupmanaging_local_files.py- AI-powered file organization using metadatamcp_servers.py- Model Context Protocol server integrationmultiple_sessions.py- Manage independent conversations simultaneouslypersisting_sessions.py- Save and resume sessions across restartspr_visualization.py- Generate PR analytics charts using GitHub MCP Serverstreaming_responses.py- Real-time response streaming patternsNew/Updated Documentation
docs/custom-agents.md- New comprehensive guide with all 4 language examplesdocs/mcp.md- Added multi-language Quick Start examplesdocs/getting-started.md- Updated with SessionEventType enum usagecookbook/python/README.md- Enhanced with all recipes and quick start guidecookbook/python/recipe/README.md- Added SessionEventType reference tablecookbook/README.md- Updated recipe listings for PythonCode Improvements
SessionEventTypeEnum fromcopilot.typesCo-ordination Points across all PRs and Issues
PR
Fix Issues
SessionConfig.modelshould bestrrather thanLiteral? #169Purpose