Mana­ged Agent or Cus­tom Orchestration?



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

Whe­ther to use a mana­ged agent or build your own orchestra­tion is a ques­tion that comes up in almost every pro­ject where we build an AI assistant. Moti­va­ted by one of our cur­rent pro­jects, we show how to decide.

We are buil­ding an AI assistant for the Pro­ject Manage­ment Office of a health­care com­pany. It ans­wers ques­ti­ons about ongo­ing pro­jects in Micro­soft Teams, such as sta­tus, dead­lines, risks or respon­si­bi­li­ties, and backs every ans­wer with pro­ject documents.

Mid­way through the pro­ject, we tes­ted whe­ther a mana­ged agent from Micro­soft Foundry (form­erly Azure AI Foundry) could replace our cus­tom-built orchestra­tion. The rebuild was done quickly, and the code shrank to a frac­tion of its size. After less than a day, we still deci­ded to keep the orchestra­tion in our own code and to use Foundry for the models.

Three requi­re­ments that are cen­tral to our use case tip­ped the scale:

  • Tar­ge­ted fil­te­ring. „Sta­tus of pro­ject X in June“ is not a simi­la­rity search, because it covers exactly one pro­ject and one time period. The plat­form agent sets its search fil­ter once, and it then applies to „all queries the agent makes to the index“ [3]. In our case, the fil­ter has to change with every question.
  • Cita­ti­ons in our for­mat. Sources need a link, a page num­ber and num­be­ring accor­ding to our rules. The plat­form for­mat would have nee­ded rework in seve­ral places.
  • Tracea­bi­lity. For every ans­wer, we need to see which search led to which result and how relia­ble 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 rai­sed a gene­ral ques­tion: which parts should come from the plat­form, and which should stay in your own code?


Agent, work­flow, mana­ged agent: three dif­fe­rent things

When peo­ple talk about „agents“, they often mean three designs at once:

DesignWho con­trols the flow?Exam­ple
Work­flowthe code, with fixed stepsGene­rate a monthly report from fixed sources
Agentthe model deci­des which tool to use and whenRese­arch assistant with search tools
Mana­ged agentlike an agent, but the plat­form pro­vi­des loop, tools and historyPrompt agent in Foundry, agents in Copi­lot Studio

Table 1: Work­flow, agent and mana­ged agent – who con­trols the flow?

Workflow, agent and managed agent: where the loop runs

Figure 1: In a work­flow, the code sets the steps. In an agent, the model runs a loop over its tools. A mana­ged agent runs the same loop on the platform.

Anthro­pic sepa­ra­tes the first two cle­arly: work­flows run through „pre­de­fi­ned code paths“, while agents „dyna­mi­cally direct their own pro­ces­ses and tool usage“ [1]. A mana­ged agent is less a third archi­tec­ture than a decis­ion about who runs the loop.

The actual archi­tec­ture decis­ion is the­r­e­fore where you draw the line bet­ween the plat­form and your own code. Wha­te­ver sits on the plat­form side, you can only con­fi­gure. With a mana­ged agent, that includes the loop its­elf: which tool the model calls next, how the search is fil­te­red, what goes into the history and what gets log­ged. You can­not add your own step bet­ween two tool calls. In return, you write less code and run no hos­ting of your own. Every requi­re­ment that needs such a step, like the fil­ters, cita­ti­ons and tracea­bi­lity in our pro­ject, pushes the line towards your own code.


When the mana­ged agent is the right choice

Micro­soft descri­bes prompt agents as sui­ta­ble for pro­duc­tion sys­tems „that don’t need cus­tom orchestra­tion logic“ [2]. Cus­tom orchestra­tion logic is any con­trol flow you define yours­elf: set­ting fil­ters per ques­tion, che­cking an ans­wer before it goes out, limi­ting the num­ber of model calls or run­ning steps in a fixed order. If you need none of that, the mana­ged agent fits, for exam­ple for:

  • gene­ral Q&A over a homo­ge­neous know­ledge base, such as a hand­book, a policy coll­ec­tion or an FAQ
  • pro­to­ty­pes and demos, where time to first result matters
  • teams wit­hout their own deve­lo­p­ment capa­city, for whom ope­ra­ti­ons and updates by the plat­form are a real advantage
  • cases where stan­dard tools such as search, code exe­cu­tion and web search are enough, wit­hout cus­tom rules in between

