Lesson 5: Multi-Agent Orchestration with OpenTelemetry¶
This lesson demonstrates sequential orchestration where multiple specialized agents work together in a defined sequence to analyze a complete investment portfolio, while implementing comprehensive OpenTelemetry tracing for observability.
Prerequisites¶
-
Install AI Toolkit for VS Code:
- Open Visual Studio Code
- Go to Extensions (Ctrl+Shift+X)
- Search for "AI Toolkit"
- Install the AI Toolkit extension by Microsoft
- Restart VS Code if needed
-
Configure AI Toolkit Tracing:
- Open the AI Toolkit panel in VS Code
- Navigate to the Agent and Workflow Tools section, then click on Tracing
- Click Start Collector to start the local OTLP trace collector
- The collector will start listening on
http://localhost:4317(gRPC) andhttp://localhost:4318(HTTP)
Getting Started¶
-
Switch to Lesson 5 directory:
-
Copy the configuration file from the Solutions directory:
Testing with OpenTelemetry¶
-
Ensure AI Toolkit is running:
- Check that the OTLP collector is started in VS Code AI Toolkit
- Verify it's listening on
localhost:4317
-
Run the enhanced application:
-
Test with portfolio analysis:
- Enter stock symbols:
MSFT, AAPL, NVDA - Observe comprehensive telemetry output in console
- Watch for OpenTelemetry activity traces with timing information
- Enter stock symbols:
-
View traces in AI Toolkit:
- In VS Code, open AI Toolkit panel
- Navigate to Tracing section
- Click "Refresh" to see new traces
- Select a trace to explore the span tree
- Review Input + Output tab for AI message flows
- Check Metadata tab for detailed trace information
Expected Behavior with OpenTelemetry¶
You should observe:
-
Sequential Agent Execution:
- Portfolio Research Agent gathers market data and news
- Risk Assessment Agent analyzes portfolio composition and risk
- Investment Advisor Agent provides recommendations
-
Comprehensive Telemetry Data:
- Console output shows OpenTelemetry activities with IDs and timing
- Each agent's execution is traced with performance metrics
- Complete workflow orchestration visibility
-
AI Toolkit Integration:
- Traces appear in VS Code AI Toolkit tracing view
- Span hierarchy shows workflow → individual agents
- Detailed metadata about model calls, token usage, and response IDs
-
Performance Monitoring:
- Total execution time displayed
- Individual agent timing visible in traces
- Memory and resource usage tracking
This enhanced lesson demonstrates how to build production-ready multi-agent systems with enterprise-grade observability using OpenTelemetry and the AI Toolkit for VS Code.