-
Notifications
You must be signed in to change notification settings - Fork 653
docs: update docs of python, introduce new recipes and fix few docs linking points #233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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>
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