Add Perplexity sample agent (Python)#273
Open
Yogeshp-MSFT wants to merge 2 commits intomicrosoft:mainfrom
Open
Add Perplexity sample agent (Python)#273Yogeshp-MSFT wants to merge 2 commits intomicrosoft:mainfrom
Yogeshp-MSFT wants to merge 2 commits intomicrosoft:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a Python Perplexity-based sample agent using the Microsoft Agent 365 SDK, including MCP tool integration, observability, notifications, and end-to-end setup documentation.
Changes:
- Introduces a Perplexity Responses API client with a multi-turn tool-call loop, argument enrichment, and auto-finalize behavior.
- Adds MCP server discovery + lightweight JSON-RPC client with retry/backoff and session caching across turns.
- Provides runnable aiohttp hosting, observability token caching, and comprehensive documentation + environment/dependency setup.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| python/perplexity/sample-agent/token_cache.py | Adds a simple in-memory cache for observability exporter tokens. |
| python/perplexity/sample-agent/pyproject.toml | Defines dependencies and uv configuration for the sample agent. |
| python/perplexity/sample-agent/perplexity_client.py | Implements Perplexity Responses API wrapper and tool-call orchestration loop. |
| python/perplexity/sample-agent/mcp_tool_registration_service.py | Implements MCP server discovery, schema sanitization, caching, and retrying tool executor. |
| python/perplexity/sample-agent/main.py | Adds server entry point, auth middleware setup, health endpoints, and observability config. |
| python/perplexity/sample-agent/hosting.py | Adds message routing, typing indicators, token exchange/caching, and notification handlers. |
| python/perplexity/sample-agent/agent_interface.py | Defines the async agent interface used by the hosting layer. |
| python/perplexity/sample-agent/agent.py | Orchestrates Perplexity calls, MCP tool wiring, and observability scopes. |
| python/perplexity/sample-agent/ToolingManifest.json | Declares default MCP servers (Mail, Calendar). |
| python/perplexity/sample-agent/README.md | Adds Quick Start, Playground testing, deployment, and troubleshooting docs. |
| python/perplexity/sample-agent/.gitignore | Ignores local secrets, venv, and generated deployment artifacts. |
| python/perplexity/sample-agent/.env.template | Documents required environment variables for local and production use. |
66e1b25 to
39db110
Compare
Author
|
Hi @gwharris7 can you review this pr? |
Author
|
HI @biswapm can you review this pr? |
…d improve observability token caching
c5b19d0 to
3b2f429
Compare
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.
Adds a Python sample agent using Perplexity AI (Agent API / Responses API) with the Microsoft Agent 365 SDK.
What's included
/v1/responsesendpointFiles