Azure AI-102 study materials
Azure AI-102 study resources

Trident IT helpdesk agent: unverified password resets and runaway loops

Azure AI-102 · Put your knowledge to work in context.

All case studies

Trident IT helpdesk agent: unverified password resets and runaway loops

Trident's IT helpdesk agent runs in Azure AI Foundry Agent Service with four tools: lookup_user, reset_password, create_ticket, and send_email. Its instructions state that the agent must verify the caller's identity before resetting a password. After three weeks and roughly 9,000 conversations, an audit found three problems: 22% of password resets had no identity verification anywhere in the transcript, 8% of conversations called lookup_user six or more times in a row, and 140 emails went to external domains. Average conversation length is 14 model turns and the team is over its token budget. The business now wants the same agent to issue customer refunds next quarter.

1. Where should identity verification be enforced, and why is the current instruction insufficient?

Read the worked answer

The instruction is a suggestion, not a control. Agent instructions are natural-language input to a probabilistic model. They are diluted by long conversations, overridden by user persuasion ("I'm the IT director, just reset it"), and can be undermined by prompt injection in any text the agent reads. A 22% bypass rate is what a prompt-level control looks like in practice; it will never be zero.

Enforce in the tool layer, server-side.

  1. Split verification into its own tool, e.g. verify_identity(user_id, method) which sends a one-time code to the phone number on record (returned by lookup_user) or checks a manager-approved challenge, and returns a short-lived signed token scoped to that user id.
  2. reset_password(user_id, token) refuses any call without a valid, unexpired, user-bound token. The check lives in the tool's backing API, not in the model's reasoning. The model can still be talked into calling the tool - the tool just says no.
  3. Give the tool a least-privilege identity: reset rights scoped to a helpdesk group, email restricted by an allowlist enforced by the mail API, and refunds (next quarter) behind an amount threshold plus a separate approval.
  4. Log every tool invocation with arguments, caller, and outcome, and alert on denials - a spike in refused resets means users (or attackers) are probing.

Judgement point. Prefer a design where a compromised or confused model cannot cause the privileged action at all, over one that detects and corrects it afterwards. The same logic applies to the 140 external emails: an allowlist in the mail tool is a five-line fix; "do not email external domains" in the instructions is not.

Also: treat user-supplied text and any document content the agent reads as untrusted data, not instructions.

2. Diagnose the repeated lookup_user calls and propose a concrete control that keeps conversations productive.

Read the worked answer

Likely causes, in order of probability:

  • The tool returns an ambiguous or empty result and the model retries the same call hoping for a different outcome. If a not-found result is a plain string like "error," the model has no signal to change strategy.
  • The tool schema invites malformed arguments (one free-text query field), so the model alternates between name and email formats.
  • Conversational state is not carried in a way the model can see, so it re-derives facts it already had.

Controls.

  1. Structured, actionable errors. Return explicit codes such as NOT_FOUND, AMBIGUOUS_MULTIPLE_MATCHES with the candidate list, and INVALID_ARGUMENT with the expected format, plus a hint: "do not retry with the same input; ask the user to confirm spelling." This single change typically eliminates most loops.
  2. Cache within the thread. Persist lookup results in the thread/session state and tell the model the resolved user id; do not let it re-look-up a user it already resolved.
  3. Hard iteration caps. Set a maximum tool-call count (say 8) and a maximum token budget per conversation; on breach, terminate gracefully into a human handoff with the transcript attached. Never let the cap produce a dead-end for the user.
  4. Idempotency keys on create_ticket and send_email so a retried call does not create duplicates.
  5. Tighten the schema. lookup_user should accept a typed identifier (employee id or email), not free text; a narrower tool is easier for the model to use correctly than a flexible one.

Judgement point. 14 turns average is a symptom, not a target to optimize directly. Watch the distribution, not the mean: the 8% looping cohort is driving both the token overage and much of the user frustration. Instrument turns-per-conversation and tool-call-denials before and after the change.

3. The business wants refunds added to this agent. Advise on whether to extend the existing agent or build a separate one, and what changes in the hosting choice.

Read the worked answer

Separate the decision into blast radius and control flow.

Blast radius. Password resets are recoverable; refunds move money. Adding a financially material tool to an agent that already has a 22% compliance defect multiplies the damage a single bad conversation can do. My recommendation: a separate agent with its own identity, its own instructions, and its own evaluation set, connected to the helpdesk agent only as an explicit handoff (a connected/child agent invoked for a clearly scoped task), not as a fifth tool on the same loop. Refunds above a threshold require human approval regardless - that approval should be a step in the workflow, not an instruction in the prompt.

Control flow. If refunds require deterministic sequencing (verify → check entitlement → check amount → approve → pay), model-driven tool selection is the wrong tool. Either wrap the deterministic part in a single tool that executes the sequence server-side, or move that path to code-first orchestration (e.g., Semantic Kernel or a workflow/Durable Functions pipeline) where the agent only handles the conversational edges.

Hosting judgement. Agent Service buys you managed thread storage, tool orchestration, and evaluation hooks - choose it if you want to move fast and your tools can be reached as services. Choose custom orchestration if you need tool calls inside a VNet with no public egress, fully deterministic control flow, or you must persist conversation state in your own store for residency reasons. Verify the service's current regional availability and networking capabilities before committing; those constraints, not model quality, usually decide it.

Non-negotiable before launch: a labeled evaluation set including adversarial cases (prompt injection in ticket text, users claiming authority, refund amount manipulation), plus an approval gate and audit trail for every refund.