-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResearch Agent using ADK
More file actions
1 lines (1 loc) · 37 KB
/
Copy pathResearch Agent using ADK
File metadata and controls
1 lines (1 loc) · 37 KB
1
{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.11.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[],"dockerImageVersionId":31192,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"source":"<a href=\"https://www.kaggle.com/code/ankushkhakale/research-agent-using-adk?scriptVersionId=282265656\" target=\"_blank\"><img align=\"left\" alt=\"Kaggle\" title=\"Open in Kaggle\" src=\"https://kaggle.com/static/images/open-in-kaggle.svg\"></a>","metadata":{},"cell_type":"markdown"},{"cell_type":"markdown","source":"## Let's Install the ADK ","metadata":{}},{"cell_type":"code","source":"pip install google-adk","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-11-27T18:30:54.536127Z","iopub.execute_input":"2025-11-27T18:30:54.536782Z","iopub.status.idle":"2025-11-27T18:31:01.424015Z","shell.execute_reply.started":"2025-11-27T18:30:54.536757Z","shell.execute_reply":"2025-11-27T18:31:01.422805Z"}},"outputs":[{"name":"stdout","text":"Requirement already satisfied: google-adk in /usr/local/lib/python3.11/dist-packages (1.18.0)\nRequirement already satisfied: PyYAML<7.0.0,>=6.0.2 in /usr/local/lib/python3.11/dist-packages (from google-adk) (6.0.3)\nRequirement already satisfied: anyio<5.0.0,>=4.9.0 in /usr/local/lib/python3.11/dist-packages (from google-adk) (4.11.0)\nRequirement already satisfied: authlib<2.0.0,>=1.5.1 in /usr/local/lib/python3.11/dist-packages (from google-adk) (1.6.5)\nRequirement already satisfied: click<9.0.0,>=8.1.8 in /usr/local/lib/python3.11/dist-packages (from google-adk) (8.3.0)\nRequirement already satisfied: fastapi<1.119.0,>=0.115.0 in /usr/local/lib/python3.11/dist-packages (from google-adk) (0.116.1)\nRequirement already satisfied: google-api-python-client<3.0.0,>=2.157.0 in /usr/local/lib/python3.11/dist-packages (from google-adk) (2.177.0)\nRequirement already satisfied: google-cloud-aiplatform<2.0.0,>=1.125.0 in /usr/local/lib/python3.11/dist-packages (from google-cloud-aiplatform[agent-engines]<2.0.0,>=1.125.0->google-adk) (1.125.0)\nRequirement already satisfied: google-cloud-bigtable>=2.32.0 in /usr/local/lib/python3.11/dist-packages (from google-adk) (2.34.0)\nRequirement already satisfied: google-cloud-discoveryengine<0.14.0,>=0.13.12 in /usr/local/lib/python3.11/dist-packages (from google-adk) (0.13.12)\nRequirement already satisfied: google-cloud-secret-manager<3.0.0,>=2.22.0 in /usr/local/lib/python3.11/dist-packages (from google-adk) (2.25.0)\nRequirement already satisfied: google-cloud-spanner<4.0.0,>=3.56.0 in /usr/local/lib/python3.11/dist-packages (from google-adk) (3.56.0)\nRequirement already satisfied: google-cloud-speech<3.0.0,>=2.30.0 in /usr/local/lib/python3.11/dist-packages (from google-adk) (2.34.0)\nRequirement already satisfied: google-cloud-storage<4.0.0,>=3.0.0 in /usr/local/lib/python3.11/dist-packages (from google-adk) (3.5.0)\nRequirement already satisfied: google-genai<2.0.0,>=1.45.0 in /usr/local/lib/python3.11/dist-packages (from google-adk) (1.48.0)\nRequirement already satisfied: graphviz<1.0.0,>=0.20.2 in /usr/local/lib/python3.11/dist-packages (from google-adk) (0.21)\nRequirement already satisfied: mcp<2.0.0,>=1.8.0 in /usr/local/lib/python3.11/dist-packages (from google-adk) (1.20.0)\nRequirement already satisfied: opentelemetry-api<=1.37.0,>=1.37.0 in /usr/local/lib/python3.11/dist-packages (from google-adk) (1.37.0)\nRequirement already satisfied: opentelemetry-exporter-gcp-logging<2.0.0,>=1.9.0a0 in /usr/local/lib/python3.11/dist-packages (from google-adk) (1.11.0a0)\nRequirement already satisfied: opentelemetry-exporter-gcp-monitoring<2.0.0,>=1.9.0a0 in /usr/local/lib/python3.11/dist-packages (from google-adk) (1.11.0a0)\nRequirement already satisfied: opentelemetry-exporter-gcp-trace<2.0.0,>=1.9.0 in /usr/local/lib/python3.11/dist-packages (from google-adk) (1.11.0)\nRequirement already satisfied: opentelemetry-exporter-otlp-proto-http>=1.36.0 in /usr/local/lib/python3.11/dist-packages (from google-adk) (1.37.0)\nRequirement already satisfied: opentelemetry-resourcedetector-gcp<2.0.0,>=1.9.0a0 in /usr/local/lib/python3.11/dist-packages (from google-adk) (1.11.0a0)\nRequirement already satisfied: opentelemetry-sdk<=1.37.0,>=1.37.0 in /usr/local/lib/python3.11/dist-packages (from google-adk) (1.37.0)\nRequirement already satisfied: pydantic<3.0.0,>=2.0 in /usr/local/lib/python3.11/dist-packages (from google-adk) (2.12.4)\nRequirement already satisfied: python-dateutil<3.0.0,>=2.9.0.post0 in /usr/local/lib/python3.11/dist-packages (from google-adk) (2.9.0.post0)\nRequirement already satisfied: python-dotenv<2.0.0,>=1.0.0 in /usr/local/lib/python3.11/dist-packages (from google-adk) (1.2.1)\nRequirement already satisfied: requests<3.0.0,>=2.32.4 in /usr/local/lib/python3.11/dist-packages (from google-adk) (2.32.5)\nRequirement already satisfied: sqlalchemy-spanner>=1.14.0 in /usr/local/lib/python3.11/dist-packages (from google-adk) (1.17.1)\nRequirement already satisfied: sqlalchemy<3.0.0,>=2.0 in /usr/local/lib/python3.11/dist-packages (from google-adk) (2.0.41)\nRequirement already satisfied: starlette<1.0.0,>=0.46.2 in /usr/local/lib/python3.11/dist-packages (from google-adk) (0.47.2)\nRequirement already satisfied: tenacity<10.0.0,>=9.0.0 in /usr/local/lib/python3.11/dist-packages (from google-adk) (9.1.2)\nRequirement already satisfied: typing-extensions<5,>=4.5 in /usr/local/lib/python3.11/dist-packages (from google-adk) (4.15.0)\nRequirement already satisfied: tzlocal<6.0,>=5.3 in /usr/local/lib/python3.11/dist-packages (from google-adk) (5.3.1)\nRequirement already satisfied: uvicorn<1.0.0,>=0.34.0 in /usr/local/lib/python3.11/dist-packages (from google-adk) (0.35.0)\nRequirement already satisfied: watchdog<7.0.0,>=6.0.0 in /usr/local/lib/python3.11/dist-packages (from google-adk) (6.0.0)\nRequirement already satisfied: websockets<16.0.0,>=15.0.1 in /usr/local/lib/python3.11/dist-packages (from google-adk) (15.0.1)\nRequirement already satisfied: idna>=2.8 in /usr/local/lib/python3.11/dist-packages (from anyio<5.0.0,>=4.9.0->google-adk) (3.11)\nRequirement already satisfied: sniffio>=1.1 in /usr/local/lib/python3.11/dist-packages (from anyio<5.0.0,>=4.9.0->google-adk) (1.3.1)\nRequirement already satisfied: cryptography in /usr/local/lib/python3.11/dist-packages (from authlib<2.0.0,>=1.5.1->google-adk) (46.0.3)\nRequirement already satisfied: httplib2<1.0.0,>=0.19.0 in /usr/local/lib/python3.11/dist-packages (from google-api-python-client<3.0.0,>=2.157.0->google-adk) (0.22.0)\nRequirement already satisfied: google-auth!=2.24.0,!=2.25.0,<3.0.0,>=1.32.0 in /usr/local/lib/python3.11/dist-packages (from google-api-python-client<3.0.0,>=2.157.0->google-adk) (2.38.0)\nRequirement already satisfied: google-auth-httplib2<1.0.0,>=0.2.0 in /usr/local/lib/python3.11/dist-packages (from google-api-python-client<3.0.0,>=2.157.0->google-adk) (0.2.0)\nRequirement already satisfied: google-api-core!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0,<3.0.0,>=1.31.5 in /usr/local/lib/python3.11/dist-packages (from google-api-python-client<3.0.0,>=2.157.0->google-adk) (2.28.1)\nRequirement already satisfied: uritemplate<5,>=3.0.1 in /usr/local/lib/python3.11/dist-packages (from google-api-python-client<3.0.0,>=2.157.0->google-adk) (4.2.0)\nRequirement already satisfied: proto-plus<2.0.0,>=1.22.3 in /usr/local/lib/python3.11/dist-packages (from google-cloud-aiplatform<2.0.0,>=1.125.0->google-cloud-aiplatform[agent-engines]<2.0.0,>=1.125.0->google-adk) (1.26.1)\nRequirement already satisfied: protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<7.0.0,>=3.20.2 in /usr/local/lib/python3.11/dist-packages (from google-cloud-aiplatform<2.0.0,>=1.125.0->google-cloud-aiplatform[agent-engines]<2.0.0,>=1.125.0->google-adk) (6.33.0)\nRequirement already satisfied: packaging>=14.3 in /usr/local/lib/python3.11/dist-packages (from google-cloud-aiplatform<2.0.0,>=1.125.0->google-cloud-aiplatform[agent-engines]<2.0.0,>=1.125.0->google-adk) (25.0)\nRequirement already satisfied: google-cloud-bigquery!=3.20.0,<4.0.0,>=1.15.0 in /usr/local/lib/python3.11/dist-packages (from google-cloud-aiplatform<2.0.0,>=1.125.0->google-cloud-aiplatform[agent-engines]<2.0.0,>=1.125.0->google-adk) (3.35.1)\nRequirement already satisfied: google-cloud-resource-manager<3.0.0,>=1.3.3 in /usr/local/lib/python3.11/dist-packages (from google-cloud-aiplatform<2.0.0,>=1.125.0->google-cloud-aiplatform[agent-engines]<2.0.0,>=1.125.0->google-adk) (1.14.2)\nRequirement already satisfied: shapely<3.0.0 in /usr/local/lib/python3.11/dist-packages (from google-cloud-aiplatform<2.0.0,>=1.125.0->google-cloud-aiplatform[agent-engines]<2.0.0,>=1.125.0->google-adk) (2.1.2)\nRequirement already satisfied: docstring_parser<1 in /usr/local/lib/python3.11/dist-packages (from google-cloud-aiplatform<2.0.0,>=1.125.0->google-cloud-aiplatform[agent-engines]<2.0.0,>=1.125.0->google-adk) (0.17.0)\nRequirement already satisfied: cloudpickle<4.0,>=3.0 in /usr/local/lib/python3.11/dist-packages (from google-cloud-aiplatform[agent-engines]<2.0.0,>=1.125.0->google-adk) (3.1.2)\nRequirement already satisfied: google-cloud-trace<2 in /usr/local/lib/python3.11/dist-packages (from google-cloud-aiplatform[agent-engines]<2.0.0,>=1.125.0->google-adk) (1.17.0)\nRequirement already satisfied: google-cloud-logging<4 in /usr/local/lib/python3.11/dist-packages (from google-cloud-aiplatform[agent-engines]<2.0.0,>=1.125.0->google-adk) (3.12.1)\nRequirement already satisfied: google-cloud-core<3.0.0,>=1.4.4 in /usr/local/lib/python3.11/dist-packages (from google-cloud-bigtable>=2.32.0->google-adk) (2.4.3)\nRequirement already satisfied: grpc-google-iam-v1<1.0.0,>=0.12.4 in /usr/local/lib/python3.11/dist-packages (from google-cloud-bigtable>=2.32.0->google-adk) (0.14.2)\nRequirement already satisfied: google-crc32c<2.0.0dev,>=1.5.0 in /usr/local/lib/python3.11/dist-packages (from google-cloud-bigtable>=2.32.0->google-adk) (1.7.1)\nRequirement already satisfied: grpcio<2.0.0,>=1.33.2 in /usr/local/lib/python3.11/dist-packages (from google-cloud-secret-manager<3.0.0,>=2.22.0->google-adk) (1.74.0)\nRequirement already satisfied: sqlparse>=0.4.4 in /usr/local/lib/python3.11/dist-packages (from google-cloud-spanner<4.0.0,>=3.56.0->google-adk) (0.5.3)\nRequirement already satisfied: grpc-interceptor>=0.15.4 in /usr/local/lib/python3.11/dist-packages (from google-cloud-spanner<4.0.0,>=3.56.0->google-adk) (0.15.4)\nRequirement already satisfied: google-resumable-media<3.0.0,>=2.7.2 in /usr/local/lib/python3.11/dist-packages (from google-cloud-storage<4.0.0,>=3.0.0->google-adk) (2.7.2)\nRequirement already satisfied: httpx<1.0.0,>=0.28.1 in /usr/local/lib/python3.11/dist-packages (from google-genai<2.0.0,>=1.45.0->google-adk) (0.28.1)\nRequirement already satisfied: httpx-sse>=0.4 in /usr/local/lib/python3.11/dist-packages (from mcp<2.0.0,>=1.8.0->google-adk) (0.4.3)\nRequirement already satisfied: jsonschema>=4.20.0 in /usr/local/lib/python3.11/dist-packages (from mcp<2.0.0,>=1.8.0->google-adk) (4.25.0)\nRequirement already satisfied: pydantic-settings>=2.5.2 in /usr/local/lib/python3.11/dist-packages (from mcp<2.0.0,>=1.8.0->google-adk) (2.11.0)\nRequirement already satisfied: pyjwt>=2.10.1 in /usr/local/lib/python3.11/dist-packages (from pyjwt[crypto]>=2.10.1->mcp<2.0.0,>=1.8.0->google-adk) (2.10.1)\nRequirement already satisfied: python-multipart>=0.0.9 in /usr/local/lib/python3.11/dist-packages (from mcp<2.0.0,>=1.8.0->google-adk) (0.0.20)\nRequirement already satisfied: sse-starlette>=1.6.1 in /usr/local/lib/python3.11/dist-packages (from mcp<2.0.0,>=1.8.0->google-adk) (3.0.3)\nRequirement already satisfied: importlib-metadata<8.8.0,>=6.0 in /usr/local/lib/python3.11/dist-packages (from opentelemetry-api<=1.37.0,>=1.37.0->google-adk) (8.7.0)\nRequirement already satisfied: google-cloud-monitoring~=2.0 in /usr/local/lib/python3.11/dist-packages (from opentelemetry-exporter-gcp-monitoring<2.0.0,>=1.9.0a0->google-adk) (2.28.0)\nRequirement already satisfied: googleapis-common-protos~=1.52 in /usr/local/lib/python3.11/dist-packages (from opentelemetry-exporter-otlp-proto-http>=1.36.0->google-adk) (1.70.0)\nRequirement already satisfied: opentelemetry-exporter-otlp-proto-common==1.37.0 in /usr/local/lib/python3.11/dist-packages (from opentelemetry-exporter-otlp-proto-http>=1.36.0->google-adk) (1.37.0)\nRequirement already satisfied: opentelemetry-proto==1.37.0 in /usr/local/lib/python3.11/dist-packages (from opentelemetry-exporter-otlp-proto-http>=1.36.0->google-adk) (1.37.0)\nRequirement already satisfied: opentelemetry-semantic-conventions==0.58b0 in /usr/local/lib/python3.11/dist-packages (from opentelemetry-sdk<=1.37.0,>=1.37.0->google-adk) (0.58b0)\nRequirement already satisfied: annotated-types>=0.6.0 in /usr/local/lib/python3.11/dist-packages (from pydantic<3.0.0,>=2.0->google-adk) (0.7.0)\nRequirement already satisfied: pydantic-core==2.41.5 in /usr/local/lib/python3.11/dist-packages (from pydantic<3.0.0,>=2.0->google-adk) (2.41.5)\nRequirement already satisfied: typing-inspection>=0.4.2 in /usr/local/lib/python3.11/dist-packages (from pydantic<3.0.0,>=2.0->google-adk) (0.4.2)\nRequirement already satisfied: six>=1.5 in /usr/local/lib/python3.11/dist-packages (from python-dateutil<3.0.0,>=2.9.0.post0->google-adk) (1.17.0)\nRequirement already satisfied: charset_normalizer<4,>=2 in /usr/local/lib/python3.11/dist-packages (from requests<3.0.0,>=2.32.4->google-adk) (3.4.4)\nRequirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.11/dist-packages (from requests<3.0.0,>=2.32.4->google-adk) (2.5.0)\nRequirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.11/dist-packages (from requests<3.0.0,>=2.32.4->google-adk) (2025.10.5)\nRequirement already satisfied: greenlet>=1 in /usr/local/lib/python3.11/dist-packages (from sqlalchemy<3.0.0,>=2.0->google-adk) (3.2.3)\nRequirement already satisfied: alembic in /usr/local/lib/python3.11/dist-packages (from sqlalchemy-spanner>=1.14.0->google-adk) (1.17.1)\nRequirement already satisfied: h11>=0.8 in /usr/local/lib/python3.11/dist-packages (from uvicorn<1.0.0,>=0.34.0->google-adk) (0.16.0)\nRequirement already satisfied: grpcio-status<2.0.0,>=1.33.2 in /usr/local/lib/python3.11/dist-packages (from google-api-core[grpc]!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,<3.0.0,>=1.34.1->google-cloud-aiplatform<2.0.0,>=1.125.0->google-cloud-aiplatform[agent-engines]<2.0.0,>=1.125.0->google-adk) (1.71.2)\nCollecting cachetools<6.0,>=2.0.0 (from google-auth!=2.24.0,!=2.25.0,<3.0.0,>=1.32.0->google-api-python-client<3.0.0,>=2.157.0->google-adk)\n Downloading cachetools-5.5.2-py3-none-any.whl.metadata (5.4 kB)\nRequirement already satisfied: pyasn1-modules>=0.2.1 in /usr/local/lib/python3.11/dist-packages (from google-auth!=2.24.0,!=2.25.0,<3.0.0,>=1.32.0->google-api-python-client<3.0.0,>=2.157.0->google-adk) (0.4.2)\nRequirement already satisfied: rsa<5,>=3.1.4 in /usr/local/lib/python3.11/dist-packages (from google-auth!=2.24.0,!=2.25.0,<3.0.0,>=1.32.0->google-api-python-client<3.0.0,>=2.157.0->google-adk) (4.9.1)\nRequirement already satisfied: google-cloud-appengine-logging<2.0.0,>=0.1.3 in /usr/local/lib/python3.11/dist-packages (from google-cloud-logging<4->google-cloud-aiplatform[agent-engines]<2.0.0,>=1.125.0->google-adk) (1.7.0)\nRequirement already satisfied: google-cloud-audit-log<1.0.0,>=0.3.1 in /usr/local/lib/python3.11/dist-packages (from google-cloud-logging<4->google-cloud-aiplatform[agent-engines]<2.0.0,>=1.125.0->google-adk) (0.4.0)\nRequirement already satisfied: pyparsing!=3.0.0,!=3.0.1,!=3.0.2,!=3.0.3,<4,>=2.4.2 in /usr/local/lib/python3.11/dist-packages (from httplib2<1.0.0,>=0.19.0->google-api-python-client<3.0.0,>=2.157.0->google-adk) (3.0.9)\nRequirement already satisfied: httpcore==1.* in /usr/local/lib/python3.11/dist-packages (from httpx<1.0.0,>=0.28.1->google-genai<2.0.0,>=1.45.0->google-adk) (1.0.9)\nRequirement already satisfied: zipp>=3.20 in /usr/local/lib/python3.11/dist-packages (from importlib-metadata<8.8.0,>=6.0->opentelemetry-api<=1.37.0,>=1.37.0->google-adk) (3.23.0)\nRequirement already satisfied: attrs>=22.2.0 in /usr/local/lib/python3.11/dist-packages (from jsonschema>=4.20.0->mcp<2.0.0,>=1.8.0->google-adk) (25.4.0)\nRequirement already satisfied: jsonschema-specifications>=2023.03.6 in /usr/local/lib/python3.11/dist-packages (from jsonschema>=4.20.0->mcp<2.0.0,>=1.8.0->google-adk) (2025.4.1)\nRequirement already satisfied: referencing>=0.28.4 in /usr/local/lib/python3.11/dist-packages (from jsonschema>=4.20.0->mcp<2.0.0,>=1.8.0->google-adk) (0.36.2)\nRequirement already satisfied: rpds-py>=0.7.1 in /usr/local/lib/python3.11/dist-packages (from jsonschema>=4.20.0->mcp<2.0.0,>=1.8.0->google-adk) (0.26.0)\nRequirement already satisfied: cffi>=2.0.0 in /usr/local/lib/python3.11/dist-packages (from cryptography->authlib<2.0.0,>=1.5.1->google-adk) (2.0.0)\nRequirement already satisfied: numpy>=1.21 in /usr/local/lib/python3.11/dist-packages (from shapely<3.0.0->google-cloud-aiplatform<2.0.0,>=1.125.0->google-cloud-aiplatform[agent-engines]<2.0.0,>=1.125.0->google-adk) (1.26.4)\nRequirement already satisfied: Mako in /usr/local/lib/python3.11/dist-packages (from alembic->sqlalchemy-spanner>=1.14.0->google-adk) (1.3.10)\nRequirement already satisfied: pycparser in /usr/local/lib/python3.11/dist-packages (from cffi>=2.0.0->cryptography->authlib<2.0.0,>=1.5.1->google-adk) (2.23)\nCollecting protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<7.0.0,>=3.20.2 (from google-cloud-aiplatform<2.0.0,>=1.125.0->google-cloud-aiplatform[agent-engines]<2.0.0,>=1.125.0->google-adk)\n Downloading protobuf-5.29.5-cp38-abi3-manylinux2014_x86_64.whl.metadata (592 bytes)\nRequirement already satisfied: mkl_fft in /usr/local/lib/python3.11/dist-packages (from numpy>=1.21->shapely<3.0.0->google-cloud-aiplatform<2.0.0,>=1.125.0->google-cloud-aiplatform[agent-engines]<2.0.0,>=1.125.0->google-adk) (1.3.8)\nRequirement already satisfied: mkl_random in /usr/local/lib/python3.11/dist-packages (from numpy>=1.21->shapely<3.0.0->google-cloud-aiplatform<2.0.0,>=1.125.0->google-cloud-aiplatform[agent-engines]<2.0.0,>=1.125.0->google-adk) (1.2.4)\nRequirement already satisfied: mkl_umath in /usr/local/lib/python3.11/dist-packages (from numpy>=1.21->shapely<3.0.0->google-cloud-aiplatform<2.0.0,>=1.125.0->google-cloud-aiplatform[agent-engines]<2.0.0,>=1.125.0->google-adk) (0.1.1)\nRequirement already satisfied: mkl in /usr/local/lib/python3.11/dist-packages (from numpy>=1.21->shapely<3.0.0->google-cloud-aiplatform<2.0.0,>=1.125.0->google-cloud-aiplatform[agent-engines]<2.0.0,>=1.125.0->google-adk) (2025.3.0)\nRequirement already satisfied: tbb4py in /usr/local/lib/python3.11/dist-packages (from numpy>=1.21->shapely<3.0.0->google-cloud-aiplatform<2.0.0,>=1.125.0->google-cloud-aiplatform[agent-engines]<2.0.0,>=1.125.0->google-adk) (2022.3.0)\nRequirement already satisfied: mkl-service in /usr/local/lib/python3.11/dist-packages (from numpy>=1.21->shapely<3.0.0->google-cloud-aiplatform<2.0.0,>=1.125.0->google-cloud-aiplatform[agent-engines]<2.0.0,>=1.125.0->google-adk) (2.4.1)\nRequirement already satisfied: pyasn1<0.7.0,>=0.6.1 in /usr/local/lib/python3.11/dist-packages (from pyasn1-modules>=0.2.1->google-auth!=2.24.0,!=2.25.0,<3.0.0,>=1.32.0->google-api-python-client<3.0.0,>=2.157.0->google-adk) (0.6.1)\nRequirement already satisfied: MarkupSafe>=0.9.2 in /usr/local/lib/python3.11/dist-packages (from Mako->alembic->sqlalchemy-spanner>=1.14.0->google-adk) (3.0.3)\nRequirement already satisfied: onemkl-license==2025.3.0 in /usr/local/lib/python3.11/dist-packages (from mkl->numpy>=1.21->shapely<3.0.0->google-cloud-aiplatform<2.0.0,>=1.125.0->google-cloud-aiplatform[agent-engines]<2.0.0,>=1.125.0->google-adk) (2025.3.0)\nRequirement already satisfied: intel-openmp<2026,>=2024 in /usr/local/lib/python3.11/dist-packages (from mkl->numpy>=1.21->shapely<3.0.0->google-cloud-aiplatform<2.0.0,>=1.125.0->google-cloud-aiplatform[agent-engines]<2.0.0,>=1.125.0->google-adk) (2024.2.0)\nRequirement already satisfied: tbb==2022.* in /usr/local/lib/python3.11/dist-packages (from mkl->numpy>=1.21->shapely<3.0.0->google-cloud-aiplatform<2.0.0,>=1.125.0->google-cloud-aiplatform[agent-engines]<2.0.0,>=1.125.0->google-adk) (2022.3.0)\nRequirement already satisfied: tcmlib==1.* in /usr/local/lib/python3.11/dist-packages (from tbb==2022.*->mkl->numpy>=1.21->shapely<3.0.0->google-cloud-aiplatform<2.0.0,>=1.125.0->google-cloud-aiplatform[agent-engines]<2.0.0,>=1.125.0->google-adk) (1.4.0)\nRequirement already satisfied: intel-cmplr-lib-rt in /usr/local/lib/python3.11/dist-packages (from mkl_umath->numpy>=1.21->shapely<3.0.0->google-cloud-aiplatform<2.0.0,>=1.125.0->google-cloud-aiplatform[agent-engines]<2.0.0,>=1.125.0->google-adk) (2024.2.0)\nRequirement already satisfied: intel-cmplr-lib-ur==2024.2.0 in /usr/local/lib/python3.11/dist-packages (from intel-openmp<2026,>=2024->mkl->numpy>=1.21->shapely<3.0.0->google-cloud-aiplatform<2.0.0,>=1.125.0->google-cloud-aiplatform[agent-engines]<2.0.0,>=1.125.0->google-adk) (2024.2.0)\nDownloading cachetools-5.5.2-py3-none-any.whl (10 kB)\nDownloading protobuf-5.29.5-cp38-abi3-manylinux2014_x86_64.whl (319 kB)\n\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m319.9/319.9 kB\u001b[0m \u001b[31m6.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n\u001b[?25hInstalling collected packages: protobuf, cachetools\n Attempting uninstall: protobuf\n Found existing installation: protobuf 6.33.0\n Uninstalling protobuf-6.33.0:\n Successfully uninstalled protobuf-6.33.0\n Attempting uninstall: cachetools\n Found existing installation: cachetools 6.2.1\n Uninstalling cachetools-6.2.1:\n Successfully uninstalled cachetools-6.2.1\n\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\nbigframes 2.12.0 requires google-cloud-bigquery-storage<3.0.0,>=2.30.0, which is not installed.\ngoogle-cloud-translate 3.12.1 requires protobuf!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.19.5, but you have protobuf 5.29.5 which is incompatible.\nray 2.51.1 requires click!=8.3.0,>=7.0, but you have click 8.3.0 which is incompatible.\nbigframes 2.12.0 requires rich<14,>=12.4.4, but you have rich 14.2.0 which is incompatible.\npydrive2 1.21.3 requires cryptography<44, but you have cryptography 46.0.3 which is incompatible.\npydrive2 1.21.3 requires pyOpenSSL<=24.2.1,>=19.1.0, but you have pyopenssl 25.3.0 which is incompatible.\ngcsfs 2025.3.0 requires fsspec==2025.3.0, but you have fsspec 2025.10.0 which is incompatible.\u001b[0m\u001b[31m\n\u001b[0mSuccessfully installed cachetools-5.5.2 protobuf-5.29.5\nNote: you may need to restart the kernel to use updated packages.\n","output_type":"stream"}],"execution_count":3},{"cell_type":"code","source":"import os\nfrom kaggle_secrets import UserSecretsClient\n\ntry:\n GOOGLE_API_KEY = UserSecretsClient().get_secret(\"GOOGLE_API_KEY\")\n os.environ[\"GOOGLE_API_KEY\"] = GOOGLE_API_KEY\n print(\"✅ Setup and authentication complete.\")\nexcept Exception as e:\n print(\n f\"🔑 Authentication Error: Please make sure you have added 'GOOGLE_API_KEY' to your Kaggle secrets. Details: {e}\"\n )","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-11-27T18:31:26.866889Z","iopub.execute_input":"2025-11-27T18:31:26.868091Z","iopub.status.idle":"2025-11-27T18:31:27.120759Z","shell.execute_reply.started":"2025-11-27T18:31:26.868051Z","shell.execute_reply":"2025-11-27T18:31:27.119675Z"}},"outputs":[{"name":"stdout","text":"✅ Setup and authentication complete.\n","output_type":"stream"}],"execution_count":4},{"cell_type":"markdown","source":"# Add Cloud Credentials to Secrets.\n\n1. In the top menu bar of the notebook editor, select Add-ons then Google Cloud SDK.\n2. Click on Link Account\n3. Select your Google Cloud Account\n4. Attach to the notebook\n\nThis cell retrieves your Google Cloud credentials from Kaggle Secrets and configures them for use. These credentials allow the notebook to authenticate with Google Cloud services like Vertex AI Agent Engine.","metadata":{}},{"cell_type":"code","source":"# Set up Cloud Credentials in Kaggle\nuser_secrets = UserSecretsClient()\nuser_credential = user_secrets.get_gcloud_credential()\nuser_secrets.set_tensorflow_credential(user_credential)\n\nprint(\"✅ Cloud credentials configured\")","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-11-25T09:15:17.688065Z","iopub.execute_input":"2025-11-25T09:15:17.688496Z","iopub.status.idle":"2025-11-25T09:15:17.826447Z","shell.execute_reply.started":"2025-11-25T09:15:17.688462Z","shell.execute_reply":"2025-11-25T09:15:17.82532Z"}},"outputs":[{"name":"stdout","text":"✅ Cloud credentials configured\n","output_type":"stream"}],"execution_count":5},{"cell_type":"markdown","source":"### Set your PROJECT_ID\n\n**Important:** Make sure to replace `\"your-project-id\"` with your actual Google Cloud project ID. You can find your project ID in the [Google Cloud Console](https://console.cloud.google.com/).","metadata":{}},{"cell_type":"code","source":"## Set your PROJECT_ID\nPROJECT_ID = \"stunning-cell-462918-r8\" # TODO: Replace with your project ID\nos.environ[\"GOOGLE_CLOUD_PROJECT\"] = PROJECT_ID\n\nif PROJECT_ID == \"your-project-id\" or not PROJECT_ID:\n raise ValueError(\"⚠️ Please replace 'your-project-id' with your actual Google Cloud Project ID.\")\n\nprint(f\"✅ Project ID set to: {PROJECT_ID}\")","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-11-25T09:15:22.167384Z","iopub.execute_input":"2025-11-25T09:15:22.167812Z","iopub.status.idle":"2025-11-25T09:15:22.175495Z","shell.execute_reply.started":"2025-11-25T09:15:22.167778Z","shell.execute_reply":"2025-11-25T09:15:22.173622Z"}},"outputs":[{"name":"stdout","text":"✅ Project ID set to: stunning-cell-462918-r8\n","output_type":"stream"}],"execution_count":6},{"cell_type":"markdown","source":"## Set up logging and clean up old files.\n\nLet's configure logging for our debugging session. The following cell makes sure we also capture other log levels, like DEBUG.","metadata":{}},{"cell_type":"code","source":"import logging\nimport os\n\n# Clean up any previous logs\nfor log_file in [\"logger.log\", \"web.log\", \"tunnel.log\"]:\n if os.path.exists(log_file):\n os.remove(log_file)\n print(f\"🧹 Cleaned up {log_file}\")\n\n# Configure logging with DEBUG log level.\nlogging.basicConfig(\n filename=\"logger.log\",\n level=logging.DEBUG,\n format=\"%(filename)s:%(lineno)s %(levelname)s:%(message)s\",\n)\n\nprint(\"✅ Logging configured\")","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-11-27T18:32:14.406486Z","iopub.execute_input":"2025-11-27T18:32:14.4068Z","iopub.status.idle":"2025-11-27T18:32:14.414731Z","shell.execute_reply.started":"2025-11-27T18:32:14.406779Z","shell.execute_reply":"2025-11-27T18:32:14.413339Z"}},"outputs":[{"name":"stdout","text":"✅ Logging configured\n","output_type":"stream"}],"execution_count":5},{"cell_type":"markdown","source":"### 💻 Set up proxy and tunneling\n\nWe'll use a proxy to access the ADK web UI from within the Kaggle Notebooks environment. If you are running this outside the Kaggle environment, you don't need to do this.","metadata":{}},{"cell_type":"code","source":"from IPython.core.display import display, HTML\nfrom jupyter_server.serverapp import list_running_servers\n\n\n# Gets the proxied URL in the Kaggle Notebooks environment\ndef get_adk_proxy_url():\n PROXY_HOST = \"https://kkb-production.jupyter-proxy.kaggle.net\"\n ADK_PORT = \"8000\"\n\n servers = list(list_running_servers())\n if not servers:\n raise Exception(\"No running Jupyter servers found.\")\n\n baseURL = servers[0][\"base_url\"]\n\n try:\n path_parts = baseURL.split(\"/\")\n kernel = path_parts[2]\n token = path_parts[3]\n except IndexError:\n raise Exception(f\"Could not parse kernel/token from base URL: {baseURL}\")\n\n url_prefix = f\"/k/{kernel}/{token}/proxy/proxy/{ADK_PORT}\"\n url = f\"{PROXY_HOST}{url_prefix}\"\n\n styled_html = f\"\"\"\n <div style=\"padding: 15px; border: 2px solid #f0ad4e; border-radius: 8px; background-color: #fef9f0; margin: 20px 0;\">\n <div style=\"font-family: sans-serif; margin-bottom: 12px; color: #333; font-size: 1.1em;\">\n <strong>⚠️ IMPORTANT: Action Required</strong>\n </div>\n <div style=\"font-family: sans-serif; margin-bottom: 15px; color: #333; line-height: 1.5;\">\n The ADK web UI is <strong>not running yet</strong>. You must start it in the next cell.\n <ol style=\"margin-top: 10px; padding-left: 20px;\">\n <li style=\"margin-bottom: 5px;\"><strong>Run the next cell</strong> (the one with <code>!adk web ...</code>) to start the ADK web UI.</li>\n <li style=\"margin-bottom: 5px;\">Wait for that cell to show it is \"Running\" (it will not \"complete\").</li>\n <li>Once it's running, <strong>return to this button</strong> and click it to open the UI.</li>\n </ol>\n <em style=\"font-size: 0.9em; color: #555;\">(If you click the button before running the next cell, you will get a 500 error.)</em>\n </div>\n <a href='{url}' target='_blank' style=\"\n display: inline-block; background-color: #1a73e8; color: white; padding: 10px 20px;\n text-decoration: none; border-radius: 25px; font-family: sans-serif; font-weight: 500;\n box-shadow: 0 2px 5px rgba(0,0,0,0.2); transition: all 0.2s ease;\">\n Open ADK Web UI (after running cell below) ↗\n </a>\n </div>\n \"\"\"\n\n display(HTML(styled_html))\n\n return url_prefix\n\n\nprint(\"✅ Helper functions defined.\")","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-11-27T18:35:14.857203Z","iopub.execute_input":"2025-11-27T18:35:14.857585Z","iopub.status.idle":"2025-11-27T18:35:17.091605Z","shell.execute_reply.started":"2025-11-27T18:35:14.857558Z","shell.execute_reply":"2025-11-27T18:35:17.09056Z"}},"outputs":[{"name":"stdout","text":"✅ Helper functions defined.\n","output_type":"stream"}],"execution_count":6},{"cell_type":"markdown","source":"### Create a \"Research Paper Finder\" Agent\n\n\n**Our goal:** Build a research paper finder agent that helps users find academic papers on any topic.","metadata":{}},{"cell_type":"code","source":"!adk create research-agent --model gemini-2.5-flash-lite --api_key $GOOGLE_API_KEY","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-11-27T18:36:15.506859Z","iopub.execute_input":"2025-11-27T18:36:15.507948Z","iopub.status.idle":"2025-11-27T18:36:48.946306Z","shell.execute_reply.started":"2025-11-27T18:36:15.507918Z","shell.execute_reply":"2025-11-27T18:36:48.944678Z"}},"outputs":[{"name":"stdout","text":"\u001b[32m\nAgent created in /kaggle/working/research-agent:\n- .env\n- __init__.py\n- agent.py\n\u001b[0m\n","output_type":"stream"}],"execution_count":7},{"cell_type":"markdown","source":"### Agent definition\n\nNext, let's create our root agent. \n- We'll configure it as an `LlmAgent`, give it a name, model and instruction.\n- The `root_agent` gets the user prompt and delegates the search to the `google_search_agent`.\n- Then, the agent uses the `count_papers` tool to count the number of papers returned.\n\n**👉 Pay attention to the root agent's instructions and the `count_papers` tool parameter!**","metadata":{}},{"cell_type":"code","source":"%%writefile research-agent/agent.py\n\nfrom google.adk.agents import LlmAgent\nfrom google.adk.models.google_llm import Gemini\nfrom google.adk.tools.agent_tool import AgentTool\nfrom google.adk.tools.google_search_tool import google_search\n\nfrom google.genai import types\nfrom typing import List\n\nretry_config = types.HttpRetryOptions(\n attempts=5, # Maximum retry attempts\n exp_base=7, # Delay multiplier\n initial_delay=1,\n http_status_codes=[429, 500, 503, 504], # Retry on these HTTP errors\n)\n\n# ---- Intentionally pass incorrect datatype - `str` instead of `List[str]` ----\ndef count_papers(papers: str):\n \"\"\"\n This function counts the number of papers in a list of strings.\n Args:\n papers: A list of strings, where each string is a research paper.\n Returns:\n The number of papers in the list.\n \"\"\"\n return len(papers)\n\n\n# Google Search agent\ngoogle_search_agent = LlmAgent(\n name=\"google_search_agent\",\n model=Gemini(model=\"gemini-2.5-flash-lite\", retry_options=retry_config),\n description=\"Searches for information using Google search\",\n instruction=\"\"\"Use the google_search tool to find information on the given topic. Return the raw search results.\n If the user asks for a list of papers, then give them the list of research papers you found and not the summary.\"\"\",\n tools=[google_search]\n)\n\n\n# Root agent\nroot_agent = LlmAgent(\n name=\"research_paper_finder_agent\",\n model=Gemini(model=\"gemini-2.5-flash-lite\", retry_options=retry_config),\n instruction=\"\"\"Your task is to find research papers and count them. \n\n You MUST ALWAYS follow these steps:\n 1) Find research papers on the user provided topic using the 'google_search_agent'. \n 2) Then, pass the papers to 'count_papers' tool to count the number of papers returned.\n 3) Return both the list of research papers and the total number of papers.\n \"\"\",\n tools=[AgentTool(agent=google_search_agent), count_papers]\n)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-11-27T18:37:38.940789Z","iopub.execute_input":"2025-11-27T18:37:38.941179Z","iopub.status.idle":"2025-11-27T18:37:38.94982Z","shell.execute_reply.started":"2025-11-27T18:37:38.941147Z","shell.execute_reply":"2025-11-27T18:37:38.948694Z"}},"outputs":[{"name":"stdout","text":"Overwriting research-agent/agent.py\n","output_type":"stream"}],"execution_count":8},{"cell_type":"markdown","source":"### Run the agent\n\nLet's now run our agent with the `adk web --log_level DEBUG` CLI command.\n\n**📍 The key here is `--log_level DEBUG`** - this shows us:\n\n\n* **Full LLM Prompts:** The complete request sent to the language model, including system instructions, history, and tools.\n* Detailed API responses from services.\n* Internal state transitions and variable values.\n","metadata":{}},{"cell_type":"code","source":"url_prefix = get_adk_proxy_url()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-11-27T18:38:43.427394Z","iopub.execute_input":"2025-11-27T18:38:43.428187Z","iopub.status.idle":"2025-11-27T18:38:43.436508Z","shell.execute_reply.started":"2025-11-27T18:38:43.428157Z","shell.execute_reply":"2025-11-27T18:38:43.435513Z"}},"outputs":[{"output_type":"display_data","data":{"text/plain":"<IPython.core.display.HTML object>","text/html":"\n <div style=\"padding: 15px; border: 2px solid #f0ad4e; border-radius: 8px; background-color: #fef9f0; margin: 20px 0;\">\n <div style=\"font-family: sans-serif; margin-bottom: 12px; color: #333; font-size: 1.1em;\">\n <strong>⚠️ IMPORTANT: Action Required</strong>\n </div>\n <div style=\"font-family: sans-serif; margin-bottom: 15px; color: #333; line-height: 1.5;\">\n The ADK web UI is <strong>not running yet</strong>. You must start it in the next cell.\n <ol style=\"margin-top: 10px; padding-left: 20px;\">\n <li style=\"margin-bottom: 5px;\"><strong>Run the next cell</strong> (the one with <code>!adk web ...</code>) to start the ADK web UI.</li>\n <li style=\"margin-bottom: 5px;\">Wait for that cell to show it is \"Running\" (it will not \"complete\").</li>\n <li>Once it's running, <strong>return to this button</strong> and click it to open the UI.</li>\n </ol>\n <em style=\"font-size: 0.9em; color: #555;\">(If you click the button before running the next cell, you will get a 500 error.)</em>\n </div>\n <a href='https://kkb-production.jupyter-proxy.kaggle.net/k/282265656/eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwidHlwIjoiSldUIn0..ZSpTilCFVTrLWvQ48TdNqw.jZdU3pG6VKAgn773Muc9Q1fPUFDzV4kbgm-lbgkRe4oj8-NYgr47zkN9H-aXxL6w4dVJJK0OQVv6r2lnwob43y1DL2W7zJwG0XmvlmjNvI7Igtm12BFoUZMm-1gHObNNz8_HTAsPtoFJ89op2l4kerq3Dxhl7ZgJn90N4d3mIeQNAKTRcNdCHzE6td3f7A6zh2YfInwukh-jFsJsPVslNpEOXQ9Rrm0i3OBYGZQLwBAgy4sCb-CpvyXfZywJIf4a.CxnPubcyu2Gmg1SMAiZx3g/proxy/proxy/8000' target='_blank' style=\"\n display: inline-block; background-color: #1a73e8; color: white; padding: 10px 20px;\n text-decoration: none; border-radius: 25px; font-family: sans-serif; font-weight: 500;\n box-shadow: 0 2px 5px rgba(0,0,0,0.2); transition: all 0.2s ease;\">\n Open ADK Web UI (after running cell below) ↗\n </a>\n </div>\n "},"metadata":{}}],"execution_count":9},{"cell_type":"markdown","source":"## Run below cell to preview it on the web.","metadata":{}},{"cell_type":"code","source":"!adk web --log_level DEBUG --url_prefix {url_prefix}","metadata":{"trusted":true},"outputs":[],"execution_count":null}]}