Practice Exams:

Microsoft AI-103: Tool Calling for Azure AI Agents

AI & Machine Learning

A tool-using agent can make an AI application genuinely useful by searching a system, calculating a value or preparing an approved change. It can also create new risks because model text now influences operations with real consequences. A generated tool call is a proposal, not proof of authorization or a completed business action. Microsoft Foundry Agent Service supports different tool integrations, but their authentication and lifecycle requirements vary. A reliable application defines permitted tools, checks arguments and rights in trusted code, handles retries safely and verifies results before telling the user what happened. The objective is purposeful automation with visible control boundaries, not maximum tool autonomy.

On this page
  1. Choose tools for specific business tasks
  2. Keep tool schemas precise and validated
  3. Separate workload and user authorization
  4. Defend tools from prompt injection
  5. Make retries and cancellations safe
  6. Evaluate tool choices and task outcomes
  7. Operate a controlled tool lifecycle

Choose tools for specific business tasks

Start with the smallest set of capabilities that materially helps the user complete the defined task. A support agent may need a read-only knowledge search and a ticket-drafting operation, not unrestricted database access and arbitrary HTTP requests. Define each tool’s name, inputs, outputs, side effects, allowed caller roles and failure behavior. Prefer narrowly scoped operations such as draft_ticket or fetch_order_status over generic tools that execute arbitrary commands. Clear contracts make security and evaluation feasible. Tool schemas and permissions are an architectural boundary in Microsoft AI-103; narrow them so an agent cannot turn a valid workflow into an unrestricted command channel.

Document which decisions the model may make and which belong to application policy. It may select a search query or propose one of several approved workflows, but a billing adjustment or data deletion must still pass independent validation and, when required, human approval. A well-designed tool catalog reduces the model’s need to guess and limits the damage from a poor suggestion. Adding more tools is not automatically more useful if ambiguity increases errors.

Keep tool schemas precise and validated

Use typed arguments with required fields, allowed values, length limits and resource identifiers. A model may produce JSON that is syntactically valid but refers to the wrong customer or an unapproved amount. Validate semantics against current business state before execution. Do not trust a model-generated URL, email address or tenant ID without checking ownership and destination policy. Normal application validation should reject extra privileges, unexpected fields and invalid operations.

Suppose a facilities assistant can read a maintenance inventory, check technician availability and propose a service visit. The read-only inventory lookup may be safe for a broad class of authenticated users, while booking a technician consumes limited capacity and may require a manager’s approval. Define separate tools with narrow schemas: an equipment identifier, allowed site, requested time window and a typed purpose. The model can propose the arguments, but trusted application code must verify that the requester may act for that site and that the requested slot remains available. Never interpret a model statement such as ‘booking confirmed’ as proof that the scheduling API persisted the record. Verify the external response and record the resulting booking ID before telling the user the action succeeded.

Test a timeout after the scheduler accepts the request. Without a stable idempotency key, the agent may retry and create two appointments. Also test an injected document that asks the agent to change the booking recipient or call a broader administrative tool. Keep lower-trust text out of authority decisions and require human confirmation for high-impact changes. Logs should correlate proposal, validation, approval, API call and confirmed effect while redacting unrelated customer details. A smaller tool registry with clear permissions often produces more reliable automation than giving one agent every accessible function and hoping a prompt will prevent misuse.

Return structured results with explicit success, failure and uncertain states. The model should not infer that a ticket was created merely because it proposed a tool call. Record authoritative IDs and relevant status from the owning system. For informative read-only tools, provide concise source references; for state-changing tools, return a receipt that can be independently queried. This helps the agent explain what happened without inventing outcomes after a timeout.

Separate workload and user authorization

A Foundry agent or application may authenticate using a managed identity, project identity or another supported connection, but the user’s rights can be narrower than the application’s technical capability. Define when an operation uses application authority and when it acts on behalf of a user. Check the current user’s permission, purpose and resource scope in trusted code. A remembered preference or a sentence inside a retrieved document cannot grant access to a private account.

Use tool-specific permissions instead of one all-powerful integration credential. A service that searches a knowledge index should not be able to change Azure resources just because both tools are in the same agent. Distinguish control-plane roles from data-plane roles when accessing Azure Search or storage. Log authorization decisions without exposing tokens or sensitive prompts. A forbidden action must be blocked even if the model strongly recommends it.

For a multi-tenant support agent, construct an authorization matrix before exposing a new update_ticket tool. The workload identity may be able to query a shared support service, but it must never infer that the signed-in user owns every returned case. Derive the user’s tenant and role from a validated application session, authorize the exact case ID in trusted code, and only then execute the requested mutation. A document or model output suggesting another case identifier is untrusted data, even if the JSON passes schema validation. Distinguish the model’s proposal, the server’s permission check and the business API’s final transaction record as three states that must agree.

