Files
2026-07-07 15:54:17 +07:00

1.7 KiB

Skill: agent_tool_execution

Trigger Conditions

Any change involving Gemma-4-E2B agent tools, Exa search, Supabase RAG RPC, or MedGemma escalation.

Rules

1. Tool catalog is authoritative

  • Only use: exa_search, supabase_query, escalate_medgemma.
  • Never invent tool names in prompts or handlers.
  • Bump TOOL_CATALOG_VERSION on breaking schema changes.

2. Secrets and egress

  • EXA_API_KEY, SUPABASE_SERVICE_ROLE_KEY, MedGemma keys: backend only.
  • Browser calls BFF routes; never https://api.exa.ai directly from the client.
  • PHI-scrub queries before any network egress (secrets_and_phi_safety).

3. Exa defaults (Pattern 1 — raw retrieval)

{
  "type": "auto",
  "numResults": 10,
  "contents": { "highlights": true }
}

4. Retrieval policy (NFR-18)

  • supabase_query first for in-corpus MOH guideline grounding.
  • exa_search for external/recency queries.
  • Final clinical answers must cite chunk IDs (Supabase) or URLs (Exa).

5. MedGemma escalation

  • Requires consent + audit (NFR-16a) before escalate_medgemma.
  • No direct Modal URLs from the browser.

6. MediaPipe agent output

  • Parse tool calls from the answer channel when CoT is enabled.
  • One block per turn: <tool_call> OR <final>.

Package location

ml/implementation/nlp/agent_runtime/