This repo contains examples applications with steps to run these with Monocle tracing enabled in VS Code. Follow the steps listed below to configure dev environment and VS Code. Then navigate to individual examples folders to try out various agentic apps with Monocle.
This section illustrates steps to setup your VS Code to use Monocle.
- Visual Studio Code, version 1.102 or above
- Python, version 3.10 or above
- Github Copilot for VS Code enabled
- VS Code has MCP server enabled
- UV package installed
- Use
pipcommand to install UV package. Note that you should be installing this in a global python env on your machine and not in a local/virtual python env pip install uv- Restart VS Code if it's already running.
- Use
The Monocle VS Code extension makes it super simple to setup the instrumentation and visualize the traces
- Navigate to 'Extensions' open in VS Code
- In the search box, type Monocle
- From the search result list, choose extension 'Monocle' and click install
The Monocle MCP server contains a set of prompts to analyze traces and provide a recommendations. The MCP server is part of the monocle pip package that can be installed in VS Code and invoked by the VS Code's Github Copilot.
- Goto VS code Command Pelette by using following keystrokes
- Windows and Linux: Press Ctl + Shift + P
- MacOS: Press Cmd + Shift + P
- Type following command and press enter
- MCP: Add Server
- Select 'Pip package' option
- When prompted for package name, enter
monocle_apptrace - Allow VS Code to install this package
- When prompted to 'Enter Server ID', enter
monocle - When prompted for 'Select where to install', choose
Global - At thist point, VS Code will open a file called
mcp.jsonwhich contains the list of configured MCP servers. - Verify that the file has an entry
monocle
- Open a shell/terminal window
- Clone this git repository
- Goto repository folder (eg
cd examples) - Create python virtual envirmonment
python -m venv .env
Following are the python agentic examples. Please follow the steps in individual example Readme file to install the required libraries and run the app.
- Travel agent example implemented using Google ADK
- Travel agent example implemented using Langgraph
After you run the example, these steps outlines how to get insights from the trace.
- Open the trace json file under .monocle folder under the repository root
- Open Github copilot window pane
- Linux and Windows: Ctl + Shift + I
- Mac: Cmd + Shift + I
- Look up Monocle prompt to analyze trace from Monocle MCP server:
- Press '/' in the copilot chat windows
- It will list the available prompts.
- Select
mcp.monocle.analyzefrom that list
- This will extract a prompt from Monocle MCP server and show it in the Agent chat box
- Click the
Sendbutton at the bottom of the Agent chat box - Review the trace analysis generated by the Github copilot
