SamePage helps couples get on the same page after a conversation by comparing each partner’s takeaways, surfacing consensus/divergence, and suggesting reconciliations.
- Local:
uvicorn main:app --reload - Cloud Run: use
cloudbuild.yamlto build/push/deploy
Env vars:
PROJECT_ID(orGOOGLE_CLOUD_PROJECT)REGIONdefaultus-east1VERTEX_REGIONdefaultus-central1(Vertex AI embeddings + Gemini region)ENABLE_VERTEX=1to use Vertex embeddings and Gemini; otherwise deterministic fallbacksENABLE_ADK=1to run Scorer→Mediator via ADK orchestration and storeadk_meta
- FastAPI + Jinja2 (single Cloud Run service)
- Firestore:
sessions/{session},sessions/{session}/submissions/A|B - Vertex AI:
text-embedding-004for similarity; Gemini 2.5 Pro for borderline explanations
Routes:
GET /→ creates a session and shows two shareable linksPOST /create→ returns{ sessionId, tokenA, tokenB }GET /s/{session}/{token}→ partner form (A or B)POST /submit→ saves submission; scores when both are present; redirects to resultGET /result/{session}→ alignment card
Create (or reuse) an Artifact Registry repo and set Cloud Build subs:
gcloud builds submit \
--substitutions=_REGION=us-east1,_REPO=<AR_REPO>,_SERVICE=samepage
Cloud Run service gets PROJECT_ID/REGION envs from cloudbuild.yaml. Ensure Firestore is in Native mode and the service account has Datastore User (or equivalent) and Vertex permissions if using LLM features.
- Runtime path can use ADK when
ENABLE_ADK=1. The scoring step callsadk_integration.run_adk_flow, which orchestrates:- Scorer: computes score, label, consensus/divergence/themes (hybrid embedding + parsing)
- Mediator: if score in 60–75, generates an explainer and 2–3 reconciliations (Gemini or fallback)
- The session document includes
adk_metawith agent descriptors/outputs for logs and judging. - Files:
adk_integration.py,scoring.py, andmain.py(POST/submitpath).
Agent discovery layout (for ADK CLI/UI):
src/samepage_app/agents/scorer/agent.py(exportsroot_agent)src/samepage_app/agents/mediator/agent.py(exportsroot_agent)- Each agent directory has
__init__.pythat doesfrom . import agentper ADK docs.
Local inspection:
adk web src/samepage_app/agents/scoreradk run src/samepage_app/agents/mediator
- Install deps (uses uv):
uv sync - Start UI (venv):
.venv/bin/adk web src/samepage_app/agents --no-reload - Or use the helper script:
./scripts/adk-web.sh(setPORT=8765to choose a port) - In the browser, select
scorerormediator, chat to create a session, then open the Trace tab to inspect Event, Request, Response, and Graph.
Make target (optional): make adk-web runs the script if available.