An agent harness is the software that coordinates a model, its tools, and the context it needs to do the work. If the model asks to look up an invoice, the harness handles the tool call and passes the result back. The model can then answer, ask for missing information, or request another tool. That back-and-forth is the agent loop.
In Microsoft Foundry, a prompt agent is a versioned definition: you configure the model, instructions, and tools, and Foundry runs the loop. The Microsoft Copilot harness is an optional managed runtime for that same type of agent. A hosted agent takes a different approach: Foundry hosts your application, but your code controls how the work runs.
An invoice review makes the distinction concrete. Checking one invoice, reviewing six PDFs, and running a restartable batch all use the same financial rules. They don’t need the same execution behavior.
How to choose an agent runtime
A default prompt agent can already make multiple model and tool calls. The question isn’t “How many steps are there?” It’s “Can the managed runtime do what I need, or does my application need to control how the work runs?”
The invoice check that stays the same
An accounts payable analyst wants to know whether invoice INV-104 matches its purchase order. The invoice is $1,250 USD and the order, PO-501, is $1,000 USD. The reconciliation API returns AMOUNT_MISMATCH and a variance of 25000 cents: $250 over.
All three approaches use that same read-only API. It checks that the currencies match before comparing amounts in integer minor units. The model explains the result; it doesn’t calculate it. And a match is just a match: the sample has no payment or approval operations.
The data is synthetic. A PDF helps identify the invoice to look up, but the API compares its stored records—not the totals printed in the PDF.
1. Default prompt agent: Check an invoice on demand
“Check INV-104 against its purchase order” is a good fit for the default runtime. The model can request check_invoice through the configured OpenAPI tool, and Foundry passes the result back so the model can explain the discrepancy. The business rules already live behind the API; there’s no need to build orchestration around them.
2. Microsoft Copilot harness: Review a batch of PDFs
Now give the agent six PDFs instead of an invoice ID. It has to identify the invoices, handle the one file it can’t read, verify the other five, and produce something the analyst can download. The reconciliation API hasn’t changed. The work around it has.
The Microsoft Copilot harness in Foundry is a managed runtime for prompt agents, in public preview. Foundry runs the agent loop and sandbox; you configure the instructions, reusable skills, knowledge sources, and tools the task needs. In this example, a versioned review skill describes what to check and how to report it. The API supplies the financial evidence. The agent creates the reports in its conversation workspace, then uploads them to Foundry Files.
Two fields in the agent definition make the distinction clear: kind stays prompt; the runtime changes.
kind: prompt
harness:
type: microsoft_copilot_preview
The trace is more useful than the final chat response for understanding what ran. It shows the skill invocation, model calls, five calls to the reconciliation tool, and a file-creation operation. There were six PDFs but only five readable IDs. The agent flagged the sixth file rather than guessing an ID.
3. Hosted agent: Control retries and recovery
INV-107 is the case that best explains why you’d choose a hosted agent. In an interactive review, a timeout belongs in the report: the analyst can still use the other results and follow up on the unresolved invoice. In a batch workflow, the requirement can be stricter: if verification is still unavailable after a fixed number of retries, save the completed checks but don’t commit the final report. A missing purchase order is a result. A timeout means the check couldn’t produce one.
Foundry hosts the Python handler, but the handler sets the retry limit, saves a checkpoint for each completed invoice, and reuses those checkpoints when the same job is submitted again. It writes the final report only if that report doesn’t already exist. The model drafts a summary from the validated results; it doesn’t decide what to retry or when to commit.
The three approaches at a glance
| Default prompt agent | Prompt agent with the Microsoft Copilot harness | Hosted agent | |
|---|---|---|---|
| What you provide | Model selection, instructions, and supported tools. | A prompt-agent definition with the Copilot harness selected, plus any supported skills and tools you need. | Application code with your chosen framework and dependencies. |
| What Foundry manages | The agent loop, including coordination of model and configured tool calls. | The agent loop, a per-conversation workspace, and a sandbox for supported operations. | Hosting and platform capabilities, including resilience when configured. Your code owns orchestration, retry policy, application checkpoints, and writes. |
| When to choose it | The default runtime and supported tools meet the requirement. | You need the managed workspace or other supported harness capabilities, and public preview is acceptable. | Your application needs to control how the work runs, resumes, or commits results. |
| In the invoice example | Check INV-104 and explain the $250 discrepancy. | Review six PDFs and return downloadable CSV and Markdown reports. | Reuse completed checks and prevent duplicate report commits for the same job. |
Pick the runtime for the requirement
Start with a default prompt agent when the model and supported tools can do the job. Reach for the Microsoft Copilot harness when you need managed capabilities such as a reusable skill and a workspace for files. Use a hosted agent when your application needs to enforce retries, recovery, or write behavior in code.
The sample repository includes all three implementations, the six invoice PDFs, and a local checkpoint-recovery walkthrough. The invoice is $250 over in every version. What changes is who decides what happens next.
Published Nov 24, 2026
Version 1.0SriAishwaryaMasina
Microsoft
Joined November 16, 2026
Microsoft Foundry Blog
Follow this blog board to get notified when there's new activity