Lab 5: Exploring Different Execution Modes Challenge
Goalโ
Your task is to run and interact with your "Support Analyzer" agent using the three primary execution modes provided by the ADK CLI. Always run these commands from your main adk-training directory.
Environment setup: this lab modifies the
support_analyzerproject from Module 4, in place -- it's not a fresh project. If you're continuing the course in sequence,cdinto that project (inside youradk-trainingdirectory) and you're all set. If you're starting fresh at this module, you'll need that project first -- Module 4'slab-solution.mdhas the completesupport_analyzercode to recreate it, then come back here. Note thatlab-solution.mdusually only shows the contents ofagent.py; if that's not enough to get a working project (e.g. you still need to scaffold it withuv/adk create), check Module 4'slab.mdfor those setup steps.
Lab Tasksโ
uv run adk web:- Run the command
uv run adk web. - Note: When running from the parent directory, you don't need to specify the agent name; the Dev UI will allow you to select any agent in the subdirectories.
- Interact with your
support_analyzerin the Dev UI and inspect the "Trace" view to see the full prompt sent to the LLM.
- Run the command
uv run adk run:- Stop the web server (
Ctrl+C). - Run the command
uv run adk run support_analyzer. - Interact with the agent directly in your terminal.
- Stop the web server (
uv run adk api_server:- Stop the command-line runner.
- Run the command
uv run adk api_server. - Open a separate terminal window to act as the client.
- Step A (The Failure): Try to send a message without creating a session first. Copy and run this command:
Observe the error response. Why did it fail?
curl -X POST http://127.0.0.1:8000/run_sse \
-H "Content-Type: application/json" \
-d '{
"app_name": "support_analyzer",
"user_id": "test_user",
"session_id": "missing_session",
"new_message": {"role": "user", "parts": [{"text": "Hello"}]}
}' - Step B (The Fix): Create the session explicitly.
curl -X POST http://127.0.0.1:8000/apps/support_analyzer/users/test_user/sessions/test_session - Step C (Success): Now send the message again, targeting the session you just created (
test_session).curl -X POST http://127.0.0.1:8000/run_sse \
-H "Content-Type: application/json" \
-d '{
"app_name": "support_analyzer",
"user_id": "test_user",
"session_id": "test_session",
"new_message": {"role": "user", "parts": [{"text": "I am so happy with your service!"}]}
}' - Verify that you receive a stream of JSON responses containing the structured analysis (category, sentiment, summary).
Self-Reflection Questionsโ
- In what scenarios would the detailed "Trace View" in
uv run adk webbe more useful than the simple chat interface ofuv run adk run? - The
curlcommand in theuv run adk api_serversection is a simple example of a programmatic client. What kind of real-world applications could you build that would interact with your agent's API in this way? - Why is it necessary to run the
uv run adk api_serverand thecurlcommand in two separate terminal windows? What does this separation represent in a real-world application architecture?
๐ Reference Solution Vaultโ
Module 05 Reference Solution Vault
Active Comprehension Gate โข Zero Guessable URLs โข Guided Verification