Man­aged Agent or Cus­tom Orchestration?



When the plat­form agent is enough and when con­trol should stay in your own code

Whether to use a man­aged agent or build your own orches­tra­tion is a ques­tion that comes up in almost every pro­ject where we build an AI assist­ant. Motiv­ated by one of our cur­rent pro­jects, we show how to decide.

We are build­ing an AI assist­ant for the Pro­ject Man­age­ment Office of a health­care com­pany. It answers ques­tions about ongo­ing pro­jects in Microsoft Teams, such as status, dead­lines, risks or respons­ib­il­it­ies, and backs every answer with pro­ject documents.

Mid­way through the pro­ject, we tested whether a man­aged agent from Microsoft Foundry (formerly Azure AI Foundry) could replace our cus­tom-built orches­tra­tion. The rebuild was done quickly, and the code shrank to a frac­tion of its size. After less than a day, we still decided to keep the orches­tra­tion in our own code and to use Foundry for the models.

Three require­ments that are cent­ral to our use case tipped the scale:

  • Tar­geted fil­ter­ing. “Status of pro­ject X in June” is not a sim­il­ar­ity search, because it cov­ers exactly one pro­ject and one time period. The plat­form agent sets its search fil­ter once, and it then applies to “all quer­ies the agent makes to the index” [3]. In our case, the fil­ter has to change with every question.
  • Cita­tions in our format. Sources need a link, a page num­ber and num­ber­ing accord­ing to our rules. The plat­form format would have needed rework in sev­eral places.
  • Trace­ab­il­ity. For every answer, we need to see which search led to which res­ult and how reli­able the sources are.

Our com­mit mes­sage at the time read “more con­trol, more fil­ters, more audit”. Bey­ond our case, the test raised a gen­eral ques­tion: which parts should come from the plat­form, and which should stay in your own code?


Agent, work­flow, man­aged agent: three dif­fer­ent things

When people talk about “agents”, they often mean three designs at once:

DesignWho con­trols the flow?Example
Work­flowthe code, with fixed stepsGen­er­ate a monthly report from fixed sources
Agentthe model decides which tool to use and whenResearch assist­ant with search tools
Man­aged agentlike an agent, but the plat­form provides loop, tools and historyPrompt agent in Foundry, agents in Copi­lot Studio

Table 1: Work­flow, agent and man­aged agent – who con­trols the flow?

Workflow, agent and managed agent: where the loop runs

Fig­ure 1: In a work­flow, the code sets the steps. In an agent, the model runs a loop over its tools. A man­aged agent runs the same loop on the platform.

Anthropic sep­ar­ates the first two clearly: work­flows run through “pre­defined code paths”, while agents “dynam­ic­ally dir­ect their own pro­cesses and tool usage” [1]. A man­aged agent is less a third archi­tec­ture than a decision about who runs the loop.

The actual archi­tec­ture decision is there­fore where you draw the line between the plat­form and your own code. Whatever sits on the plat­form side, you can only con­fig­ure. With a man­aged agent, that includes the loop itself: which tool the model calls next, how the search is filtered, what goes into the his­tory and what gets logged. You can­not add your own step between two tool calls. In return, you write less code and run no host­ing of your own. Every require­ment that needs such a step, like the fil­ters, cita­tions and trace­ab­il­ity in our pro­ject, pushes the line towards your own code.


When the man­aged agent is the right choice

Microsoft describes prompt agents as suit­able for pro­duc­tion sys­tems “that don’t need cus­tom orches­tra­tion logic” [2]. Cus­tom orches­tra­tion logic is any con­trol flow you define your­self: set­ting fil­ters per ques­tion, check­ing an answer before it goes out, lim­it­ing the num­ber of model calls or run­ning steps in a fixed order. If you need none of that, the man­aged agent fits, for example for:

  • gen­eral Q&A over a homo­gen­eous know­ledge base, such as a hand­book, a policy col­lec­tion or an FAQ
  • pro­to­types and demos, where time to first res­ult matters
  • teams without their own devel­op­ment capa­city, for whom oper­a­tions and updates by the plat­form are a real advantage
  • cases where stand­ard tools such as search, code exe­cu­tion and web search are enough, without cus­tom rules in between

