Skip to main content

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_analyzer package from Module 4 in place inside your adk-training workspace directory. If you are continuing the course in sequence, stay in adk-training and verify support_analyzer/ is present. If you are starting fresh at this module, scaffold support_analyzer first using the setup steps and Reference Solution Vault at the bottom of Module 4's Challenge Lab.

Lab Tasks​

  1. 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_analyzer in the Dev UI and inspect the "Trace" view to see the full prompt sent to the LLM.
  2. 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.
  3. 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:
      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"}]}
      }'
      Observe the error response. Why did it fail?
    • 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).
  4. Bonus: uvx google-agents-cli playground:

    πŸ”­ Enterprise Preview (Covered in Depth in Part 6 β€” Module 30.1): google-agents-cli and agents-cli-manifest.yaml are 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-cli requires an agents-cli-manifest.yaml in a project root. To try a clean disposable preview without altering support_analyzer, scaffold a minimal prototype in /tmp and launch playground:
      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+C and cd back to your adk-training folder before continuing to Module 06!)

Self-Reflection Questions​

  • In what scenarios would the detailed "Trace View" in uv run adk web be more useful than the simple chat interface of uv run adk run?
  • The curl command in the uv run adk api_server section 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_server and the curl command in two separate terminal windows? What does this separation represent in a real-world application architecture?

πŸ” Reference Solution Vault​

πŸ§ͺ

05: Running Agents & Dev UI(Challenge Lab)

Part 1: Foundations β€’ Module 05

Overall Course Progress:
0%(0/98)
Next: 06: Programmatic Execution πŸ“– β†’