The Cloud Adop­tion Frame­work is even more direct: if a pre­built agent meets the requi­re­ments, „adopt the pre­built solu­tion“ [5].


When cus­tom orchestra­tion beats a mana­ged agent

In our case, all of the fol­lo­wing signals applied:

  1. Retrie­val is the busi­ness logic. If the ans­wer depends on which docu­ments are sear­ched (ten­ant, pro­ject, time period, per­mis­si­ons), the model must be able to set these fil­ters per question.
  2. Ans­wers must be backed by sources accor­ding to your own rules, for exam­ple „no state­ment wit­hout a source“ or „ ‚there is not­hing 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 ans­wer in your own schema. For high-risk sys­tems, the EU AI Act even man­da­tes auto­ma­tic log­ging (Art. 12) [10]. An inter­nal know­ledge tool usually does not fall under it, but the article is still a useful 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 limits, for exam­ple at most n model calls per ques­tion before the sys­tem answers.

12-Fac­tor Agents comes to the same con­clu­sion from prac­tice. It descri­bes many pro­duc­tion agents as „mostly deter­mi­ni­stic code, with LLM steps sprink­led in at just the right points“ and lists Own your prompts, Own your con­text win­dow and Own your con­trol flow as fac­tors [7].

Cus­tom orchestra­tion still uses the plat­form. Models, search, iden­tity and hos­ting come from the cloud, and Micro­soft pro­vi­des for this path by let­ting you call the Respon­ses API from an agent „you alre­ady run else­where“ [2]. You also keep your frame­works. We use Lang­Graph because it „does not abs­tract prompts or archi­tec­ture“ [8].


Not ever­y­thing that uses an LLM should be an agent

The most important les­son from the pro­ject was that we nee­ded 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 gene­ra­ted, and it must be veri­fia­ble. If a model deci­des freely which docu­ments to read for it, the result depends on what the model hap­pens to focus on. We the­r­e­fore imple­men­ted reports as a recipe: the code defi­nes the basis, time win­dow and sec­tions, and the model only wri­tes the indi­vi­dual sec­tions. The wor­ding can still dif­fer bet­ween two runs, the sources and the struc­ture can­not. Ope­nAI recom­mends the same where no com­plex decis­ion is nee­ded, since „a deter­mi­ni­stic solu­tion may suf­fice“ [6], and Anthro­pic advi­ses start­ing with „the simp­lest solu­tion pos­si­ble“ [1]. With cus­tom orchestra­tion, both run in one sys­tem: open-ended rese­arch in the chat and fixed pro­ces­ses for documents.

Some­ti­mes a pro­blem needs no AI at all. We show how to spot this in our post Not Every Pro­blem Is an AI Use Case.


The middle ground: hos­ted agents

Foundry also offers hos­ted agents. Your own orchestra­tion code, for exam­ple with Lang­Graph or the Micro­soft Agent Frame­work [9], runs as a con­tai­ner on the plat­form, and Foundry hand­les hos­ting and ver­sio­ning „while your cus­tom code hand­les orchestra­tion“ [4]. You keep full con­trol over the loop wit­hout run­ning your own infra­struc­ture. In exch­ange, you still build, test and update the con­tai­ner yours­elf, and you are more tied to Foundry than with your own backend. For us, this would have added little, because the backend alre­ady runs as a sepa­rate ser­vice behind the Teams bot. If you do not have your own hos­ting, this option is worth a look.


Decis­ion guide: mana­ged agent or cus­tom orchestration?

