#!/usr/bin/env bash # REST smoke test against Agent Runtime: create a session, stream a query, check the tool ran. set -euo pipefail cd "$(dirname "$0")/.." NAME=${AGENT_NAME:-$(terraform -chdir=terraform output -raw agent_resource_name)} LOCATION=$(cut -d/ -f4 <<<"$NAME") BASE="https://${LOCATION}-aiplatform.googleapis.com/v1/${NAME}" H=(-H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json") SID=$(curl -fsS "${H[@]}" "$BASE:query" \ -d '{"class_method": "async_create_session", "input": {"user_id": "smoke"}}' | python3 -c 'import json,sys; print(json.load(sys.stdin)["output"]["id"])') echo "== session $SID" OUT=$(curl -fsS -N "${H[@]}" "$BASE:streamQuery?alt=sse" -d @- <