Practice Exams:

Microsoft AI-103: Safe Tool-Using Agents

AI & Machine Learning

A conversational assistant becomes an operational agent when it can do more than describe a task. It might look up an order, create a support ticket, or request a change to a customer record. The design risk changes at that boundary: a plausible sentence is one kind of mistake, but an unintended action can alter a business system. Microsoft Foundry provides agent runtimes and tools, yet the application still owns authorization, validation, side effects, and recoverability. A useful agent design starts by deciding exactly which actions should be possible and how every attempted action can be explained afterward.

On this page
  1. Separate the agent’s decision from the application’s authority
  2. Give tools narrow jobs and inspectable inputs
  3. Choose Foundry agent patterns for the actual workload
  4. Keep read actions, drafts and irreversible writes distinct
  5. Treat retries and parallelism as financial and operational risks
  6. Give the model errors it can handle without inventing a result
  7. Defend against instructions arriving from tools or retrieved pages
  8. Trace the entire action, not only the final chat message
  9. Release an agent only when its operational contract is testable

Separate the agent’s decision from the application’s authority

Imagine a service-desk agent that can retrieve a warranty record, inspect an open case and request a replacement device. Those are not three variations of the same capability. The first two read information; the third can commit inventory and money. Each needs a different authorization rule and error contract. The model may recognize the user’s intent, but it should not be allowed to decide independently that a caller is entitled to order hardware. A tool-using agent built for Microsoft AI-103 study needs explicit tool permissions, meaningful failure handling, and a record of which action produced which result.

In a function-calling workflow, the model may propose a tool name and structured parameters, but the application or managed runtime remains responsible for deciding whether the operation is allowed. A service-desk agent can read a warranty record while replacement approval requires a separate business policy and possibly a human reviewer. Validate arguments, bind the call to the requesting user’s actual permissions and treat returned tool text as untrusted data rather than new instructions. If the request times out, distinguish a completed action from an action not yet attempted before retrying. Correctly formed JSON is not permission to make an irreversible change.

Draw a simple boundary around the model: it may choose an available action, explain the request, and interpret validated results. Code outside the model verifies the caller, checks policy, rejects invalid combinations, handles rate limits, and records what actually happened. This prevents a cleverly worded prompt from becoming an authorization override.

Give tools narrow jobs and inspectable inputs

A large generic function such as run_company_operation is difficult for a model to select safely and difficult for developers to audit. Prefer commands with explicit business semantics: find_active_warranty, list_open_service_cases, draft_replacement_request, and submit_approved_replacement. Tool names should describe outcomes, while descriptions should explain prerequisites, unavailable situations and what the function does not do.

Parameter schemas need just enough structure to prevent ambiguity. For a warranty lookup, require a device identifier with the correct format; optional fields may include an organizational context that the server independently verifies. For a replacement request, separate the requester identity from the fulfillment address. Do not accept a user ID supplied by the model as proof of that user’s rights. Derive identity from the authenticated application session and bind it to an authorization decision in server-side code.

Avoid overloaded parameters such as a free-text instructions field that downstream code might treat as a command. Favor enumerated reasons, bounded quantities and validated resource identifiers. Even a well-designed schema cannot replace business logic: quantity=100 can be syntactically valid while violating a policy that limits a particular department to one replacement per employee per year.

Choose Foundry agent patterns for the actual workload

Microsoft Foundry Agent Service supports managed prompt agents and hosted-code approaches, with features that vary by agent type and current platform availability. A prompt agent can be practical when the work is largely instructions plus supported tools. Hosted agents give teams more control over custom orchestration, dependencies and framework-specific behavior, but also increase ownership of code, testing and lifecycle management. The correct choice depends on security boundaries, execution requirements and operating skills—not on which demo shows the most tools.

A small internal knowledge assistant might use a prompt agent with an approved retrieval tool. An agent that coordinates fulfillment, handles durable state, and integrates with an approval service may need a more explicit code-hosted workflow. In either case, tool calls form a versioned API surface: review changes, bind permissions to each operation, and do not expose new high-impact functions to existing agents without evaluating their side effects.

A production project also needs a stable distinction between development and published identities. Microsoft documents that the identity used by an unpublished prompt agent can differ from a published agent application’s identity. Permissions that succeeded during a developer test might fail after publication until the correct service identity receives the necessary roles. This is an operational dependency to test, not a reason to grant broad permissions to both identities.

Keep read actions, drafts and irreversible writes distinct

An agent should not treat “I can look this up” as equivalent to “I can change this.” One useful design is a two-phase interaction: gather and show evidence, then prepare a proposed action with the exact target, effect and relevant policy checks. Only a separate authorization step commits the change. This is particularly valuable for refunds, privileged access, production deployments and other actions where an error has a real-world consequence.

The service-desk example can make the progression concrete. First, the agent retrieves the warranty status; next, it drafts a replacement request with device ID, replacement model and reason; then a designated approver accepts or rejects the request. The commit tool receives an approval identifier that can be independently verified by the business service. Merely writing “approved” in conversation text is never a valid substitute.

Some actions are low-risk and reversible, while others are not. A user-authorized request to open a draft ticket may be safe to execute immediately. Disabling a production account is not. Record those classes in the tool registry so agent instructions, UI confirmations and server permissions remain aligned. A lightweight risk classification makes safety practical without requiring a human to approve every read-only lookup.

Treat retries and parallelism as financial and operational risks

Tool calls can be repeated because of transient network failures, model retries, user refreshes or orchestration replays. A successful payment or device order must not execute twice simply because the agent failed to receive the first response. Use idempotency keys where the underlying API supports them, or store a durable operation record that distinguishes a previously completed command from a new attempt.