Five ques­ti­ons help before choosing:

  1. Does the model need to fil­ter per ques­tion, bey­ond seman­tic similarity?
  2. Is there a cita­tion requi­re­ment with your own rules?
  3. Must each ans­wer be traceable?
  4. Are there out­puts that must be repro­du­ci­ble, such as reports or exports?
  5. Do you need hard limits on cost and response time?

With zero or one yes, the mana­ged agent is a good start. With two or more, plan for cus­tom orchestra­tion from the start and use the plat­form for models, search and identity.

Com­pa­ri­son: mana­ged agent, hos­ted agent, cus­tom backend

Cri­ter­ionMana­ged agentHos­ted agentCus­tom backend
Time to demohoursdaysdays
Fil­ter per questionsta­tic per agent ver­sion [3]freefree
Cita­tion rules, check stepplat­form formatown rulesown rules
Log per answerplat­form tracingown codeown schema
Fixed pro­ces­ses (work­flows)dif­fi­cultin codein code
Hos­ting, updatesplat­formplat­formown team

Table 2: Mana­ged agent, hos­ted agent and cus­tom backend compared

Fixed pro­ces­ses are dif­fi­cult with a mana­ged agent because the model deci­des which tool to call and in which order. A prompt can ask for step 2 after step 1, but it can­not gua­ran­tee it. In your own code, the order is part of the pro­gram. In Lang­Graph, for exam­ple, you build a work­flow as a graph with fixed edges bet­ween the steps and use an agent only where the model should decide for its­elf [12]. Foundry has added work­flows of its own that chain agents in a pre­de­fi­ned order [11], curr­ently in preview.

If the ans­wer 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 requi­re­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 mana­ged agent is enough

Mana­ged agents suit stan­dard Q&A, pro­to­ty­pes and teams that want to hand off ope­ra­ti­ons. Cus­tom orchestra­tion pays off once retrie­val is the busi­ness logic, ans­wers must be backed by sources and pro­ces­ses must be repro­du­ci­ble. In both cases, the plat­form pro­vi­des models, search and iden­tity, and the requi­re­ments decide where you draw the line, not the speed of the first demo.

If you are about to start, ans­wer the five ques­ti­ons above with your busi­ness unit and build a one-day pro­to­type with the mana­ged agent. Its limits will show you quickly which parts belong in your own code.


Sources

  1. Schl­untz, E.; Zhang, B.: Buil­ding effec­tive agents. Anthro­pic, Dec 19, 2024. https://www.anthropic.com/engineering/building-effective-agents
  2. Micro­soft Learn: What is Micro­soft Foundry Agent Ser­vice? Updated Sep 25, 2026. https://learn.microsoft.com/en-us/azure/foundry/agents/overview
  3. Micro­soft 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. Micro­soft Learn: Hos­ted agents. Updated Sep 11, 2026. https://learn.microsoft.com/en-us/azure/foundry/agents/concepts/hosted-agents
  5. Micro­soft 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. Ope­nAI: A prac­ti­cal guide to buil­ding agents. 2025. https://cdn.openai.com/business-guides-and-resources/a‑practical-guide-to-building-agents.pdf
  7. Hor­thy, D. (Human­Layer): 12-Fac­tor 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.: Micro­soft Agent Frame­work Ver­sion 1.0. Micro­soft Dev­Blogs, Apr 3, 2026. https://devblogs.microsoft.com/agent-framework/microsoft-agent-framework-version‑1–0/
  10. Regu­la­tion (EU) 2024/1689 (AI Act), Art. 12. https://eur-lex.europa.eu/eli/reg/2024/1689/oj/eng
  11. Micro­soft Learn: Build a work­flow in Micro­soft Foundry (Pre­view). https://learn.microsoft.com/en-us/azure/foundry/agents/concepts/workflow
  12. Lang­Chain: Work­flows and agents. Lang­Graph docu­men­ta­tion. https://docs.langchain.com/oss/python/langgraph/workflows-agents