The Cloud Adop­tion Frame­work is even more dir­ect: if a pre­b­uilt agent meets the require­ments, “adopt the pre­b­uilt solu­tion” [5].


When cus­tom orches­tra­tion beats a man­aged agent

In our case, all of the fol­low­ing sig­nals applied:

  1. Retrieval is the busi­ness logic. If the answer depends on which doc­u­ments are searched (ten­ant, pro­ject, time period, per­mis­sions), the model must be able to set these fil­ters per question.
  2. Answers must be backed by sources accord­ing to your own rules, for example “no state­ment without a source” or “ ‘there is noth­ing on this’ only after an actual search”. Such rules need a check step before out­put that you can build yourself.
  3. Someone will ask why the sys­tem said some­thing. Then you need a log per answer in your own schema. For high-risk sys­tems, the EU AI Act even man­dates auto­matic log­ging (Art. 12) [10]. An internal know­ledge tool usu­ally does not fall under it, but the art­icle is still a use­ful bench­mark. The same logs also feed the regres­sion tests we describe in Test­ing AI Agents.
  4. Cost and response time need hard lim­its, for example at most n model calls per ques­tion before the sys­tem answers.

12-Factor Agents comes to the same con­clu­sion from prac­tice. It describes many pro­duc­tion agents as “mostly determ­in­istic code, with LLM steps sprinkled in at just the right points” and lists Own your prompts, Own your con­text win­dow and Own your con­trol flow as factors [7].

Cus­tom orches­tra­tion still uses the plat­form. Mod­els, search, iden­tity and host­ing come from the cloud, and Microsoft provides for this path by let­ting you call the Responses API from an agent “you already run else­where” [2]. You also keep your frame­works. We use Lang­Graph because it “does not abstract prompts or archi­tec­ture” [8].


Not everything that uses an LLM should be an agent

The most import­ant les­son from the pro­ject was that we needed work­flows along­side the chat agent.

A risk report must have the same struc­ture and rely on the same sources every time it is gen­er­ated, and it must be veri­fi­able. If a model decides freely which doc­u­ments to read for it, the res­ult depends on what the model hap­pens to focus on. We there­fore imple­men­ted reports as a recipe: the code defines the basis, time win­dow and sec­tions, and the model only writes the indi­vidual sec­tions. The word­ing can still dif­fer between two runs, the sources and the struc­ture can­not. OpenAI recom­mends the same where no com­plex decision is needed, since “a determ­in­istic solu­tion may suf­fice” [6], and Anthropic advises start­ing with “the simplest solu­tion pos­sible” [1]. With cus­tom orches­tra­tion, both run in one sys­tem: open-ended research in the chat and fixed pro­cesses for documents.

Some­times a prob­lem needs no AI at all. We show how to spot this in our post Not Every Prob­lem Is an AI Use Case.


The middle ground: hos­ted agents

Foundry also offers hos­ted agents. Your own orches­tra­tion code, for example with Lang­Graph or the Microsoft Agent Frame­work [9], runs as a con­tainer on the plat­form, and Foundry handles host­ing and ver­sion­ing “while your cus­tom code handles orches­tra­tion” [4]. You keep full con­trol over the loop without run­ning your own infra­struc­ture. In exchange, you still build, test and update the con­tainer your­self, and you are more tied to Foundry than with your own backend. For us, this would have added little, because the backend already runs as a sep­ar­ate ser­vice behind the Teams bot. If you do not have your own host­ing, this option is worth a look.


Decision guide: man­aged agent or cus­tom orchestration?

Five ques­tions help before choosing:

  1. Does the model need to fil­ter per ques­tion, bey­ond semantic similarity?
  2. Is there a cita­tion require­ment with your own rules?
  3. Must each answer be trace­able?
  4. Are there out­puts that must be repro­du­cible, such as reports or exports?
  5. Do you need hard lim­its on cost and response time?

With zero or one yes, the man­aged agent is a good start. With two or more, plan for cus­tom orches­tra­tion from the start and use the plat­form for mod­els, search and identity.

