Build and deploy an agent
| ← Previous module: Prepare a project and model |
|---|
This module uses the catalog and tested model from Prepare a project and model. Microsoft Foundry Toolkit and its AIAgentExpert custom agent guide the local build and hosted deployment in VS Code.
Objectives
- Scaffold a catalog-grounded agent in the existing Tailspin Toys workspace.
- Debug local behavior with Agent Inspector.
- Deploy to the existing Foundry project and verify the hosted agent.
Scenario
A trustworthy recommendation must survive more than a single conversation. Tailspin Toys needs the concierge to keep its catalog boundaries when backers ask vague questions or press for unavailable funding details. A hosted concierge should behave just as reliably as one tested privately.
Resume the workspace
The agent uses the existing model deployment; there is no new Foundry project to create.
-
Open the same Tailspin Toys repository in VS Code on
foundry-agent-vscode. Confirmdb/catalog.jsonexists and the projecttailspin-toysand tested model deployment are visible under Foundry Toolkit > My Resources. -
Confirm the previous checkpoint is complete. If resources were cleaned up, complete the project/model preparation again before proceeding.
-
Install Azure Developer CLI (
azd) if it is not already available. Hosted-agent deployment uses it; choose only the command for your operating system:Terminal window # macOS / Linuxcurl -fsSL https://aka.ms/install-azd.sh | bash# Windows (PowerShell)winget install microsoft.azd -
Sign in to the subscription used for the existing project:
Terminal window azd auth login
Hosted agents and Foundry Toolkit are in public preview. Deployment creates billable resources. Confirm subscription, permissions, region, quota, and estimated cost before approving commands.
Create and debug the agent
The toolkit scaffolds code in the current repository and opens a specialized Copilot Chat. Agent Inspector makes local requests, events, and tool calls visible before deployment.
-
Select Foundry Toolkit, expand Developer Tools, expand + Build, and select + Create Agent. On Create Agent, select Code an agent with Copilot.

-
In the new chat, confirm it switches to AIAgentExpert. Replace the generated prompt with the customized prompt and submit it:
/foundrytk-quick-start Create a backer concierge AI agent called 'Backer Concierge'. The agent should use the model I deployed to answer catalog questions and recommend games grounded strictly in db/catalog.json. Review the acceptance criteria in the issue titled 'Add a Backer Concierge assistant for catalog questions' and ensure the agent meets them. Generate the code into agent/backer-concierge in the current workspace and ask me if anything is unclear. -
Review the generated code under
agent/backer-concierge. Confirm the catalog is included in the deployable agent, focused tests pass, and no credentials or local environment files will be committed. -
Select Run and Debug in the Activity Bar and start the debugger with F5. Confirm Agent Inspector loads and connects to the agent server.
-
Reuse all six prompts from Test the deployed model. Check answers against the full
db/catalog.json, rather than assuming the nine-game subset’s ranking is the full catalog ranking. -
Switch between Input & Output, Events, and Tools to inspect payloads, session events, and tool calls. If behavior violates the acceptance criteria, ask Copilot to fix it and rerun focused tests and Inspector checks before deploying.

Deploy and test the hosted agent
The Go production handoff packages the existing agent for Foundry. It does not make the later site proxy a production-ready public service.
-
In the agent-creation Copilot Chat, select Go production, replace the default prompt with the following, and submit it:
/foundrytk-quick-start Review this agent for deployment readiness, run its tests, then deploy it to my existing tailspin-toys Foundry project. Show me the deployment status and test the deployed agent.
-
Review the chat and terminal for parameters and command approvals. Confirm deployment targets the existing
tailspin-toysproject and review billable resources before approving. -
If Copilot offers an evaluation suite, optionally accept and work through it as an additional check.
-
Select Foundry Toolkit, expand My Resources, and select Agents. On the Agents tab, switch to Hosted Agent.

-
Select the agent name and confirm deployment status is Running. Switch to Playground and repeat the grounding, missing-data, out-of-catalog, vagueness, and ranking checks against the deployed catalog.

-
If deployment or responses fail, inspect the reported status and logs with Copilot, correct the failure in the existing project, and repeat the checks. Do not proceed with an unverified deployment.
Completion checkpoint
You scaffolded the Backer Concierge, debugged its catalog grounding in Agent Inspector, deployed it to Foundry through the Go production handoff, and retested the hosted version in the Playground. The checkpoint for this module is a running hosted agent that respects the catalog without inventing missing information.
Next, you’ll use the same tailspin-toys project, model deployment, and hosted agent to connect the agent to the site. If you’re stopping here, clean up your Azure resources to avoid ongoing costs.
| Next module: Connect the agent to the site → |
|---|