Prerequisites
- Install Microsoft Foundry Toolkit for Visual Studio Code.
- Select a Foundry project. You need permission to create agents and use the project’s models and tools. See Foundry role-based access control.
- A model deployment in that project. See Set up Foundry resources.
Create a prompt agent
Start with a model and instructions, then save and test the agent before adding tools.- In the Foundry Toolkit view, select Developer Tools > Build > Create Agent.
- Select Build an agent to open Agent Builder.
- Under Basic Information, enter an Agent name. Start and end the name with a letter or number. You can use hyphens between them.
- Select a Foundry-hosted model from Model. Use Browse models if you need to add a model.
- In Instructions, describe the task, required behavior, and expected response. For example, ask the agent to summarize a software issue by identifying the reported problem, reproduction steps, and expected behavior. Tell it to ask for missing information instead of inventing details.
- Select Save to Foundry.
- On the Playground tab, enter a request and select Send message. Ask a follow-up question to test the conversation.
- Review whether the response follows your instructions. Refine the instructions, save, and repeat as needed.

Choose where to save
The available save actions depend on the selected model and tools.
The Microsoft Foundry and Local badges show where the agent is stored.
A locally stored prompt can still call a cloud model. Local storage doesn’t
mean that inference runs on your machine.
Save drafts and versions
Agent Builder separates local recovery drafts from saved agent versions.
If Agent Builder finds a recovery draft, choose Restore Draft or Discard.
Save important changes explicitly before switching agents or versions.
You can test unsaved changes to an existing Foundry agent. That run uses the
edited configuration rather than a saved agent-version reference. Save before
you rely on version-linked conversations, tracing, or generated client code.
Save to Foundry saves an agent version. It doesn’t publish an agent
application with a stable application endpoint. For that separate operation,
see Publish an agent application.
Select an agent version
Use the version selector next to the agent name to load a saved version. Foundry agent versions are immutable. To keep edits made from an earlier version, select Save to Foundry to create a new version. The selected version determines the conversation history shown in Agent Builder and the version referenced by generated client code. For service versioning details, see Save changes as versions.Add tools to a Foundry agent
Tools connect the agent to information and actions outside the model. Available tools depend on the model, your permissions, and the resources in your project. Use Tool Catalog to configure shared connections and authentication, then attach them in Agent Builder.- Open a saved Foundry agent on the Playground tab.
- In Tool, select + > Add tools.
- In Select a tool, choose a connection from Configured, or use Catalog to find a tool.
- Complete the required configuration, then select Add Tool.
- Select Save to Foundry.
- Send a request that requires the tool, and review its inputs and results. If the agent requests approval, select Approve or Deny for that call.
Use a toolbox (preview)
A toolbox groups reusable tools behind a managed MCP endpoint. Skills and tool search are preview features.Toolbox integration in prompt agents is in preview and off by default.
In Visual Studio Code settings, enable
windowsaistudio.enableToolboxInPromptAgent to show toolbox attachment controls.- Open a saved Foundry agent.
- In Tool, select + > Browse toolboxes.
- Select a toolbox, and review its version, tools, and skills.
- Select Add.
- Expand the toolbox card to inspect its contents and review approval settings.
- Select Save to Foundry, then test a request that uses its tools.

Manage an attached toolbox
Use the toolbox card’s More options menu, and then save the agent after you make changes.Connect another agent with A2A (preview)
Agent-to-Agent (A2A) connections let a prompt agent invoke an A2A-compatible agent as a tool. You can attach one directly or through a toolbox. Direct attachment doesn’t require the toolbox opt-in setting.- Open a saved Foundry agent.
- In Tool, select + > Add agent (A2A).
-
In Connect an A2A agent, choose the appropriate tab.
- Complete the dialog to connect or add the agent.
- Select Save to Foundry, then test a request that requires the connection.

Review conversations and switch agents
The Playground contains the current test conversation. Select Clear all messages to start a fresh conversation. For a saved Foundry agent, select Conversations to review history for the selected version. Select a conversation to inspect its messages and response details. Opening history doesn’t resume that conversation in the playground.
Generate and improve instructions
Use Generate to draft instructions from a task description or Improve to revise existing instructions. When the field is empty, Inspire me can provide a starting idea.- Select a model that supports instruction generation.
- Under Instructions, select Generate if the field is empty, or Improve if it contains instructions.
- Describe the task or change. For an existing Foundry agent, improvement suggestions are optional.
- Select Generate or Improve in the dialog.
- Review the revised instructions and test representative requests.
- Select Save to Foundry to keep the configuration.
Evaluate a Foundry prompt agent
Save the configuration you want to evaluate, and then select Evaluation.- Select Scaffold Evaluation Code to generate a local Python evaluation project. Follow the generated instructions to configure and run it.
- Select the Foundry link for guided evaluation setup.
Generate client code
After saving a Foundry agent, use the View Code menu to call it from an application.
Both outputs reference the selected saved version. Save your edits before
generating code if the application needs the revised configuration.
Client code doesn’t convert a prompt agent into a hosted agent. For direct
SDK use, see the prompt-agent quickstart.
Work with local prompts
Choose local storage to use a model from another provider or test local tools. Select a model, enter instructions, and select Save to Local. With a Foundry model, use the save menu when local storage is available. Use Save to Local to keep local changes. Local saves don’t create Foundry versions or Foundry conversation-history records.Connect local tools
For a local prompt, select Tool > + > MCP Server to choose a server and its tools. For configuration and runtime requirements, see Connect a local MCP server. To test a function schema without implementing an external service:- Select Tool > + > Custom Tool.
- Choose By Example or Upload Existing Schema.
- Provide the schema, name, and description, then add the tool.
- Enter a mock response in the tool card.
- Run the prompt and inspect how the model uses the response.
Configure structured output
For a local prompt with a model that supports structured output:- Open Settings next to the model selector.
- Under Structure Output, select
json_schema. - In Select JSON Schema, choose Use Example or Upload File.
- Review the schema and select Select.
- Save the local prompt and run a request to inspect its output.
Evaluate local prompts with dataset variables
For a saved local prompt, the Evaluation tab provides dataset-based evaluation. Use variables in instructions to run the same prompt with different dataset values. For example,Summarize the issue for {{audience}}. uses a dataset column named audience. Supply a value for each test case. The local batch runner substitutes that value when it runs the prompt.
The Agent Builder playground doesn’t have a separate Variables panel. For dataset import, evaluators, and result comparison, see Evaluate models, prompts, and agents.