Exams / GCP-PAA / D1 Evaluating and deploying agentic workflows
D1.1
Evaluating and deploying agentic workflows
- Exam domain: Evaluating and deploying agentic workflows
You are reading a free preview. The rest of the GCP-PAA course unlocks with an Exam pass or All access.See plans
1. Improving agent behavior with prompts
| Symptom | First fix |
|---|---|
| Wrong tool / wrong order | Structured system instructions (role, rules, tool usage) + few-shot examples |
| Hallucination, inconsistent format | Restrict answers to retrieved context, add output-format instructions and few-shot input/output examples |
System instructions define tool calling guidelines: "Tool calling guidelines: Define tool selection, ordering, and retry". Prompts reduce but do not guarantee correct behavior.
2. Workflow architectures (ADK, A2A, Antigravity)
| Need | Choice |
|---|---|
| Generate → critique → refine until approved | ADK LoopAgent; set max_iterations and a tool that sets escalate (the loop does not decide to stop itself) |
| Two agents, not consumed externally, latency matters | Local sub-agents, not A2A ("best handled as local sub-agents for performance and simplicity") |
| Long-running remote tasks | A2A SSE streaming for live updates; push notifications (webhook) for tasks lasting minutes to days |
| Concurrent coding subagents | branch workspace (isolated Git worktree) + isolated contexts for builds |
3. Multimodal inputs and retrieval
- Large audio/video: pass Cloud Storage URIs; Cloud Storage files can reach 2 GiB minus 500 KiB, while inline parts are capped and Base64 adds about 33% overhead.
- Video search: Multimodal embeddings API (text and video share a space) + Vector Search ANN.
- RAG chunk ranked low but present: add a ranking-API reranker (an LLM reranker needs an extra Gemini call).
- Narrow, high-volume classification: fine-tuned small model with batch inference (50% discount, asynchronous).
4. Evaluation
| Goal | Metric / tool |
|---|---|
| Tool order vs a reference | trajectory_exact_match, trajectory_in_order_match, any-order, precision, recall |
| Many valid tool paths, no reference | Managed rubric TOOL_USE_QUALITY |
| Several acceptable final answers | ADK rubric_based_final_response_quality_v1 |
| Answer supported by context | Groundedness / hallucination metrics (need context) |
| Retrieval quality | Context precision and recall vs ground truth |
| Flaky live backends | Mocked tool data / simulated errors, plus trajectory metrics |
5. Hosting and observability
- ADK agent with managed sessions and Memory Bank: Agent Runtime (sessions move from in-memory locally to cloud-based managed after deployment).
- Stateless, bursty service: Cloud Run (stateless instances, scale to zero).
- Intermittent or cross-service latency: Cloud Trace spans; trace context links spans across services. Averages and metrics cannot name the slow step.
Exam traps
- Fix prompts/instructions before swapping models or adding memory.
- A LoopAgent without
max_iterationsorescalatenever stops. - Reference-based trajectory metrics penalize valid alternative paths; use rubric metrics there.
- Groundedness does not measure retrieval completeness.
- Batch inference is cheap but asynchronous.
- Monitoring/alerts detect failures; evaluation gates prevent them.
Docs
- https://docs.cloud.google.com/gemini/docs/discover/engineer-agentic-prompts
- https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/evaluation-agents
- https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/rubric-metric-details
- https://docs.cloud.google.com/gemini-enterprise-agent-platform/scale/runtime/tracing
- https://docs.cloud.google.com/trace/docs/trace-context
- https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/capabilities/batch-inference
- https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/capabilities/audio-understanding
- https://docs.cloud.google.com/run/docs/overview/what-is-cloud-run
- https://adk.dev/agents/workflow-agents/loop-agents/
- https://adk.dev/a2a/intro/
- https://a2a-protocol.org/v1.0.1/topics/streaming-and-async/
- https://antigravity.google/docs/subagents