Com­par­ison: man­aged agent, hos­ted agent, cus­tom backend

Cri­terionMan­aged agentHos­ted agentCus­tom backend
Time to demohoursdaysdays
Fil­ter per questionstatic per agent ver­sion [3]freefree
Cita­tion rules, check stepplat­form formatown rulesown rules
Log per answerplat­form tracingown codeown schema
Fixed pro­cesses (work­flows)dif­fi­cultin codein code
Host­ing, updatesplat­formplat­formown team

Table 2: Man­aged agent, hos­ted agent and cus­tom backend compared

Fixed pro­cesses are dif­fi­cult with a man­aged agent because the model decides which tool to call and in which order. A prompt can ask for step 2 after step 1, but it can­not guar­an­tee it. In your own code, the order is part of the pro­gram. In Lang­Graph, for example, you build a work­flow as a graph with fixed edges between the steps and use an agent only where the model should decide for itself [12]. Foundry has added work­flows of its own that chain agents in a pre­defined order [11], cur­rently in preview.

If the answer is still unclear, a short trial helps. The Cloud Adop­tion Frame­work recom­mends a time-boxed trial of one to two weeks for each option [5]. For us, less than a day was enough because the require­ments were clear, and the test also showed us which parts of our solu­tion are busi­ness logic and which are infrastructure.


Con­clu­sion: when a man­aged agent is enough

Man­aged agents suit stand­ard Q&A, pro­to­types and teams that want to hand off oper­a­tions. Cus­tom orches­tra­tion pays off once retrieval is the busi­ness logic, answers must be backed by sources and pro­cesses must be repro­du­cible. In both cases, the plat­form provides mod­els, search and iden­tity, and the require­ments decide where you draw the line, not the speed of the first demo.

If you are about to start, answer the five ques­tions above with your busi­ness unit and build a one-day pro­to­type with the man­aged agent. Its lim­its will show you quickly which parts belong in your own code.


Sources

  1. Schluntz, E.; Zhang, B.: Build­ing effect­ive agents. Anthropic, Dec 19, 2024. https://www.anthropic.com/engineering/building-effective-agents
  2. Microsoft Learn: What is Microsoft Foundry Agent Ser­vice? Updated Sep 25, 2026. https://learn.microsoft.com/en-us/azure/foundry/agents/overview
  3. Microsoft Learn: Con­nect an Azure AI Search index to Foundry agents. Updated Oct 8, 2026. https://learn.microsoft.com/en-us/azure/foundry/agents/how-to/tools/ai-search
  4. Microsoft Learn: Hos­ted agents. Updated Sep 11, 2026. https://learn.microsoft.com/en-us/azure/foundry/agents/concepts/hosted-agents
  5. Microsoft Cloud Adop­tion Frame­work: Tech­no­logy plan for AI agents. Updated Jun 25, 2026. https://learn.microsoft.com/en-us/azure/cloud-adoption-framework/ai-agents/technology-solutions-plan-strategy
  6. OpenAI: A prac­tical guide to build­ing agents. 2025. https://cdn.openai.com/business-guides-and-resources/a‑practical-guide-to-building-agents.pdf
  7. Horthy, D. (Human­Layer): 12-Factor Agents. Git­Hub. https://github.com/humanlayer/12-factor-agents
  8. Lang­Chain: Lang­Graph over­view. https://docs.langchain.com/oss/python/langgraph/overview
  9. Henry, S.: Microsoft Agent Frame­work Ver­sion 1.0. Microsoft DevB­logs, Apr 3, 2026. https://devblogs.microsoft.com/agent-framework/microsoft-agent-framework-version‑1–0/
  10. Reg­u­la­tion (EU) 2024/1689 (AI Act), Art. 12. https://eur-lex.europa.eu/eli/reg/2024/1689/oj/eng
  11. Microsoft Learn: Build a work­flow in Microsoft Foundry (Pre­view). https://learn.microsoft.com/en-us/azure/foundry/agents/concepts/workflow
  12. Lang­Chain: Work­flows and agents. Lang­Graph doc­u­ment­a­tion. https://docs.langchain.com/oss/python/langgraph/workflows-agents