{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "03b6eee8", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Testing endpoint: https://asia-southeast1-aiplatform.googleapis.com/v1/projects/angular-stacker-473507-t1/locations/asia-southeast1/reasoningEngines/734755242331078656:query\n", "Payload: {\n", " \"input\": {\n", " \"query\": \"List all available RAG corpora\"\n", " }\n", "}\n", "\n", "Sending request...\n", "\n", "Status Code: 400\n", "Response Headers: {'Vary': 'Origin, X-Origin, Referer', 'Content-Type': 'application/json; charset=UTF-8', 'Content-Encoding': 'gzip', 'Date': 'Thu, 20 Nov 2025 16:23:57 GMT', 'Server': 'scaffolding on HTTPServer2', 'X-XSS-Protection': '0', 'X-Frame-Options': 'SAMEORIGIN', 'X-Content-Type-Options': 'nosniff', 'Alt-Svc': 'h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000', 'Transfer-Encoding': 'chunked'}\n", "\n", "Response Body:\n", "{\n", " \"error\": {\n", " \"code\": 400,\n", " \"message\": \"Reasoning Engine Execution failed.\\nPlease refer to our documentation (https://cloud.google.com/vertex-ai/generative-ai/docs/agent-engine/troubleshooting/use) for checking logs and other troubleshooting tips.\\nError Details: {\\\"detail\\\":\\\"Agent Engine Error: Default method `query` not found. Available methods are: ['async_delete_session', 'async_search_memory', 'async_add_session_to_memory', 'list_sessions', 'register_feedback', 'async_list_sessions', 'get_session', 'async_get_session', 'delete_session', 'create_session', 'async_create_session'].\\\"}\",\n", " \"status\": \"FAILED_PRECONDITION\"\n", " }\n", "}\n" ] } ], "source": [ "import requests\n", "import subprocess\n", "import json\n", "\n", "# Get access token\n", "def get_access_token():\n", " result = subprocess.run(\n", " ['gcloud', 'auth', 'print-access-token'],\n", " capture_output=True,\n", " text=True\n", " )\n", " return result.stdout.strip()\n", "\n", "# Test the Reasoning Engine endpoint\n", "def test_reasoning_engine():\n", " url = \"https://asia-southeast1-aiplatform.googleapis.com/v1/projects/angular-stacker-473507-t1/locations/asia-southeast1/reasoningEngines/734755242331078656:query\"\n", " \n", " token = get_access_token()\n", " \n", " headers = {\n", " \"Authorization\": f\"Bearer {token}\",\n", " \"Content-Type\": \"application/json\"\n", " }\n", " \n", " # Test payload - adjust based on your agent's expected input\n", " payload = {\n", " \"input\": {\n", " \"query\": \"List all available RAG corpora\"\n", " }\n", " }\n", " \n", " print(f\"Testing endpoint: {url}\")\n", " print(f\"Payload: {json.dumps(payload, indent=2)}\")\n", " print(\"\\nSending request...\")\n", " \n", " response = requests.post(url, headers=headers, json=payload)\n", " \n", " print(f\"\\nStatus Code: {response.status_code}\")\n", " print(f\"Response Headers: {dict(response.headers)}\")\n", " print(f\"\\nResponse Body:\")\n", " print(json.dumps(response.json(), indent=2))\n", " \n", " return response\n", "\n", "if __name__ == \"__main__\":\n", " try:\n", " response = test_reasoning_engine()\n", " except Exception as e:\n", " print(f\"Error: {e}\")" ] }, { "cell_type": "code", "execution_count": null, "id": "2878a9fc", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "adk-rag-agent", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.13.5" } }, "nbformat": 4, "nbformat_minor": 5 }