def test_convert_complex_sample_session():
  """Test using the complex sample session provided earlier."""
  events = [
      build_event("user", [{"text": "What can you do?"}]),
      build_event(
          "root_agent",
          [{"text": "I can roll dice and check if numbers are prime. \n"}],
      ),
      build_event(
          "user",
          [{
              "text": (
                  "Roll a 8 sided dice and then check if 90 is a prime number"
                  " or not."
              )
          }],
      ),
      build_event(
          "root_agent",
          [{
              "func_name": "transfer_to_agent",
              "func_args": {"agent_name": "roll_agent"},
          }],
      ),
      # Skipping FunctionResponse events as they don't have text/functionCall
      # parts used by converter
      build_event(
          "roll_agent", [{"func_name": "roll_die", "func_args": {"sides": 8}}]
      ),
      # Skipping FunctionResponse
      build_event(
          "roll_agent",
          [
              {"text": "I rolled a 2. Now, I'll check if 90 is prime. \n\n"},
              {
                  "func_name": "transfer_to_agent",
                  "func_args": {"agent_name": "prime_agent"},
              },
          ],
      ),
      # Skipping FunctionResponse
      build_event(
          "prime_agent",
          [{"func_name": "check_prime", "func_args": {"nums": [90]}}],
      ),
      # Skipping FunctionResponse
      build_event("prime_agent", [{"text": "90 is not a prime number. \n"}]),
  ]
  session = Session(
      id="some_id",
      app_name="hello_world_ma",
      user_id="user",
      events=events,
  )
  expected = [
      {
          "query": "What can you do?",
          "expected_tool_use": [],
          "expected_intermediate_agent_responses": [],
          "reference": "I can roll dice and check if numbers are prime. \n",
      },
      {
          "query": (
              "Roll a 8 sided dice and then check if 90 is a prime number or"
              " not."
          ),
          "expected_tool_use": [
              {
                  "tool_name": "transfer_to_agent",
                  "tool_input": {"agent_name": "roll_agent"},
              },
              {"tool_name": "roll_die", "tool_input": {"sides": 8}},
              {
                  "tool_name": "transfer_to_agent",
                  "tool_input": {"agent_name": "prime_agent"},
              },  # From combined event
              {"tool_name": "check_prime", "tool_input": {"nums": [90]}},
          ],
          "expected_intermediate_agent_responses": [{
              "author": "roll_agent",
              "text": "I rolled a 2. Now, I'll check if 90 is prime. \n\n",
          }],  # Text from combined event
          "reference": "90 is not a prime number. \n",
      },
  ]

  actual = convert_session_to_eval_format(session)
  assert actual == expected
Test using the complex sample session provided earlier.
tests/unittests/cli/utils/test_evals.py