This repo includes a demo travel assistant built with Microsoft Agent Framework and instrumented with Monocle/Okahu tracing. You can run it locally to test interactive flight-booking conversations with server-managed OpenAI thread memory.
- Python 3.10+
- OpenAI API key
- (Optional) Okahu API key if you want to export traces to Okahu cloud
- (Optional) Okahu VS Code extension for trace inspection
python3 -m venv .venvMac/Linux
source .venv/bin/activateWindows (PowerShell)
.venv\Scripts\Activate.ps1pip install -r requirements.txtCopy .env.example to .env and fill in values:
cp .env.example .envThen configure:
OPENAI_API_KEY=<your-openai-api-key>
OPENAI_CHAT_MODEL_ID=gpt-4.1-miniNotes:
OPENAI_CHAT_MODEL_IDis the primary model variable used by this app.- You can also set
OPENAI_MODELorOPENAI_ASSISTANT_MODELas fallback values in code.
python ms_travel_agent.pyYou will get an interactive prompt:
- Type user requests directly in terminal
- Type
exitorquitto end the session
Install test dependencies:
pip install -r tests/requirements.txtRun tests with the venv interpreter (recommended):
python -m pytest tests/test_ms_travel_agent.pyUsing python -m pytest ensures pytest uses the same active virtual environment where dependencies are installed.
The test in tests/test_ms_travel_agent.py checks trace-level behavior rather than fixed text output:
- The
Flight Agentis invoked - The
book_flighttool is invoked - Traces are captured correctly for the turn
This is intentional because responses can vary by model/version and user phrasing.
- Pass: OpenAI credentials/model are valid and the agent run succeeds.
- Skip: Test auto-skips when OpenAI client initialization fails (missing key/model) or endpoint/model returns 404.
- Error at import: If
monocle_test_toolsis missing, install test deps withpip install -r tests/requirements.txt.
- Uses one agent:
Flight Agent - Uses one tool:
book_flight(from_airport, to_airport, travel_date) - Uses OpenAIAssistantsClient (OpenAI Assistants API)
- Maintains session context via server-managed thread IDs (
service_thread_id)
The app stores and reuses service_thread_id during the interactive run:
- First request creates an OpenAI thread
- App prints the thread ID (for example:
thread_...) - Next requests reuse that thread ID
- Model responds with conversation memory from prior turns
🧳 Flight Agent is ready.
Type your request and press Enter.
Type 'exit' or 'quit' to end.
[User]: Book a flight from BOM to JFK on 2026-12-15
[Agent]: ...successfully booked...
📋 Thread ID: thread_xxx
[User]: Also add a return flight on 2026-12-21
[Agent]: ...return flight booked...
[User]: What did we plan so far?
[Agent]: ...summarizes both flights...
Set one of these in .env:
OPENAI_CHAT_MODEL_ID(recommended)OPENAI_MODELOPENAI_ASSISTANT_MODEL
Set:
OPENAI_API_KEY=<your-key>
If telemetry exporter setup falls back to console, spans may print as JSON.
Use file-only exporter in code:
setup_monocle_telemetry(
workflow_name="okahu_demos_microsoft_travel_agent",
monocle_exporters_list="file",
)Also ensure shell/env does not override exporter unexpectedly:
unset MONOCLE_EXPORTERMonocle writes traces to local files (for example under .monocle/).
Use the Okahu/Monocle extension to open and inspect generated traces.
After opening a trace file in the extension, you can inspect the captured tool calls, agent turn flow, and request/response details for each step.
ms_travel_agent.py— main interactive apprequirements.txt— Python dependenciestests/test_ms_travel_agent.py— async trace-based test for tool/agent invocationtests/requirements.txt— test dependencies.env.example— safe template for required environment variables.gitignore— ignores.venv/,.env,.monocle/




