Creating and Testing a Single Agent in the Foundry Portal
This lesson follows the process of creating and testing an agent in the Foundry portal's agent builder and playground, without code, until it is ready for a client application.
Learning outcomes
After completing this lesson, you will be able to:
- Create an agent with a model deployment and instructions.
- Add knowledge and tools to an agent.
- Plan a test that covers in-scope, follow-up and out-of-scope messages.
- Describe the voice and publishing options for agents.
Creating the agent
In a Foundry project, open Agents and create an agent with a name. Choose the model deployment it will use; a capable general model is a good default, and a smaller model can be tested later for cost. Write the instructions: the agent's role, what it helps with, which tools to use for which requests, what to do when it cannot help, the tone and length of answers, and any limits on actions.
Adding knowledge and tools
Add tools in the agent's configuration. For file search, upload the documents; the portal creates the vector store. For code interpreter, enable the tool and optionally attach data files. Other tools, such as web search or an MCP server, are added from the tool list and may need a connection. Tool descriptions and the instructions together tell the model when to call each tool, so write them clearly.
Build a single agent
Testing in the playground
The agent playground runs a conversation with the current definition. A good test plan covers several kinds of message.
- In-scope questions that the agent should answer, including ones that need each tool.
- Follow-up questions that depend on earlier turns.
- Out-of-scope requests that the agent should decline or redirect.
- Questions the knowledge does not cover, to check that the agent says so instead of inventing an answer.
- Attempts to override instructions, to check guardrail behaviour.
Run details show which tools were called and with what results, which explains unexpected answers. Adjust the instructions or tools and test again; each saved change creates a new version. When the agent behaves as intended, the portal provides sample code that calls it by name.
Plan the agent tests
Voice and publishing options
Agents can also be enabled for voice in the playground, which connects Azure Speech Voice Live to the agent so that users can talk to it. Agents can be published as an endpoint and to channels such as Microsoft Teams; for AI-901, the essential path is calling the agent from a lightweight client application, covered in the next module.
An agent that invents answers
During testing, an HR agent with file search over the leave policy gives a confident answer about company car allowances, which the policy does not mention. What should the developer change?
Update the instructions to answer only from the uploaded documents, cite them, and say clearly when the documents do not contain the answer, then retest the same question. Removing file search would make every answer ungrounded, and raising the temperature would make invented answers more likely.
Where can you see which tools an agent called during a test?
Show answer
In the run details in the playground.
Exam Tips
Remember for the exam
- Create the agent, choose the model, write instructions and add tools in the portal.
- Test in-scope, follow-up, out-of-scope and unanswerable questions in the playground.
- Run details show the tools the agent called.