Test four rows: A reads its own case, A attempts to update B’s case, a read-only user tries a write, and a privileged approver confirms a permitted write. Add a fifth row where the tool times out after committing: the retry must first reconcile the business operation ID. For each attempt record authenticated principal, source tenant, target case, granted scope, permission verdict, idempotency key and authoritative outcome; redact confidential case text from routine telemetry. A model may explain the failure to the user but cannot expand its own rights by choosing another function or guessing a different target. Microsoft’s Foundry agent architecture provides orchestration mechanisms; the application’s authorization matrix remains the decisive control.

Defend tools from prompt injection

Retrieved documents and tool responses can contain instructions that impersonate higher-priority messages or attempt to call another tool. Treat them as untrusted data. Use clear input boundaries and safety inspection where supported, but enforce hard rules through allowed tool names, argument validation, destination restrictions and approval steps. No prompt can substitute for conventional access controls on side-effecting operations.

Build tests in which an adversarial webpage asks the agent to send confidential data or a search result asserts that all checks were already approved. The system should be able to summarize the malicious text for a security analyst without obeying it. Tool execution logs should show that the prohibited request was rejected before it affected an external system. The security goal is to contain the proposed action, not simply make the model’s wording polite.

Make retries and cancellations safe

A tool call can succeed while its response is lost, leaving the agent uncertain about the outcome. Retrying a read-only query may be harmless; retrying a payment, deletion or outbound message may not. Use idempotency keys, transaction identifiers and authoritative status checks. Define which actions can be compensated and which require manual investigation. When the user cancels a task, stop future work but reconcile operations already committed before claiming cancellation is complete.

Bound model and tool iterations to prevent loops, cost spikes and resource exhaustion. Apply timeouts and retry limits by operation. A network error should not cause the agent to cycle indefinitely through similar tools hoping one returns a favorable answer. Preserve a durable workflow state for longer tasks and hand off to a human when a transaction reaches an uncertain or high-risk condition.

Evaluate tool choices and task outcomes

Test the tool selection separately from the final response. Label the permitted tool for each scenario, expected arguments, required approval and resulting state. Include cases where no tool should be called, where a request is ambiguous and where user access has been revoked. Measure unnecessary calls as well as failures to act. A model that completes the task by abusing a broad administrator tool should not pass evaluation even if the visible answer is correct.

Trace from user request through model proposal, validation, tool execution and confirmed result. Evaluate latency, cost and failure recovery, but keep authorization and business correctness as primary outcomes. A second model judge can help triage cases; it cannot independently verify an external side effect without actual system evidence. Retain sanitized traces for investigating repeated failure patterns and updating the test corpus.

Operate a controlled tool lifecycle

Version tool schemas and permission requirements. A tool renamed or changed in a new release may break earlier prompts or ongoing workflows; coordinate upgrades through a compatibility and rollback plan. Remove retired tools and their credentials rather than leaving hidden capabilities in the catalog. Review tool usage and error rates periodically to identify functions that are confusing, overprivileged or rarely useful.

Tool calling in Azure AI agents works when the model’s flexibility is bounded by deterministic contracts. Users should receive useful automation while retaining authority over consequential actions and access to evidence of what occurred. Treat proposed actions, validated permissions and confirmed outcomes as separate stages, and the agent can assist safely without pretending that persuasive text is equivalent to a verified transaction.

Continue learning

Related guides

Agent Identity in Azure AI FoundryAssign agent identities and restrict access as workloads are deployed.Building Tool-Using Agents in Microsoft FoundryControl agent tool contracts, execution permissions, and recoverable side effects.Tracing AI Agents in AzureInspect agent traces to explain tool choices and failure causes.Prompt Injection Defenses on AzureSeparate untrusted retrieved instructions from application authority and tools.

Related Posts

• AI-102 Retired: The Current AI-103 Azure AI Developer Roadmap

• Mastering AI-102: A Complete Preparation Resource

• Understanding the Core of AI-102 and the Azure AI Engineer Role

• Microsoft AB-100: AI Across Dynamics 365, Power Platform, and Foundry

• Microsoft AI-103: Scaling AI Apps Without Cost Surprises

• Microsoft AI-900: What Changes With AI-901

• Microsoft AI-103: Blue-Green Releases for Azure AI

• Microsoft AI-103: Event-Driven Azure AI Workflows

• Microsoft AI-103: Online Evaluation of AI Systems

• Microsoft AI-103: Securing Azure AI Endpoints