Suppose the model requests a replacement laptop and the fulfillment API accepts the order, but the agent sees a timeout. Reissuing the same request without checking its operation ID can create a second shipment. The correct response is to consult the existing transaction’s status, report uncertainty while it is unresolved, and permit manual reconciliation if the service cannot establish the outcome. The agent should never hide a partial failure behind a confident success message.

Parallel calls need the same discipline. Warranty lookup and open-case lookup can run concurrently if they do not mutate shared state. Two updates to the same service case may race and silently overwrite one another. Use optimistic concurrency, version tokens or a workflow coordinator when consistency matters. A language model cannot replace transactional guarantees offered by the business service.

Give the model errors it can handle without inventing a result

A tool contract must describe normal failure. Useful machine-readable outcomes include not_found, access_denied, validation_failed, conflict, rate_limited and temporary_unavailable, alongside a stable request identifier. Distinguish the user-facing explanation from operational details that could expose internal topology or other users’ data.

If a warranty lookup fails because the caller lacks access, the agent should not retry with another identity or guess the warranty terms from prior conversations. It should explain that the lookup could not be completed for the authenticated user and offer a legitimate escalation path. If the catalog is temporarily unavailable, the agent can offer to prepare a draft rather than promise a shipment. Tool errors should narrow the agent’s possible actions, not encourage it to improvise a substitute.

In Microsoft Foundry’s function-calling workflow, an application executing a custom function returns a tool output so the agent can continue. Design timeouts and output-size limits around that control flow. Large raw payloads waste context and may include sensitive fields. Return only the verified information needed for the next decision; retain detailed logs in the server’s observability system.

Defend against instructions arriving from tools or retrieved pages

Agents routinely consume external text: a web page, a knowledge-base article, a support case description or a tool response. That text can contain adversarial instructions. A customer-provided ticket might tell the agent to ignore its policy, retrieve an administrator token or change the delivery address. The presence of that sentence in a retrieved document does not grant it authority.

This is a prompt injection risk: treat tool results as untrusted input, separated from developer instructions and authorization logic. Validate output schemas, sanitize or appropriately render untrusted content, restrict the set of accessible functions and apply explicit controls to sensitive actions. Tests should include prompts that attempt to make a retrieved paragraph impersonate a system message, reveal other customers’ cases, or invoke a write tool not needed for the request.

An agent’s identity and tool permissions are another boundary. A managed identity or dedicated agent identity can remove embedded credentials, but an overly broad role can still expose data. Use the identity model supported by the chosen Foundry agent type, grant the smallest practical data-plane roles and confirm that the published agent can reach only its intended resources. Separate guidance on agent identity can address the precise publishing and role-assignment choices.

Trace the entire action, not only the final chat message

A trace should let an investigator answer: What did the user request? Which agent version interpreted it? Which tools were offered? Which arguments were proposed? What did authorization decide? Was an approval present? What did the external service return? Which operation ID ties the steps together? A final response such as “I created the ticket” cannot provide that evidence on its own.

Capture an appropriately redacted tool-call sequence, execution latency, failure category, model or instruction revision, and downstream correlation IDs. Avoid storing secrets or unnecessary personal data in prompts, tool outputs or telemetry. Dashboards should distinguish model-generated suggestions, authorized submissions and externally confirmed completions. These are different states, and combining them under a single success metric produces false confidence.

Evaluate complete tasks, including denial cases. A legitimate user should get a useful outcome; an unauthorized user should receive a clear boundary; a partial outage should produce a truthful status; and a retried request should not duplicate side effects. Test the agent across versions of tool schemas and prompts, because a small change to a description can shift tool selection even when the API code is unchanged.

Release an agent only when its operational contract is testable

Before enabling the replacement-request tool for all employees, run a limited pilot with synthetic or approved non-sensitive records. Verify correct tool selection, malformed-input rejection, user authorization, approval flow, idempotent retries and failure recovery. Review the actual trace for successful and denied cases, and establish a rollback path that disables unsafe tools without taking down unrelated read-only assistance.

Production readiness also needs an owner for each tool. When the fulfillment API changes, someone must update the schema, compatibility tests and escalation path. An agent should not silently gain additional powers because a backend team added a new endpoint. Coordinated versioning between the application, tool contracts and agent instructions is essential for diagnosing regressions.

The dividing line is simple: an agent can suggest a course of action, but accountable services must decide whether that action may occur and record whether it happened. Microsoft Foundry supplies useful agent infrastructure; trustworthy operations still depend on carefully scoped tools, authenticated authorization, explicit approvals where necessary, safe retries and observable outcomes.

Continue learning

Related guides

Multi-Agent Workflows on AzureCoordinate tasks across agents without losing ownership.Agent Memory on AzureDesign state retention and access boundaries.Responsible AI ReviewsEvaluate consequential outcomes beyond a happy-path demo.Model Selection in FoundryChoose models according to task and operational constraints.

Related Posts

• Mastering the Azure AI Engineer (AI-102) Exam

• How to Ace the Microsoft Certified Azure AI Engineer Exam (AI-102)

• Azure AI Fundamentals 2025: Smart Career Move or Just Hype?

• Unlocking Career Potential with the Microsoft AI-900 Certification

• Mastering the Basics: Your Guide to Microsoft Azure AI

• Azure AI Engineering After AI-102: Practical AI-103 Learning Roadmap

• Microsoft AI-300: How to Roll Back a Model Without Rolling Back the App

• Microsoft AI-300: Machine Learning CI/CD Needs More Than a Build Pipeline

• Microsoft AI-103: Extracting Structure from Complex Documents

• Microsoft AI-103: Evaluating Agents Beyond the Final Answer