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 extends the
support_analyzerpackage from Module 4 in place inside youradk-trainingworkspace directory. If you are continuing the course in sequence, stay inadk-trainingand verifysupport_analyzer/is present. If you are starting fresh at this module, scaffoldsupport_analyzerfirst using the setup steps and Reference Solution Vault at the bottom of Module 4's Challenge Lab.
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).
- Bonus:
uvx google-agents-cli playground:π Enterprise Preview (Covered in Depth in Part 6 β Module 30.1):
google-agents-cliandagents-cli-manifest.yamlare optional enterprise AgentOps companions that you will master in Part 6 (Enterprise AgentOps with Google Agents CLI). You haven't missed an earlier moduleβfeel free to try this quick preview now or skip straight to the reflection questions!- Stop the API server (
Ctrl+C). - Prerequisite:
google-agents-clirequires anagents-cli-manifest.yamlin a project root. To try a clean disposable preview without alteringsupport_analyzer, scaffold a minimal prototype in/tmpand launchplayground:uvx google-agents-cli create demo-agent --agent adk --prototype --output-dir /tmp -y
cd /tmp/demo-agent
uvx google-agents-cli playground - Open the printed local URL in your browser to preview the AgentOps developer console. (Remember to
Ctrl+Candcdback to youradk-trainingfolder before continuing to Module 06!)
- Stop the API server (
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β
Official Solution Vault β Module 05
Locked Challenge β Active Pedagogical Socratic Gate