[MS] The Microsoft Agent Framework Harness is now released - devamazonaws.blogspot.com
Your agents can now be built on a stable, batteries-included harness - the loop, planning, memory, context management, approvals, and telemetry that turn a model into an agent that actually does things - in both Python and .NET.
Post Updated on July 22, 2026 at 09:54AM
Thanks for reading
from devamazonaws.blogspot.com
What is an agent harness?
An agent harness is the scaffolding that turns a language model into an agent. A model on its own can only generate text. To have it call tools, work through multi-step tasks, remember what it has done, and keep going until the job is finished, you need a runtime wrapped around the model - and that runtime is the harness. Agent Framework ships a ready-made one so you don't have to build that scaffolding yourself. It's an opinionated, fully customizable, batteries-included agent that wraps a chat client with a complete agentic pipeline, tuned for long-running, autonomous work such as research, data analysis, and general task automation. Internally it's just a chat-client agent (Agent in Python, ChatClientAgent in .NET) with a curated set of Agent Framework features added - each enabled by default and individually customizable or removable:
- Function invocation - the automatic tool-calling loop, with a configurable iteration limit.
- Per-service-call history persistence - chat history saved after every model call for crash
- Compaction - context-window management so long tool-calling loops don't overflow.
- Todo & agent-mode providers - a persistent todo list plus plan/execute mode tracking, so the agent plans work then executes it.
- File memory - durable session notes and artifacts that survive across turns.
- Skills - progressive discovery and loading of packaged domain expertise.
- Web search - enables the inference service's built-in web search tool, when the underlying service provides one, so the agent can ground answers in current information.
- Tool approval - "don't ask again" standing rules plus heuristic auto-approval for safe calls.
- Telemetry - built-in OpenTelemetry.
What you can do with it
Here are some examples of the types of agents you can build with it:- Research assistants that plan a topic into todos, switch between plan and execute modes, search the web, and work autonomously through the plan.
- Data-processing agents that read and analyze a folder of files with approval-gated file tools.
- Domain assistants - like a personal-finance "claw" - that combine custom tools, memory, skills, and planning into a single agent you can grow feature by feature.
A basic harness agent
The harness collapses the whole pipeline into a single call. You bring a chat client, instructions, and (optionally) custom tools; the harness adds function invocation, planning, history persistence, compaction, approvals, web search, and telemetry. .NETusing Azure.AI.Projects;
using Azure.Identity;
using Microsoft.Agents.AI;
using Microsoft.Extensions.AI;
var endpoint = Environment.GetEnvironmentVariable("FOUNDRY_PROJECT_ENDPOINT")
?? throw new InvalidOperationException("FOUNDRY_PROJECT_ENDPOINT is not set.");
var deploymentName = Environment.GetEnvironmentVariable("FOUNDRY_MODEL") ?? "gpt-5.4";
// Build an IChatClient backed by a Microsoft Foundry project...
IChatClient chatClient =
new AIProjectClient(new Uri(endpoint), new DefaultAzureCredential())
.GetProjectOpenAIClient()
.GetResponsesClient()
.AsIChatClient(deploymentName);
// ...then wrap it in the harness. One call gives you the full agentic pipeline.
AIAgent agent = chatClient.AsHarnessAgent(new HarnessAgentOptions
{
ChatOptions = new ChatOptions
{
Instructions = "You are a helpful research assistant. Plan your work, then execute it.",
Tools = [/* your custom AIFunction tools */],
},
});
AgentRunResponse response = await agent.RunAsync("Research the outlook for renewable energy stocks.");
Console.WriteLine(response.Text);
Python
import asyncio
from agent_framework import create_harness_agent
from agent_framework.foundry import FoundryChatClient
from azure.identity import AzureCliCredential
async def main() -> None:
# FoundryChatClient reads FOUNDRY_PROJECT_ENDPOINT and FOUNDRY_MODEL from the environment.
client = FoundryChatClient(credential=AzureCliCredential())
# One call builds a batteries-included agent: planning, history persistence,
# compaction, approvals, web search, and telemetry are all wired in for you.
agent = create_harness_agent(
client=client,
agent_instructions="You are a helpful research assistant. Plan your work, then execute it.",
tools=[], # add your own callable tools here
)
response = await agent.run("Research the outlook for renewable energy stocks.")
print(response.text)
if __name__ == "__main__":
asyncio.run(main())
That single call gives you function invocation, per-service-call history persistence, a todo list and plan/execute mode tracking, compaction, approvals, web search, and telemetry - all on by default and each configurable. You only supplied the instructions and your tools.
Build a real one, step by step
Why not build your own personal-finance assistant using the Agent Framework harness. You can add: custom tools, memory, skills, shell, CodeAct, background agents, governance, and Foundry hosted deployment, See the Build your own claw and agent harness with Microsoft Agent Framework series.Coming soon
While we are releasing the core harness, there are a few opt-in features that we are not releasing yet. It's possible to use these already, but we think we can make them even better, and we would like to get more customer feedback before we release them. Until such time, you will get a warning when opting into these features:- Background agents - delegate sub-tasks to other agents concurrently.
- File access - read/write file tools scoped to a working directory.
- Looping - automatically re-invoke the agent until a completion condition is met.
- Shell tooling - run shell commands (from the alpha-stage tools package).
Conclusion
With the harness, Agent Framework gives developers a production-ready agent runtime out of the box. Bring your model, instructions, and tools, and let the framework handle planning, memory, tool orchestration, approvals, context management, and telemetry.Get started
- Documentation: Agent Harnesses on Microsoft Learn
- Samples:
- .NET -
dotnet/samples/02-agents/Harness - Python -
python/samples/02-agents/harness
- .NET -
Post Updated on July 22, 2026 at 09:54AM
Thanks for reading
from devamazonaws.blogspot.com
Comments
Post a Comment