Domain 2: Implement Generative AI and Agentic Solutions (Part 3 of 3)
This lesson covers 5 exam topics: Monitoring Agents and Error Analysis, Tuning Generation: Prompts, Parameters and Reasoning, Reflection and Self-Critique Loops, Observability: Tracing, Tokens and Latency, Orchestrating Multiple Models and Rules. Each topic has a short video, then the notes: key facts, exam traps and what to check in the official docs.
1. Monitoring Agents and Error Analysis
Central question: How do you see what deployed agents do and fix failures?
Capabilities
- Server-side tracing: automatic once Application Insights is connected; no code changes; generally available for prompt and hosted agents.
- Client-side instrumentation for your own code around agent calls.
- Monitor agents dashboard: tokens, latency, errors, quality scores; alerts.
- Agent evaluators: tool call accuracy, task completion; evaluate production traces.
Error analysis (design guidance)
Find failing conversations → open traces → identify step (retrieval, tool, reasoning, guardrail) → fix (instructions, tool schema, data, model) → re-evaluate.
Exam traps
- Adding code to get basic traces. Server-side tracing needs only Application Insights.
- Debugging from final answers only.
- No evaluation after fixes.
2. Tuning Generation: Prompts, Parameters and Reasoning
Central question: How do you tune model behavior without retraining?
Levers (verified where linked)
| Lever | Effect |
|---|---|
| System message | Role, rules, format, scope |
| Few-shot examples | Condition the current response (no permanent change) |
| Output schema (JSON) | Parseable responses |
| Temperature / top P | Randomness vs consistency |
| Max output tokens | Length and cost |
| Reasoning models | More deliberate problem solving; reasoning effort settings (general background) |
| Grounding | Retrieved context, "answer only from sources" |
Validate after every change; a prompt that works once may not generalize (verified).
Exam traps
- High temperature for extraction.
- Fine-tuning before prompt tuning.
- Reasoning model for trivial, latency-sensitive tasks.
3. Reflection and Self-Critique Loops
Central question: How can a system check and improve its own outputs?
Techniques (general background; evaluators verified)
| Technique | How |
|---|---|
| Reflection / self-critique | Generate → critique against criteria → revise; stop after N rounds or when criteria pass |
| Evaluator-in-the-loop | Score drafts with a groundedness or custom evaluator; retry if below threshold |
| Chain-of-thought evaluation | Assess the reasoning steps, not only the answer |
| Generator–critic agents | One agent drafts, another reviews |
Trade-offs: better quality vs more tokens and latency; cap iterations.
Exam traps
- Unbounded critique loops that burn tokens.
- Same prompt critiquing itself with no criteria.
- Skipping external checks (groundedness) for factual tasks.
4. Observability: Tracing, Tokens and Latency
Central question: How do you see inside AI systems in production?
Foundry observability
- Tracing: OpenTelemetry-based, in Application Insights; captures LLM calls, tool invocations, agent decisions, latency, exceptions, prompt content and retrieval; supports LangChain, LangGraph, OpenAI Agents SDK and Agent Framework.
- Monitoring: token consumption, latency, error rates, quality scores; alerts.
- Evaluation: quality and safety signals over traces.
What to analyze (design guidance)
| Signal | Use |
|---|---|
| Token analytics | Cost per agent, prompt growth |
| Latency breakdown | Model vs retrieval vs tools |
| Safety signals | Guardrail detections over time |
| Errors | 429s, tool failures, timeouts |
Exam traps
- Measuring total latency only. Break it down by step.
- No token tracking per feature.
- Proprietary tracing formats when OpenTelemetry is supported.
5. Orchestrating Multiple Models and Rules
Central question: How do you combine several models, flows and rules engines?
Approaches (verified where linked)
| Approach | How |
|---|---|
| Model router | One deployment; a trained model routes each prompt to a suitable LLM to save cost and latency at comparable quality |
| Cascades | Small model first; escalate to a larger or reasoning model on low confidence |
| Hybrid LLM + rules | Deterministic rules for exact policy (limits, eligibility); LLM for language and judgment |
| Specialist pipelines | Extraction model → classifier → generator |
Evaluate any routing against your current baseline (verified guidance for model router).
Exam traps
- LLM enforcing exact business rules that code should enforce.
- Hand-built routing when model router fits.
- No baseline comparison after adding routing.
References
- AI-103 study guide — checked Oct 21, 2026
- Set up tracing — checked Oct 21, 2026
- Observability — checked Oct 21, 2026
- Prompt engineering techniques — checked Oct 21, 2026
- Reasoning models — checked Oct 21, 2026
- Groundedness detection — checked Oct 21, 2026
- Model router — checked Oct 21, 2026
Check your understanding
Enable traces with no code changes?Show answerHide answer
Answer
Connect Application Insights (server-side tracing).Consistent JSON output?Show answerHide answer
Answer
System message format + low temperature.Stop a reflection loop?Show answerHide answer
Answer
Max iterations or passing criteria.Tracing standard used by Foundry?Show answerHide answer
Answer
OpenTelemetry.Single deployment that picks the model per request?Show answerHide answer
Answer
Model router.