|

Prefect In An AI Agent Backend

Prefect In An AI Agent Backend

Version 58 | Created: 2026-09-27 | Updated: 2026-11-07 13:46 UTC

1. Purpose

  • Problem Statement: No account exists of how a Prefect workflow is used to build an AI agent or an AI orchestrator, or of where using it creates a strength.
  • Goal: Split the frontend and backend roles of an AI orchestrator and an AI agent, and state what Prefect can specially do for the backend role and how it does it, so as to produce the benchmarking material a manager or a designer consults.
  • Non-Goal: Designing an agent's prompt and its tools is not covered, the implementation Python code is not given, and no comparison is made with orchestrators other than Prefect (Airflow, Temporal, Dagster and the like).

2. Summary

An AI agent backend carries three responsibilities that decide what starts a run, how many calls run at once, and what ran. Those three together are the orchestrator [1], and Prefect is the product that carries them. Wrapping a tool call as a task puts the point a stopped run resumes from and the retry of a failed step on Prefect as well, while the LLM call that picks the next action and the Python code inside a tool stay with the agent framework. Fig 1 draws where the orchestrator sits inside the backend. An agent framework does the work inside one run only, so without Prefect the backend engineer implements those three in Python code. Six of the ten functions in Table 3 β€” suspension, idempotent rerun, declared rate limiting, per-step observability, one admission path and ML pipeline integration β€” together with orchestrator scope, access control and inbound events make the nine criteria a benchmarking sheet compares products on.

The frontend keeps its three roles when Prefect is used and gains one duty: the answer a paused run waits for arrives through the frontend. The agent framework the comparison is made against is LangGraph, chosen because its checkpointer and its node retry policy, the two entries the Without Prefect column of Table 3 rests on, are stated in vendor documentation [2]; the other frameworks in use are listed in Appendix D. Appendix B lists the nine things Prefect does inside an agent backend and the three it leaves to the agent framework and the API server, and Appendix C shows how the event trigger among them is attached.

3. Taxonomy and its Hierarchy

The frontend's work ends once it has put the user's request into the form the backend accepts, and the backend takes over at the first LLM call, so the backend runs the reasoning loop. Ten responsibilities split across the two layers, three on the frontend and seven on the backend, of which admission, throughput and record are the orchestrator. The seven are ordered by the scope each one has to hold: one step, one run, or every run at once.

Scope is what decides who carries a responsibility. A framework runs inside one graph run, so it covers the one-step and one-run responsibilities; the orchestrator is the part that carries the three every-run responsibilities, namely admission, throughput and record. The ten roles, the layer of each, and what each one decides are drawn in Fig 1.

LAYER          ROLE              WHAT THE ROLE DECIDES                        SCOPE       PART

Frontend  >    Intent            What the user asked, in the backend's form   one request
               Approval          The answer a paused run is waiting for       one run
               Presentation      What the user sees of the result             one request
      |   one request crosses the boundary
      v
Backend   >    Reasoning         Which action the LLM picks next              one step    --+
               Tool execution    The action actually carried out              one step      |
               State             The point a stopped run resumes from         one run       |  Agent
               Recovery          Which failed step is retried, and how often  one run     --+
               Admission         What starts a run: request, schedule, event  every run   --+
               Throughput        How many calls run at once, and how fast     every run     |  Orchestrator
               Record            What ran, when, and with which result        every run   --+

Fig 1. The three frontend roles and the seven backend responsibilities ordered by scope, four of them the agent and three the orchestrator

Each time the scope widens, one more place is needed for the state that has to outlive the previous scope. One-step scope needs nothing beyond the process, one-run scope needs a store the process can die without losing, and every-run scope needs a service that outlives every process and reports which runs there were.

3.1 Comparison

Table 1. Each role, the part that holds it, and what settles it

# Role Part Scope Settled by
1 Intent Frontend One request The request schema the backend accepts
2 Approval Frontend One run The input form that carries the answer a paused run waits for
3 Presentation Frontend One request The stream or page the user reads
4 Reasoning Agent One step The LLM call and the tool choice that call returns
5 Tool execution Agent One step The Python function the chosen tool names
6 State Agent One run The checkpoint a resumed run reads
7 Recovery Agent One run The retry count, and the finished steps a rerun skips
8 Admission Orchestrator Every run The deployment and the request, schedule or event that starts it
9 Throughput Orchestrator Every run The concurrency limit and the call rate
10 Record Orchestrator Every run The run history each step writes

No agent framework carries the three orchestrator rows, so a design names a product on those rows and writes Python code on the others.

🌳 Prefect carries all three orchestrator roles β€” #8 Admission, #9 Throughput and #10 Record β€” and, once a tool call is wrapped as a task, the retries and the result caching of #6 State and #7 Recovery as well. It does not carry #4 Reasoning or #5 Tool execution, which is why the LLM call that picks the next action and the Python code inside a tool stay with the agent framework.

4. Backend Composition

The two compositions run the same reasoning loop and differ in where that loop lives. Without Prefect the loop runs inside the process that answered the request; with Prefect the loop is a flow that a worker starts on the infrastructure its work pool names, and the request only asks for that flow to start. The two are drawn in Fig 2.

WITHOUT PREFECT                        WITH PREFECT (self-hosted)

[ HTTP request ]                       [ HTTP request ]  [ Schedule ]  [ Event ]
       |                                      |               |            |
       v                                      +-------+-------+------------+
[ Web process ]                                       |
       |                                              v
       +--> agent loop, in-process              [ Prefect Server ]
       +--> RetryPolicy on a node                 API, UI, scheduler,
       +--> checkpointer -> DB                    events and automations
       |                                                |
       v                                                v   run queued in a work pool
[ Response ]                                      [ Worker polls the pool ]
                                                        |
written by hand beside the web process:                 v
   cron or a queue, for schedules             [ Flow: the agent loop ]
   a semaphore, for the call rate                       |
   a log table, for the run history                     +--> Task per tool call
   a guard, so a rerun skips done work                  |      retries, cache, rate limit
                                                        +--> pause or suspend for input
                                                        +--> checkpointer -> DB
                                                        |
                                                        v
                                               [ Response, and a run record ]

Fig 2. The same backend without Prefect and with a self-hosted Prefect Server

An agent framework covers the four inner responsibilities of Fig 1 and leaves the orchestrator's three to the backend engineer. A checkpointer saves a snapshot of the graph state at every super-step under a thread id, which is what lets a stopped run resume and what lets a human interrupt, inspect and approve a step, and a retry policy attached to a node retries it with exponential backoff [2]. The backend engineer then writes and maintains a scheduler, a semaphore and a log table.

Prefect fills the same three with a server and a worker, and the agent loop becomes a flow whose tool calls are tasks. A deployment states where, when and how the flow runs, which turns the loop into an entity the API manages, triggered by a schedule, the UI, an automation or the REST API, while a work pool names the infrastructure and a worker polls the pool and starts the run on it [3]. The self-hosted server carries the API, the UI, scheduling, work pools, and the events and automations engine [4]. The official integration between Prefect and Pydantic AI wraps the tools as tasks, so the backend engineer does not write that Python code: tools become tasks automatically, each with its own retries, its own cached result and its own line in the run history [5]. This is where #6 State and #7 Recovery of Table 1 come onto Prefect alongside the orchestrator rows.

5. Benchmarking

A benchmarking sheet compares two things. Table 2 holds the criteria products are compared on, with Prefect's answer to each, and Table 3 holds the difference between a backend with Prefect and the same backend without it.

5.1 Criteria

The nine rows of Table 2 are the criteria a benchmarking sheet compares products on, and the Prefect column holds Prefect's answer to each.

Table 2. The benchmarking criteria, with Prefect's answer to each

# Criterion Criterion details Prefect
1 Orchestrator scope Which of admission, throughput and record the product carries Admission, throughput and record
2 Suspension What a run waiting for a person holds open Nothing, the process exits
3 Idempotent rerun What a rerun does with work already done The previous result, loaded
4 Rate limiting How the call rate is bounded Declared, in any Python code
5 Per-step observability How far down a failure is located The one tool call
6 One admission path How many Python code paths the triggers need One deployment
7 ML pipeline integration Whether the same product also runs the retraining and deployment pipelines It does
8 Access control What guards the API and the UI Nothing in the open source server
9 Inbound events How an outside system starts a run A Cloud webhook, or a relay

A row the product does not answer is filled by the backend engineer in Python code.

5.2 Comparison

Ten functions are needed in either composition, and Table 3 sets out what holds each one on each side. The Without Prefect column is the composition that uses only an agent framework, and the With Prefect column is that same framework with Prefect added on top of it. An agent framework is the Python library a backend engineer writes the LLM call and tool selection loop into, and this document uses LangGraph as that framework [2].

Table 3. The same function in each composition

# Function Without Prefect With Prefect
1 Step retry A retry policy on a node, inside one graph run retries and retry_delay_seconds on every task
2 Resume after a crash The checkpointer replays the thread from its last super-step The framework's checkpointer, and the run state the Prefect server holds
3 Human approval An interrupt, and a resume call the backend engineer routes pause_flow_run with wait_for_input, answered by API
4 Where a run executes The web process that answered A work pool, with a worker polling it
5 Suspension The web process holds the thread and waits for the person suspend_flow_run exits, and the run starts again when the input arrives
6 Idempotent rerun The backend engineer writes the skip condition into the node Result caching loads the previous result instead of running again
7 Rate limiting The backend engineer writes a semaphore to bound the calls A global concurrency limit and a rate limit
8 Per-step observability The backend engineer builds a log table and writes each step to it Every flow run and task run, in the server's UI
9 One admission path The backend engineer connects each trigger to the run by hand One deployment, on a request, a schedule or an automation
10 ML pipeline integration The backend engineer runs retraining and deployment on a separate scheduler Retraining, deployment and the agent run as flows on one server, each able to start the next

Nine of the ten rows are met by the Prefect API calls and settings named in the With Prefect column alone, and #2 uses the agent framework's checkpointer alongside them. The framework keeps a part in all ten rows: what Prefect wraps is that framework's loop and its tool code, and the framework side is what decides where a run pauses, which results may be cached, and what counts as one step.

6. Strength

In rows #5 to #10 of Table 3 the agent framework does not do the work itself. The backend engineer fills those rows with Python code written by hand, or leaves them undone. Those six rows are what separates one product from another on a benchmarking sheet, and the six are listed below under the same names, each with what Prefect does in its place.

  • Suspension: pause_flow_run keeps the flow alive while it waits, and suspend_flow_run exits so the infrastructure can be taken down, with the run started again when the input arrives [6]. A HITL step that waits a day occupies no process at all.
  • Idempotent rerun: Prefect's transactional orchestration loads the previous result instead of running again when the context is identical [5]. Under that idempotency a retried agent run does not pay the LLM twice for the same tool call.
  • Rate limiting: a global concurrency limit bounds how many calls are in flight, and a rate limit paces them by a slot decay per second [7]. Both work in Python code outside a flow, so a tool never wrapped as a task stays bounded too.
  • Per-step observability: each tool call is a task, so each one appears in the run history and is retried on its own [5]. The failure report carries which tool call failed on which input, not only that an agent run failed.
  • One admission path: one deployment answers an interactive request, a nightly schedule and an event-driven automation [3]. The overnight batch and the chat request run the same Python code rather than two copies.
  • ML pipeline integration: retraining, deployment and the agent run as flows on one server, and the state of a finished flow starts the next [8]. Retraining and the agent need not sit in two systems with a bridge written between them.

7. Application

Prefect is favourable for a backend whose agent run continues after the HTTP response has gone out, and unfavourable for one whose run ends with that response. The HTTP response here is the backend's reply to one frontend request: sending it closes that request's connection, and the web process that took the request moves on to the next one. The three conditions below decide which case a design is in.

  1. Assumption: the backend may own a process of its own. A worker is a client-side process that polls a work pool and starts runs on infrastructure [3], so a deployment target that forbids a long-lived process cannot host the worker and the composition of Fig 2 does not hold.
  2. Breaking condition: authentication. The open source server carries no users and no authentication, so anyone who reaches the UI or the API has full access to the server [4]; a self-hosted server therefore sits inside a private network or behind an authenticating proxy. Webhooks are a Prefect Cloud feature [4], so a self-hosted backend that must start runs from an outside system must write the endpoint that relays those events to the API.
  3. Exclusion: an agent whose run is one LLM call and whose result nobody looks up later. The server and the worker are two components to operate, and a run that ends with the HTTP response leaves them no state to hold.

References

[1] GitHub. What is Workflow Orchestration?.
[2] LangChain. Checkpointers. LangGraph documentation.
[3] Prefect. Deployments. Prefect 3 documentation.
[4] Prefect. Cloud vs OSS feature comparison.
[5] Pydantic. Durable execution with Prefect. Pydantic AI documentation.
[6] Prefect. How to write interactive workflows. Prefect 3 documentation.
[7] Prefect. How to apply global concurrency and rate limits. Prefect 3 documentation.
[8] Prefect. Define event triggers. Prefect 3 documentation.
[9] LangChain. The best AI agent frameworks in 2026.
[10] Prefect. The only orchestrator built for AI agents.


Appendix A. Terminology

  • Agent framework: the Python library a backend engineer writes the LLM call and tool selection loop into, such as LangGraph.
  • Automation: the Prefect rule that starts a preset action when a matching event arrives.
  • Checkpointer: the component that saves graph state at each step so that a stopped run resumes from it.
  • Deployment: a flow with where, when and how it runs attached, which makes it an entity the API manages.
  • FDC (Fault Detection and Classification): the fab system that watches equipment sensor traces and raises an alarm when one leaves its limits.
  • Flow: the function Prefect treats as one run.
  • HITL (Human In The Loop): a run that waits for a person's input before it continues.
  • Idempotency: the property that running again with the same input leaves the same result and the same side effects as running once.
  • Jinja: the template syntax Prefect substitutes event values into a flow's parameters with.
  • K8s (Kubernetes): the container platform a work pool can run flow runs on.
  • Orchestrator: the part of a backend that carries every run rather than one: what starts a run, how many calls run at once, and what the run history keeps.
  • Prefect Server: the self-hosted orchestration backend holding the API, the UI, the scheduler, and events and automations.
  • RAG (Retrieval Augmented Generation): answering with documents retrieved at query time and handed to the LLM beside the question.
  • Rate limit: the ceiling on how many calls may leave within a span of time.
  • Result caching: loading a previous result for an identical input instead of executing again.
  • Super-step: the execution unit a graph saves one state snapshot for.
  • Task: the unit inside a flow that Prefect retries, caches and records on its own.
  • Thread: the unit a checkpointer collects one conversation's state under.
  • VM (Virtual Metrology): predicting a measurement from process sensor data instead of measuring it.
  • Work pool: the Prefect setting that names the infrastructure flow runs execute on.
  • Worker: the client-side process that polls a work pool and starts each scheduled run on that infrastructure.

Appendix B. What Prefect Does In An Agent Backend

Each item below is something Prefect does inside an agent backend, and the parenthesis at the end names the Table 3 function the item belongs to.

  1. Durable execution: it caches LLM and tool calls per task, and resumes from that point on a failure (#2 Resume after a crash, #6 Idempotent rerun).
  2. Retry and timeout: it applies a retry policy and a timeout per call, against an LLM API outage or a tool error (#1 Step retry).
  3. Event trigger: it runs an agent automatically when an event such as an FDC alarm or a drift detection arrives (#9 One admission path).
  4. Scheduling: it runs the regular analysis and report agents on a schedule (#9 One admission path).
  5. Distributed execution: it distributes runs to K8s nodes or GPU workers (#4 Where a run executes).
  6. Observability: it tracks run history, logs and state in the UI (#8 Per-step observability).
  7. Human-in-the-loop waiting: with pause_flow_run it stops until the approval arrives, then resumes (#3 Human approval, #5 Suspension).
  8. ML pipeline integration: it operates retraining, deployment and agent execution together (#10 ML pipeline integration).
  9. Rate limiting: it bounds the calls in flight and the calls per second by declaration, against an LLM API rate limit (#7 Rate limiting).

What it does not do itself: the LLM inference logic, memory and RAG, and real-time conversation serving are carried by the agent framework and the API server.

Appendix C. How An Event Trigger Is Done In Prefect

The trigger is set up in two steps. emit_event publishes the event, and a DeploymentEventTrigger or an automation receives it and runs the flow [8].

1. Emit the event β€” on the FDC system or the collector side.

from prefect.events import emit_event

emit_event(
    event="fdc.alarm.raised",
    resource={"prefect.resource.id": "tool.ETCH01.TG1"},
    payload={"wafer_id": "W123", "sensor": "RF_power", "severity": "high"},
)

2. Run the agent flow from a trigger

from prefect import flow
from prefect.events import DeploymentEventTrigger


@flow
def fdc_agent(tool_id: str, wafer_id: str, sensor: str):
    ...  # agent analysis, then the report and the notification


if __name__ == "__main__":
    fdc_agent.serve(
        name="fdc-agent",
        triggers=[
            DeploymentEventTrigger(
                expect={"fdc.alarm.raised"},
                match={"prefect.resource.id": "tool.*"},
                parameters={  # Jinja injects the event values into the flow parameters
                    "tool_id": "{{ event.resource.id }}",
                    "wafer_id": "{{ event.payload.wafer_id }}",
                    "sensor": "{{ event.payload.sensor }}",
                },
            )
        ],
    )

Table 4. Trigger types

# Type Use Setting
1 Reactive Runs as soon as the event occurs The default
2 Threshold Runs once N have accumulated, such as three alarms within ten minutes threshold=3, within=timedelta(minutes=10)
3 Proactive Runs when the event does not arrive, such as collection having stopped posture="Proactive"
4 Compound / Sequence Runs on a combination or an order of several events CompoundTrigger, SequenceTrigger
5 Flow state Runs in sequence after another flow completes or fails expect={"prefect.flow-run.Completed"} and the like

External systems

  • Prefect Cloud: a webhook takes an outside HTTP request as an event directly.
  • Self-hosted (OSS): with no webhook, a FastAPI endpoint or a Kafka or MQ consumer calls emit_event to turn the request into an event.

Fab application

  • An FDC alarm, reactively, to the cause analysis agent
  • Three VM error excursions within ten minutes, on threshold, to the retraining flow
  • Sensor data unreceived for thirty minutes, proactively, to the equipment check notice
  • Retraining completed, on flow state, to the validation agent and the report

Appendix D. Agent Frameworks In Use As Of September 2026

The framework this document compares against is #1 LangGraph, and chapter 2 says why it was chosen. Each date is the product's public announcement [9].

Table 5. Agent frameworks and when each was first announced

# Framework Framework details Announced
1 LangGraph Holds state as a graph. The default where an audit trail and human approval are needed 2024-01
2 CrewAI Binds several role-playing agents into a team. Fastest to a prototype 2024-01
3 OpenAI Agents SDK The model drives the loop. The least extra work if the work is GPT-centred 2025-03
4 Google ADK Strong on multimodal. Announced at Google Cloud NEXT 2025 2025-04
5 Claude Agent SDK The agent harness behind Claude Code, renamed from the Claude Code SDK 2025-09
6 Microsoft Agent Framework Graph based. The choice in an Azure and .NET environment 2026-04
7 Pydantic AI Type-safe Python. V2 carries durable execution 2026-06

#7 Pydantic AI and Prefect are two products used separately, and a package that joins them is published [5]. Installing that package runs an agent written with Pydantic AI as a Prefect flow and makes that agent's tools Prefect tasks, so the wrapping Python code does not have to be written by hand. Neither product has absorbed the other, and neither uses the other inside itself.

Of the seven, #7 Pydantic AI is the only one with a package dedicated to that join; for the others the backend engineer writes the wrapping. Prefect treats a flow as a Python function, so it runs Pydantic AI, LangGraph and any other Python agent framework [10].

Prefect In An AI Agent Backend

Version 58 | Created: 2026-09-27 | Updated: 2026-11-07 13:46 UTC

1. Purpose

  • Problem Statement: AI Agent 와 AI Orchestrator λ₯Ό κ΅¬μΆ•ν•˜λŠ” 데 Prefect workflow λ₯Ό ν™œμš©ν•˜λŠ” λ°©μ•ˆκ³Ό, κ·Έκ²ƒμœΌλ‘œ 강점을 λ§Œλ“€μ–΄ λ‚΄λŠ” λ°©μ•ˆμ΄ μ—†λ‹€.
  • Goal: AI Orchestrator 와 AI agent 의 frontend 와 backend 역할을 κ°€λ₯΄κ³ , Prefect κ°€ backend 의 역할에 λŒ€ν•΄ νŠΉλ³„νžˆ 무엇을 μ–΄λ–»κ²Œ ν•  수 μžˆλŠ”μ§€λ₯Ό 적어, manager λ˜λŠ” designer κ°€ μ°Έκ³ ν•˜λŠ” benchmarking 자료λ₯Ό λ§Œλ“ λ‹€.
  • Non-Goal: Agent 의 prompt 와 tool 을 μ„€κ³„ν•˜λŠ” 방법은 닀루지 μ•Šκ³ , κ΅¬ν˜„ Python code 도 μ£Όμ§€ μ•ŠμœΌλ©°, Prefect λ°–μ˜ orchestrator (Airflow, Temporal, Dagster λ“±) κ³Ό λΉ„κ΅ν•˜μ§€ μ•ŠλŠ”λ‹€.

2. Summary

AI agent backend μ—λŠ” 무엇이 싀행을 μ‹œμž‘ν•˜λŠ”κ°€, ν˜ΈμΆœμ„ ν•œ λ²ˆμ— λͺ‡ κ°œκΉŒμ§€ λŒλ¦¬λŠ”κ°€, 무엇이 λŒμ•˜λŠ”κ°€λ₯Ό μ •ν•˜λŠ” μ„Έ μ±…μž„μ΄ μžˆλ‹€. 이 셋을 λ¬Άμ–΄ orchestrator 라 λΆ€λ₯΄λ©° [1], Prefect κ°€ 이 셋을 λ§‘λŠ” μ œν’ˆμ΄λ‹€. Tool ν˜ΈμΆœμ„ task 둜 감싸면 멈좘 싀행이 λ‹€μ‹œ μ‹œμž‘ν•˜λŠ” μžλ¦¬μ™€ μ‹€νŒ¨ν•œ λ‹¨κ³„μ˜ μž¬μ‹œλ„κΉŒμ§€ Prefect κ°€ ν•¨κ»˜ μ§€μ§€λ§Œ, LLM 을 뢈러 λ‹€μŒ λ™μž‘μ„ κ³ λ₯΄λŠ” 일과 tool μ•ˆμ˜ Python code λŠ” agent framework 에 λ‚¨λŠ”λ‹€. Orchestrator κ°€ backend μ•ˆμ˜ 어디에 λ†“μ΄λŠ”μ§€λŠ” Fig 1 에 κ·Έλ Έλ‹€. Agent framework λŠ” ν•œ μ‹€ν–‰ μ•ˆμ˜ 일만 ν•˜λ―€λ‘œ, Prefect κ°€ μ—†μœΌλ©΄ 이 셋을 backend μ—”μ§€λ‹ˆμ–΄κ°€ Python code 둜 직접 κ΅¬ν˜„ν•œλ‹€. Table 3 의 μ—΄ κΈ°λŠ₯ κ°€μš΄λ° μ—¬μ„― β€” suspension, idempotent rerun, μ„ μ–ΈμœΌλ‘œ λ‘λŠ” rate limiting, per-step observability, one admission path, ML pipeline integration β€” 에 orchestrator scope 와 access control κ³Ό inbound events λ₯Ό λ”ν•œ 아홉이 benchmarking μžλ£Œκ°€ μ œν’ˆμ„ κ²¬μ£ΌλŠ” ν•­λͺ©μ΄λ‹€.

Prefect λ₯Ό 써도 frontend 의 μ„Έ 역할은 κ·ΈλŒ€λ‘œμ΄κ³ , ν•  일이 ν•˜λ‚˜ 더 λΆ™λŠ”λ‹€. 멈좘 싀행이 κΈ°λ‹€λ¦¬λŠ” 닡을 frontend κ°€ λ°›μ•„ backend 둜 λ„˜κΈ΄λ‹€. 비ꡐ λŒ€μƒμœΌλ‘œ 삼은 agent framework λŠ” LangGraph λ‹€. Table 3 의 Without Prefect 열이 근거둜 μ‚ΌλŠ” checkpointer 와 node 에 뢙인 retry policy λ₯Ό vendor λ¬Έμ„œμ—μ„œ 확인할 수 μžˆμ–΄ 골랐으며 [2], μ§€κΈˆ μ“°μ΄λŠ” λ‹€λ₯Έ framework λŠ” Appendix D 에 μ μ—ˆλ‹€. Appendix B κ°€ Prefect κ°€ agent backend μ—μ„œ ν•˜λŠ” 아홉 가지와, agent framework 와 API server 에 λ‚¨κΈ°λŠ” 셋을 적고, Appendix C κ°€ κ·Έ κ°€μš΄λ° event trigger λ₯Ό μ–΄λ–»κ²Œ λΆ™μ΄λŠ”μ§€ 보인닀.

3. Taxonomy and its Hierarchy

Frontend λŠ” μ‚¬μš©μžμ˜ μš”μ²­μ„ backend κ°€ λ°›λŠ” ν˜•νƒœλ‘œ λ§Œλ“œλŠ” λ°κΉŒμ§€ ν•˜κ³ , 첫 LLM ν˜ΈμΆœλΆ€ν„°λŠ” backend κ°€ ν•œλ‹€. κ·Έλž˜μ„œ μΆ”λ‘  loop λŠ” backend κ°€ λŒλ¦°λ‹€. μ—΄ κ°€μ§€ 역할이 두 측에 갈렀 frontend 에 μ…‹, backend 에 일곱이 놓이며, κ·Έ 일곱 κ°€μš΄λ° admission κ³Ό throughput κ³Ό record κ°€ orchestrator λ‹€. 일곱은 각 μ±…μž„μ΄ λ§‘λŠ” λ²”μœ„ β€” ν•œ 단계, ν•œ μ‹€ν–‰, λͺ¨λ“  μ‹€ν–‰ β€” 의 μˆœμ„œλ‘œ λŠ˜μ–΄μ„ λ‹€.

λˆ„κ°€ μ–΄λŠ μ±…μž„μ„ μ§€λŠ”μ§€λŠ” λ²”μœ„κ°€ μ •ν•œλ‹€. Framework λŠ” ν•œ graph μ‹€ν–‰ μ•ˆμ—μ„œλ§Œ λŒλ―€λ‘œ ν•œ 단계 λ²”μœ„μ™€ ν•œ μ‹€ν–‰ λ²”μœ„μ˜ μ±…μž„μ„ μ§„λ‹€. Orchestrator λŠ” λͺ¨λ“  μ‹€ν–‰ λ²”μœ„μ˜ μ„Έ μ±…μž„, κ³§ admission κ³Ό throughput κ³Ό record λ₯Ό μ§€λŠ” μͺ½μ΄λ‹€. μ—΄ μ—­ν• κ³Ό 각각의 μΈ΅, 그리고 각 역할이 μ •ν•˜λŠ” 것은 Fig 1 에 κ·Έλ Έλ‹€.

LAYER          ROLE              WHAT THE ROLE DECIDES                        SCOPE       PART

Frontend  >    Intent            What the user asked, in the backend's form   one request
               Approval          The answer a paused run is waiting for       one run
               Presentation      What the user sees of the result             one request
      |   one request crosses the boundary
      v
Backend   >    Reasoning         Which action the LLM picks next              one step    --+
               Tool execution    The action actually carried out              one step      |
               State             The point a stopped run resumes from         one run       |  Agent
               Recovery          Which failed step is retried, and how often  one run     --+
               Admission         What starts a run: request, schedule, event  every run   --+
               Throughput        How many calls run at once, and how fast     every run     |  Orchestrator
               Record            What ran, when, and with which result        every run   --+

Fig 1. The three frontend roles and the seven backend responsibilities ordered by scope, four of them the agent and three the orchestrator

λ²”μœ„κ°€ ν•œ 단계 λ„“μ–΄μ§€λ©΄, μ•ž λ²”μœ„κ°€ λλ‚œ 뒀에도 남아야 ν•˜λŠ” μƒνƒœλ₯Ό λ‘˜ μžλ¦¬κ°€ ν•˜λ‚˜ 더 μžˆμ–΄μ•Ό ν•œλ‹€. ν•œ 단계 λ²”μœ„λŠ” process μ•ˆμ—μ„œ λλ‚˜κ³ , ν•œ μ‹€ν–‰ λ²”μœ„λŠ” process κ°€ 죽어도 λ‚΄μš©μ΄ λ‚¨λŠ” μ €μž₯μ†Œλ₯Ό μ“°λ©°, λͺ¨λ“  μ‹€ν–‰ λ²”μœ„λŠ” process κ°€ λͺ¨λ‘ λλ‚œ 뒀에도 λŒλ©΄μ„œ μ–΄λ–€ 싀행이 μžˆμ—ˆλŠ”μ§€ μ•Œλ € μ£ΌλŠ” service λ₯Ό μ“΄λ‹€.

3.1 Comparison

Table 1. Each role, the part that holds it, and what settles it

# Role Part Scope Settled by
1 Intent Frontend One request Backend κ°€ λ°›μ•„λ“€μ΄λŠ” μš”μ²­ schema
2 Approval Frontend One run 멈좘 싀행이 κΈ°λ‹€λ¦¬λŠ” 닡을 λ°›λŠ” input form
3 Presentation Frontend One request μ‚¬μš©μžκ°€ μ½λŠ” stream λ˜λŠ” page
4 Reasoning Agent One step LLM 호좜과 κ·Έ 호좜이 λŒλ €μ£ΌλŠ” tool 선택
5 Tool execution Agent One step κ³ λ₯Έ tool 이 κ°€λ¦¬ν‚€λŠ” Python ν•¨μˆ˜
6 State Agent One run λ‹€μ‹œ μ‹œμž‘ν•œ 싀행이 μ½λŠ” checkpoint
7 Recovery Agent One run μž¬μ‹œλ„ 횟수, 그리고 μž¬μ‹€ν–‰μ΄ κ±΄λ„ˆλ›°λŠ” 이미 λλ‚œ 단계
8 Admission Orchestrator Every run Deployment 와 κ·Έ deployment λ₯Ό μΌœλŠ” μš”μ²­Β·scheduleΒ·event
9 Throughput Orchestrator Every run λ™μ‹œ μ‹€ν–‰ μƒν•œκ³Ό 호좜 속도
10 Record Orchestrator Every run λ‹¨κ³„λ§ˆλ‹€ μŒ“μ΄λŠ” μ‹€ν–‰ 기둝

μ–΄λŠ agent framework 도 orchestrator μ„Έ 행을 μ§€μ§€ μ•ŠμœΌλ―€λ‘œ, design 은 κ·Έ μ„Έ 행에 μ œν’ˆ 이름을 적고 λ‚˜λ¨Έμ§€ 행은 Python code 둜 μ±„μš΄λ‹€.

🌳 Prefect λŠ” orchestrator μ…‹ (#8 Admission, #9 Throughput, #10 Record) 전뢀와, agent λ„· κ°€μš΄λ° #6 State 와 #7 Recovery 의 μž¬μ‹œλ„μ™€ result caching 을 tool 을 task 둜 κ°μŒ€ λ•Œ ν•¨κ»˜ μ§„λ‹€. #4 Reasoning κ³Ό #5 Tool execution 은 ν•˜μ§€ λͺ»ν•œλ‹€. LLM 을 뢈러 λ‹€μŒ λ™μž‘μ„ κ³ λ₯΄λŠ” 일과 tool μ•ˆμ˜ Python code κ°€ agent framework 에 λ‚¨λŠ” κΉŒλ‹­μ΄λ‹€.

4. Backend Composition

두 ꡬ성은 같은 μΆ”λ‘  loop λ₯Ό 돌리며, κ·Έ loop κ°€ μ–΄λŠ process μ—μ„œ λ„λŠ”μ§€κ°€ κ°ˆλ¦°λ‹€. Prefect κ°€ μ—†μœΌλ©΄ loop λŠ” μš”μ²­μ— λ‹΅ν•œ process μ•ˆμ—μ„œ 돌고, Prefect κ°€ 있으면 loop λŠ” worker κ°€ work pool 이 κ°€λ¦¬ν‚€λŠ” infrastructure μœ„μ—μ„œ μ‹œμž‘ν•˜λŠ” flow 이며 μš”μ²­μ€ κ·Έ flow λ₯Ό μ‹œμž‘ν•΄ 달라고 μš”κ΅¬ν•  뿐이닀. λ‘˜μ€ Fig 2 에 κ·Έλ Έλ‹€.

WITHOUT PREFECT                        WITH PREFECT (self-hosted)

[ HTTP request ]                       [ HTTP request ]  [ Schedule ]  [ Event ]
       |                                      |               |            |
       v                                      +-------+-------+------------+
[ Web process ]                                       |
       |                                              v
       +--> agent loop, in-process              [ Prefect Server ]
       +--> RetryPolicy on a node                 API, UI, scheduler,
       +--> checkpointer -> DB                    events and automations
       |                                                |
       v                                                v   run queued in a work pool
[ Response ]                                      [ Worker polls the pool ]
                                                        |
written by hand beside the web process:                 v
   cron or a queue, for schedules             [ Flow: the agent loop ]
   a semaphore, for the call rate                       |
   a log table, for the run history                     +--> Task per tool call
   a guard, so a rerun skips done work                  |      retries, cache, rate limit
                                                        +--> pause or suspend for input
                                                        +--> checkpointer -> DB
                                                        |
                                                        v
                                               [ Response, and a run record ]

Fig 2. The same backend without Prefect and with a self-hosted Prefect Server

Agent framework λŠ” Fig 1 의 μ•ˆμͺ½ λ„€ μ±…μž„μ„ μ§€κ³  orchestrator 의 셋을 backend μ—”μ§€λ‹ˆμ–΄μ—κ²Œ 남긴닀. Checkpointer λŠ” graph μƒνƒœμ˜ snapshot 을 super-step λ§ˆλ‹€ thread id μ•„λž˜ μ €μž₯ν•˜μ—¬ 멈좘 싀행을 λ‹€μ‹œ μ‹œμž‘ν•˜κ²Œ ν•˜κ³  μ‚¬λžŒμ΄ ν•œ 단계λ₯Ό λŠμ–΄ 듀여닀보고 μŠΉμΈν•˜κ²Œ ν•˜λ©°, node 에 뢙인 retry policy λŠ” κ·Έ node λ₯Ό μ§€μˆ˜ backoff 둜 λ‹€μ‹œ μ‹œλ„ν•œλ‹€ [2]. 그러면 scheduler 와 semaphore 와 기둝용 ν‘œλ₯Ό backend μ—”μ§€λ‹ˆμ–΄κ°€ 직접 λ§Œλ“€κ³  μš΄μ˜ν•œλ‹€.

Prefect λŠ” 같은 셋을 server 와 worker 둜 μ±„μš°κ³ , agent loop λŠ” tool 호좜이 task 인 flow κ°€ λœλ‹€. Deployment λŠ” flow λ₯Ό μ–΄λ””μ„œΒ·μ–Έμ œΒ·μ–΄λ–»κ²Œ λŒλ¦΄μ§€ 적어 loop λ₯Ό API κ°€ κ΄€λ¦¬ν•˜λŠ” λŒ€μƒμœΌλ‘œ λ°”κΎΈκ³ , schedule κ³Ό UI 와 automation κ³Ό REST API κ°€ κ·Έ deployment λ₯Ό μΌ λ‹€. Work pool 이 infrastructure λ₯Ό 가리킀고 worker κ°€ κ·Έ pool 을 μ‚΄νŽ΄ 싀행을 κ·Έ μœ„μ—μ„œ μ‹œμž‘ν•œλ‹€ [3]. Self-hosted server λŠ” API, UI, scheduling, work pool, 그리고 event 와 automation engine 을 λ‹΄λŠ”λ‹€ [4]. Prefect 와 Pydantic AI μ‚¬μ΄μ˜ 곡식 톡합이 tool 을 task 둜 κ°μ‹ΈλŠ” 일을 λŒ€μ‹  ν•΄ μ£Όλ―€λ‘œ, backend μ—”μ§€λ‹ˆμ–΄κ°€ κ·Έ Python code λ₯Ό μ“°μ§€ μ•ŠλŠ”λ‹€. Tool 이 μžλ™μœΌλ‘œ task κ°€ λ˜μ–΄, ν˜ΈμΆœλ§ˆλ‹€ μž¬μ‹œλ„ μ„€μ •κ³Ό cache 된 결과와 μ‹€ν–‰ 기둝 ν•œ 쀄을 λ”°λ‘œ κ°–λŠ”λ‹€ [5]. Table 1 의 #6 State 와 #7 Recovery κ°€ Prefect μͺ½μœΌλ‘œ ν•¨κ»˜ μ˜€λŠ” μžλ¦¬κ°€ μ—¬κΈ°λ‹€.

5. Benchmarking

Benchmarking μžλ£ŒλŠ” 두 κ°€μ§€λ₯Ό 견쀀닀. μ œν’ˆμ„ κ²¬μ£ΌλŠ” ν•­λͺ©κ³Ό Prefect 의 닡은 Table 2 에 있고, Prefect λ₯Ό 얹은 ꡬ성과 μ–Ήμ§€ μ•Šμ€ κ΅¬μ„±μ˜ μ°¨μ΄λŠ” Table 3 에 μžˆλ‹€.

5.1 Criteria

Table 2 의 아홉 행이 benchmarking μžλ£Œκ°€ μ œν’ˆμ„ κ²¬μ£ΌλŠ” ν•­λͺ©μ΄κ³ , Prefect 열에 Prefect 의 닡이 μ ν˜€ μžˆλ‹€.

Table 2. The benchmarking criteria, with Prefect's answer to each

# Criterion Criterion details Prefect
1 Orchestrator scope AdmissionΒ·throughputΒ·record κ°€μš΄λ° μ œν’ˆμ΄ μ–΄λŠ 것을 μ§€λŠ”κ°€ AdmissionΒ·throughputΒ·record λͺ¨λ‘
2 Suspension μ‚¬λžŒμ„ κΈ°λ‹€λ¦¬λŠ” 싀행이 무엇을 λΆ™λ“€κ³  μžˆλŠ”κ°€ μ—†μŒ. Process κ°€ λΉ μ Έλ‚˜κ°
3 Idempotent rerun μž¬μ‹€ν–‰μ΄ 이미 λλ‚œ 일을 μ–΄λ–»κ²Œ ν•˜λŠ”κ°€ μ•žμ„  κ²°κ³Όλ₯Ό 뢈러옴
4 Rate limiting 호좜 속도λ₯Ό λ¬΄μ—‡μœΌλ‘œ λ¬ΆλŠ”κ°€ Python code μ–΄λ””μ—μ„œλ‚˜ μ„ μ–ΈμœΌλ‘œ
5 Per-step observability μ‹€νŒ¨ν•œ 자리λ₯Ό μ–΄λ””κΉŒμ§€ μ’ν˜€ μ£ΌλŠ”κ°€ Tool 호좜 ν•˜λ‚˜
6 One admission path Trigger λ§ˆλ‹€ Python code κ²½λ‘œκ°€ λͺ‡ 개 ν•„μš”ν•œκ°€ Deployment ν•˜λ‚˜
7 ML pipeline integration 같은 μ œν’ˆμ΄ μž¬ν•™μŠ΅Β·λ°°ν¬ pipeline 도 ν•¨κ»˜ λŒλ¦¬λŠ”κ°€ 돌림
8 Access control API 와 UI λ₯Ό 무엇이 μ§€ν‚€λŠ”κ°€ Open source server μ—λŠ” μ—†μŒ
9 Inbound events μ™ΈλΆ€ system 이 싀행을 μ–΄λ–»κ²Œ μ‹œμž‘ν•˜λŠ”κ°€ Cloud webhook, λ˜λŠ” relay

μ œν’ˆμ΄ λ‹΅ν•˜μ§€ λͺ»ν•œ 행은 backend μ—”μ§€λ‹ˆμ–΄κ°€ Python code 둜 μ±„μš΄λ‹€.

5.2 Comparison

μ—΄ κΈ°λŠ₯은 두 ꡬ성 λͺ¨λ‘μ— ν•„μš”ν•˜λ©°, Table 3 이 각 κΈ°λŠ₯을 무엇이 μ§€λŠ”μ§€ μ–‘μͺ½μ— λ‚˜λž€νžˆ μ λŠ”λ‹€. Without Prefect 열은 agent framework ν•˜λ‚˜λ§Œ μ“΄ ꡬ성이고, With Prefect 열은 같은 framework μœ„μ— Prefect λ₯Ό λ”ν•œ ꡬ성이닀. Agent framework λŠ” LLM 호좜과 tool 선택 loop λ₯Ό backend μ—”μ§€λ‹ˆμ–΄κ°€ Python code 둜 써 λ„£λŠ” library 이며, 이 λ¬Έμ„œλŠ” LangGraph λ₯Ό κ·Έ 예둜 λ“ λ‹€ [2].

Table 3. The same function in each composition

# Function Without Prefect With Prefect
1 Step retry ν•œ graph μ‹€ν–‰ μ•ˆ, node 에 뢙인 retry policy Task λ§ˆλ‹€ λΆ™λŠ” retries 와 retry_delay_seconds
2 Resume after a crash Checkpointer κ°€ λ§ˆμ§€λ§‰ super-step λΆ€ν„° thread λ₯Ό λ‹€μ‹œ 돌림 Framework 의 checkpointer, 그리고 Prefect server κ°€ λ³΄κ΄€ν•˜λŠ” μ‹€ν–‰ μƒνƒœ
3 Human approval Interrupt, 그리고 backend μ—”μ§€λ‹ˆμ–΄κ°€ 직접 μ—°κ²°ν•˜λŠ” resume 호좜 wait_for_input 을 λ°›λŠ” pause_flow_run, API 둜 닡함
4 Where a run executes μš”μ²­μ— λ‹΅ν•œ web process Work pool, 그리고 κ·Έ pool 을 μ‚΄ν”ΌλŠ” worker
5 Suspension Web process κ°€ thread λ₯Ό λΆ™λ“€κ³  μ‚¬λžŒμ˜ μž…λ ₯을 κΈ°λ‹€λ¦Ό suspend_flow_run 이 λΉ μ Έλ‚˜κ°€κ³ , μž…λ ₯이 λ‹ΏμœΌλ©΄ 싀행이 λ‹€μ‹œ μ‹œμž‘λ¨
6 Idempotent rerun Backend μ—”μ§€λ‹ˆμ–΄κ°€ κ±΄λ„ˆλ›Έ 쑰건을 node μ•ˆμ— Python code 둜 직접 적음 Result caching 이 μ•žμ„  κ²°κ³Όλ₯Ό 뢈러 λ‹€μ‹œ λŒμ§€ μ•ŠμŒ
7 Rate limiting Backend μ—”μ§€λ‹ˆμ–΄κ°€ semaphore λ₯Ό 직접 λ§Œλ“€μ–΄ 호좜 수λ₯Ό 묢음 Global concurrency limit κ³Ό rate limit
8 Per-step observability Backend μ—”μ§€λ‹ˆμ–΄κ°€ 기둝용 ν‘œλ₯Ό λ§Œλ“€μ–΄ λ‹¨κ³„λ§ˆλ‹€ κ²°κ³Όλ₯Ό 직접 적음 Server 의 UI 에 λ‹΄κΈ΄ λͺ¨λ“  flow run κ³Ό task run
9 One admission path Backend μ—”μ§€λ‹ˆμ–΄κ°€ trigger λ§ˆλ‹€ 싀행을 μ‹œμž‘ν•˜λŠ” 경둜λ₯Ό 직접 연결함 μš”μ²­Β·scheduleΒ·automation 이 μΌœλŠ” deployment ν•˜λ‚˜
10 ML pipeline integration Backend μ—”μ§€λ‹ˆμ–΄κ°€ μž¬ν•™μŠ΅κ³Ό 배포λ₯Ό λ”°λ‘œ λ‘” scheduler 둜 돌림 μž¬ν•™μŠ΅Β·λ°°ν¬Β·agent κ°€ ν•œ server μœ„μ˜ flow 둜 돌고, μ„œλ‘œλ₯Ό μΌ€ 수 있음

μ—΄ ν–‰ κ°€μš΄λ° 아홉은 With Prefect 열에 적힌 Prefect 의 API 호좜과 μ„€μ •λ§ŒμœΌλ‘œ κ°–μΆ°μ§€κ³ , #2 만 agent framework 의 checkpointer λ₯Ό ν•¨κ»˜ μ“΄λ‹€. μ—΄ ν–‰ λͺ¨λ‘μ—μ„œ framework κ°€ 제 λͺ«μ„ λ§‘λŠ”λ‹€. Prefect κ°€ κ°μ‹ΈλŠ” 것이 κ·Έ framework 의 loop 와 tool code 이고, μ–΄λ””μ„œ λ©ˆμΆœμ§€, μ–΄λŠ κ²°κ³Όλ₯Ό cache 해도 λ˜λŠ”μ§€, 무엇을 ν•œ λ‹¨κ³„λ‘œ λ³Όμ§€λŠ” framework μͺ½μ΄ μ •ν•œλ‹€.

6. Strength

Table 3 의 #5 λΆ€ν„° #10 κΉŒμ§€ μ—¬μ„― ν–‰μ—μ„œ agent framework λŠ” κ·Έ κΈ°λŠ₯을 슀슀둜 κ°–μΆ”μ§€ λͺ»ν•œλ‹€. Backend μ—”μ§€λ‹ˆμ–΄κ°€ Python code λ₯Ό μ†μœΌλ‘œ μ¨μ„œ μ±„μš°κ±°λ‚˜, κ·ΈλŒ€λ‘œ λΉ„μ›Œ λ‘”λ‹€. κ·Έ μ—¬μ„― 행이 benchmarking μžλ£Œμ—μ„œ μ œν’ˆμ„ κ°€λ₯Έλ‹€. μ•„λž˜μ— κ·Έ 여섯을 같은 μ΄λ¦„μœΌλ‘œ λŠ˜μ–΄λ†“κ³ , ν–‰λ§ˆλ‹€ Prefect κ°€ 무엇을 ν•˜λŠ”μ§€ μ λŠ”λ‹€.

  • Suspension: pause_flow_run 은 κΈ°λ‹€λ¦¬λŠ” λ™μ•ˆ flow λ₯Ό μ‚΄λ € 두고, suspend_flow_run 은 λΉ μ Έλ‚˜κ°€ infrastructure λ₯Ό κΊΌ λ‘˜ 수 있게 ν•˜λ©°, μž…λ ₯이 λ‹ΏμœΌλ©΄ 싀행이 λ‹€μ‹œ μ‹œμž‘λœλ‹€ [6]. ν•˜λ£¨λ₯Ό κΈ°λ‹€λ¦¬λŠ” HITL 단계가 process λ₯Ό ν•˜λ‚˜λ„ μž‘μ•„ 두지 μ•ŠλŠ”λ‹€.
  • Idempotent rerun: Prefect 의 transactional orchestration 이 context κ°€ 같은 μž¬μ‹€ν–‰μ„ λ‹€μ‹œ λŒλ¦¬μ§€ μ•Šκ³  μ•žμ„  κ²°κ³Όλ₯Ό λΆˆλŸ¬μ˜¨λ‹€ [5]. κ·Έ idempotency μ•„λž˜μ—μ„œ λ‹€μ‹œ μ‹œλ„ν•œ agent 싀행이 같은 tool ν˜ΈμΆœμ— LLM λΉ„μš©μ„ 두 번 치λ₯΄μ§€ μ•ŠλŠ”λ‹€.
  • Rate limiting: Global concurrency limit 이 ν•œ λ²ˆμ— λ„λŠ” 호좜 수λ₯Ό λ¬Άκ³ , rate limit 이 μ΄ˆλ‹Ή slot νšŒλ³΅λŸ‰μœΌλ‘œ 호좜 간격을 λ²Œλ¦°λ‹€ [7]. λ‘˜μ€ flow λ°–μ˜ Python code μ—μ„œλ„ μ“°μ—¬, task 둜 감싸지 μ•Šμ€ tool 도 μƒν•œ μ•ˆμ— λ“ λ‹€.
  • Per-step observability: Tool 호좜 ν•˜λ‚˜κ°€ task μ΄λ―€λ‘œ ν•˜λ‚˜μ”© λ”°λ‘œ μ‹€ν–‰ 기둝에 보이고 ν•˜λ‚˜μ”© λ”°λ‘œ λ‹€μ‹œ μ‹œλ„λœλ‹€ [5]. μ‹€νŒ¨ 보고에 agent 싀행이 μ‹€νŒ¨ν–ˆλ‹€λŠ” κ²ƒλ§Œ 남지 μ•Šκ³ , μ–΄λŠ tool 호좜이 μ–΄λŠ μž…λ ₯μ—μ„œ μ‹€νŒ¨ν–ˆλŠ”μ§€κ°€ ν•¨κ»˜ λ‚¨λŠ”λ‹€.
  • One admission path: Deployment ν•˜λ‚˜κ°€ λŒ€ν™”ν˜• μš”μ²­κ³Ό μ•Όκ°„ schedule κ³Ό event 기반 automation 에 ν•¨κ»˜ λ‹΅ν•œλ‹€ [3]. μ•Όκ°„ 일괄 μ‹€ν–‰κ³Ό λŒ€ν™” μš”μ²­μ΄ 두 벌이 μ•„λ‹ˆλΌ 같은 Python code λ₯Ό λŒλ¦°λ‹€.
  • ML pipeline integration: μž¬ν•™μŠ΅Β·λ°°ν¬Β·agent κ°€ ν•œ server μœ„μ˜ flow 둜 돌고, μ•ž flow κ°€ λλ‚˜λ©΄ κ·Έ μƒνƒœκ°€ λ‹€μŒ flow λ₯Ό μΌ λ‹€ [8]. μž¬ν•™μŠ΅κ³Ό agent λ₯Ό 두 체계에 λ‚˜λˆ„μ–΄ 두고 κ·Έ λ‘˜μ„ μž‡λŠ” Python code λ₯Ό λ”°λ‘œ μ“Έ 일이 μ—†λ‹€.

7. Application

Agent 싀행이 HTTP 응닡을 내보낸 뒀에도 μ΄μ–΄μ§€λŠ” backend μ—λŠ” Prefect κ°€ μœ λ¦¬ν•˜κ³ , HTTP 응닡과 ν•¨κ»˜ 싀행이 λλ‚˜λŠ” backend μ—λŠ” λΆˆλ¦¬ν•˜λ‹€. μ—¬κΈ°μ„œ HTTP 응닡은 frontend κ°€ 보낸 μš”μ²­ ν•˜λ‚˜μ— backend κ°€ λŒλ €μ£ΌλŠ” 닡이며, κ·Έ 응닡을 보내면 μš”μ²­μ˜ connection 이 λ‹«νžˆκ³  μš”μ²­μ„ λ°›μ•˜λ˜ web process λŠ” λ‹€μŒ μš”μ²­μœΌλ‘œ λ„˜μ–΄κ°„λ‹€. μ•„λž˜ μ„Έ 쑰건이 design 이 μ–΄λŠ κ²½μš°μ— μžˆλŠ”μ§€λ₯Ό κ°€λ₯Έλ‹€.

  1. Assumption: Backend κ°€ 제 process λ₯Ό κ°€μ§ˆ 수 μžˆλ‹€λŠ” 것이닀. Worker λŠ” work pool 을 μ‚΄νŽ΄ 싀행을 infrastructure μœ„μ—μ„œ μ‹œμž‘ν•˜λŠ” client μͺ½ process μ΄λ―€λ‘œ [3], 였래 λ„λŠ” process λ₯Ό κΈˆμ§€ν•˜λŠ” 배포 λŒ€μƒμ—μ„œλŠ” worker λ₯Ό λ‘˜ 수 μ—†μ–΄ Fig 2 의 ꡬ성이 μ„±λ¦½ν•˜μ§€ μ•ŠλŠ”λ‹€.
  2. Breaking condition: 인증이닀. Open source server μ—λŠ” μ‚¬μš©μžλ„ 인증도 μ—†μ–΄ UI λ‚˜ API 에 λ‹ΏλŠ” λˆ„κ΅¬λ‚˜ κ·Έ server 에 λŒ€ν•œ 전체 κΆŒν•œμ„ κ°–λŠ”λ‹€ [4]. κ·Έλž˜μ„œ self-hosted server λŠ” 사섀망 μ•ˆμ— λ‘κ±°λ‚˜ μΈμ¦ν•˜λŠ” proxy 뒀에 λ‘”λ‹€. Webhook 은 Prefect Cloud 의 κΈ°λŠ₯μ΄λ―€λ‘œ [4], μ™ΈλΆ€ system μ—μ„œ 싀행을 μ‹œμž‘ν•΄μ•Ό ν•˜λŠ” self-hosted backend λŠ” κ·Έ event λ₯Ό Prefect API 둜 λ³΄λ‚΄λŠ” endpoint λ₯Ό 직접 λ§Œλ“ λ‹€.
  3. Exclusion: 싀행이 LLM 호좜 ν•˜λ‚˜λ‘œ λλ‚˜κ³  κ·Έ κ²°κ³Όλ₯Ό 뒀에 아무도 μ°Ύμ§€ μ•ŠλŠ” agent λ‹€. Server 와 worker λŠ” μš΄μ˜ν•  ꡬ성 μš”μ†Œ λ‘˜μ΄κ³ , HTTP 응닡과 ν•¨κ»˜ λλ‚˜λŠ” 싀행은 κ·Έ λ‘˜μ΄ 맑을 μƒνƒœλ₯Ό 남기지 μ•ŠλŠ”λ‹€.

References

[1] GitHub. What is Workflow Orchestration?.
[2] LangChain. Checkpointers. LangGraph documentation.
[3] Prefect. Deployments. Prefect 3 documentation.
[4] Prefect. Cloud vs OSS feature comparison.
[5] Pydantic. Durable execution with Prefect. Pydantic AI documentation.
[6] Prefect. How to write interactive workflows. Prefect 3 documentation.
[7] Prefect. How to apply global concurrency and rate limits. Prefect 3 documentation.
[8] Prefect. Define event triggers. Prefect 3 documentation.
[9] LangChain. The best AI agent frameworks in 2026.
[10] Prefect. The only orchestrator built for AI agents.


Appendix A. Terminology

  • Agent framework: LLM 호좜과 tool 선택 loop λ₯Ό backend μ—”μ§€λ‹ˆμ–΄κ°€ Python code 둜 써 λ„£λŠ” library. LangGraph κ°€ κ·Έ μ˜ˆλ‹€.
  • Automation: λ§žλŠ” event κ°€ λ‹ΏμœΌλ©΄ 미리 μ •ν•œ λ™μž‘μ„ μ‹œμž‘ν•˜λŠ” Prefect 의 κ·œμΉ™.
  • Checkpointer: Graph μƒνƒœλ₯Ό λ‹¨κ³„λ§ˆλ‹€ μ €μž₯ν•΄, 멈좘 싀행이 κ·Έ μžλ¦¬μ—μ„œ λ‹€μ‹œ μ‹œμž‘ν•˜κ²Œ ν•˜λŠ” ꡬ성 μš”μ†Œ.
  • Deployment: μ–΄λ””μ„œΒ·μ–Έμ œΒ·μ–΄λ–»κ²Œ λŒλ¦΄μ§€κ°€ 뢙은 flow. API κ°€ κ΄€λ¦¬ν•˜λŠ” λŒ€μƒμ΄ λœλ‹€.
  • FDC (Fault Detection and Classification): μž₯λΉ„ μ„Όμ„œ trace λ₯Ό μ§€μΌœλ³΄λ‹€κ°€ ν•œκ³„λ₯Ό λ²—μ–΄λ‚˜λ©΄ alarm 을 λ‚΄λŠ” fab μͺ½ system.
  • Flow: Prefect κ°€ ν•œ μ‹€ν–‰μœΌλ‘œ λ‹€λ£¨λŠ” ν•¨μˆ˜.
  • HITL (Human In The Loop): μ‚¬λžŒμ˜ μž…λ ₯을 κΈ°λ‹€λ¦° 뒀에 이어 κ°€λŠ” μ‹€ν–‰.
  • Idempotency: 같은 μž…λ ₯으둜 λ‹€μ‹œ λŒλ €λ„ 결과와 λΆ€μˆ˜ νš¨κ³Όκ°€ ν•œ 번 돌린 것과 같은 μ„±μ§ˆ.
  • Jinja: Prefect κ°€ event 값을 flow 의 parameter 에 λΌμ›Œ λ„£λŠ” 데 μ“°λŠ” template 문법.
  • K8s (Kubernetes): Work pool 이 flow 싀행을 올릴 수 μžˆλŠ” container platform.
  • Orchestrator: Backend κ°€μš΄λ° ν•œ 싀행이 μ•„λ‹ˆλΌ λͺ¨λ“  싀행을 λ§‘λŠ” μͺ½. 무엇이 싀행을 μ‹œμž‘ν•˜λŠ”κ°€, 호좜이 ν•œ λ²ˆμ— λͺ‡ 개 λ„λŠ”κ°€, μ‹€ν–‰ 기둝에 무엇이 λ‚¨λŠ”κ°€λ₯Ό μ§„λ‹€.
  • Prefect Server: API, UI, scheduler, 그리고 event 와 automation 을 담은 self-hosted orchestration backend.
  • RAG (Retrieval Augmented Generation): 질문 μ‹œμ μ— μ°Ύμ•„μ˜¨ λ¬Έμ„œλ₯Ό 질문과 ν•¨κ»˜ LLM 에 건넀어 λ‹΅ν•˜λŠ” 것.
  • Rate limit: μ •ν•΄μ§„ μ‹œκ°„ μ•ˆμ— λ‚˜κ°ˆ 수 μžˆλŠ” 호좜 수의 μƒν•œ.
  • Result caching: μž…λ ₯이 같을 λ•Œ λ‹€μ‹œ λŒμ§€ μ•Šκ³  μ•žμ„  κ²°κ³Όλ₯Ό λΆˆλŸ¬μ˜€λŠ” 것.
  • Super-step: Graph κ°€ μƒνƒœ snapshot ν•˜λ‚˜λ₯Ό μ €μž₯ν•˜λŠ” μ‹€ν–‰ λ‹¨μœ„.
  • Task: Flow μ•ˆμ—μ„œ Prefect κ°€ λ”°λ‘œ μž¬μ‹œλ„ν•˜κ³  cache ν•˜κ³  κΈ°λ‘ν•˜λŠ” λ‹¨μœ„.
  • Thread: Checkpointer κ°€ ν•œ λŒ€ν™”μ˜ μƒνƒœλ₯Ό λͺ¨μ•„ λ‘λŠ” λ‹¨μœ„.
  • VM (Virtual Metrology): κ³„μΈ‘ν•˜λŠ” λŒ€μ‹  곡정 μ„Όμ„œ λ°μ΄ν„°λ‘œ 계츑값을 μ˜ˆμΈ‘ν•˜λŠ” 것.
  • Work pool: Flow 싀행이 μ–΄λŠ infrastructure μœ„μ—μ„œ λŒμ§€ κ°€λ¦¬ν‚€λŠ” Prefect μ„€μ •.
  • Worker: Work pool 을 μ‚΄νŽ΄ μ˜ˆμ •λœ 싀행을 κ·Έ infrastructure μœ„μ—μ„œ μ‹œμž‘ν•˜λŠ” client μͺ½ process.

Appendix B. What Prefect Does In An Agent Backend

μ•„λž˜ ν•­λͺ©μ€ Prefect κ°€ agent backend μ—μ„œ ν•˜λŠ” 일이고, ν•­λͺ© 끝의 κ΄„ν˜ΈλŠ” 그것이 Table 3 의 μ–΄λŠ function 인지λ₯Ό 가리킨닀.

  1. μ€‘λ‹¨λœ μžλ¦¬μ—μ„œ λ‹€μ‹œ μ‹œμž‘: LLM 호좜과 tool ν˜ΈμΆœμ„ task λ‹¨μœ„λ‘œ cache ν•˜κ³ , μ‹€νŒ¨ν•˜λ©΄ κ·Έ μžλ¦¬λΆ€ν„° λ‹€μ‹œ μ‹œμž‘ν•œλ‹€ (#2 Resume after a crash, #6 Idempotent rerun).
  2. μž¬μ‹œλ„μ™€ μ œν•œ μ‹œκ°„: ν˜ΈμΆœλ§ˆλ‹€ retry policy 와 timeout 을 건닀. LLM API μž₯애와 tool 였λ₯˜μ— λŒ€μ‘ν•œλ‹€ (#1 Step retry).
  3. Event 둜 μžλ™ μ‹€ν–‰: FDC alarm μ΄λ‚˜ drift 감지 같은 event κ°€ λ‹ΏμœΌλ©΄ agent λ₯Ό μžλ™μœΌλ‘œ μ‹€ν–‰ν•œλ‹€ (#9 One admission path).
  4. μ •ν•΄μ§„ λ•Œλ§ˆλ‹€ μ‹€ν–‰: μ •κΈ° 뢄석 agent 와 report agent λ₯Ό schedule 에 κ±Έμ–΄ μ‹€ν–‰ν•œλ‹€ (#9 One admission path).
  5. μ—¬λŸ¬ node 에 λ‚˜λˆ„μ–΄ μ‹€ν–‰: K8s node λ‚˜ GPU worker 에 싀행을 λ‚˜λˆ„μ–΄ 보낸닀 (#4 Where a run executes).
  6. μ‹€ν–‰ 기둝 보기: Flow run κ³Ό task run 의 log 와 μƒνƒœλ₯Ό UI μ—μ„œ 따라간닀 (#8 Per-step observability).
  7. μ‚¬λžŒμ˜ 승인 기닀리기: pause_flow_run 으둜 승인이 닿을 λ•ŒκΉŒμ§€ λ©ˆμ·„λ‹€κ°€ λ‹€μ‹œ μ‹œμž‘ν•œλ‹€ (#3 Human approval, #5 Suspension).
  8. ML pipeline κ³Ό ν•œ μ²΄κ³„μ—μ„œ 운영: μž¬ν•™μŠ΅κ³Ό 배포와 agent 싀행을 ν•¨κ»˜ λŒλ¦°λ‹€ (#10 ML pipeline integration).
  9. 호좜 속도 μ œν•œ: λ™μ‹œ 호좜 μˆ˜μ™€ μ΄ˆλ‹Ή 호좜 속도λ₯Ό μ„ μ–ΈμœΌλ‘œ λ¬ΆλŠ”λ‹€. LLM API 의 rate limit 에 λŒ€μ‘ν•œλ‹€ (#7 Rate limiting).

직접 ν•˜μ§€ μ•ŠλŠ” 일: LLM μΆ”λ‘  logic, memory 와 RAG, μ‹€μ‹œκ°„ λŒ€ν™” serving 은 agent framework 와 API server κ°€ λ§‘λŠ”λ‹€.

Appendix C. How An Event Trigger Is Done In Prefect

두 λ‹¨κ³„λ‘œ ν•œλ‹€. emit_event κ°€ event λ₯Ό 내보내고, DeploymentEventTrigger λ˜λŠ” automation 이 κ·Έ event λ₯Ό λ°›μ•„ flow λ₯Ό μ‹€ν–‰ν•œλ‹€ [8].

1. Emit the event β€” FDC system μ΄λ‚˜ collector μͺ½μ—μ„œ ν•œλ‹€.

from prefect.events import emit_event

emit_event(
    event="fdc.alarm.raised",
    resource={"prefect.resource.id": "tool.ETCH01.TG1"},
    payload={"wafer_id": "W123", "sensor": "RF_power", "severity": "high"},
)

2. Run the agent flow from a trigger

from prefect import flow
from prefect.events import DeploymentEventTrigger


@flow
def fdc_agent(tool_id: str, wafer_id: str, sensor: str):
    ...  # agent analysis, then the report and the notification


if __name__ == "__main__":
    fdc_agent.serve(
        name="fdc-agent",
        triggers=[
            DeploymentEventTrigger(
                expect={"fdc.alarm.raised"},
                match={"prefect.resource.id": "tool.*"},
                parameters={  # Jinja injects the event values into the flow parameters
                    "tool_id": "{{ event.resource.id }}",
                    "wafer_id": "{{ event.payload.wafer_id }}",
                    "sensor": "{{ event.payload.sensor }}",
                },
            )
        ],
    )

Table 4. Trigger types

# Type Use Setting
1 Reactive Event κ°€ λ‹ΏμœΌλ©΄ κ³§λ°”λ‘œ μ‹€ν–‰ κΈ°λ³Έκ°’
2 Threshold Event κ°€ N 번 μŒ“μ΄λ©΄ μ‹€ν–‰ (예: 10 λΆ„ μ•ˆμ— alarm 3 회) threshold=3, within=timedelta(minutes=10)
3 Proactive Event κ°€ μ˜€μ§€ μ•ŠμœΌλ©΄ μ‹€ν–‰ (예: 데이터 μˆ˜μ§‘ 쀑단) posture="Proactive"
4 Compound / Sequence μ—¬λŸ¬ event 의 μ‘°ν•©μ΄λ‚˜ μˆœμ„œκ°€ 맞으면 μ‹€ν–‰ CompoundTrigger, SequenceTrigger
5 Flow state λ‹€λ₯Έ flow κ°€ λλ‚˜κ±°λ‚˜ μ‹€νŒ¨ν•˜λ©΄ μ΄μ–΄μ„œ μ‹€ν–‰ expect={"prefect.flow-run.Completed"} λ“±

External systems

  • Prefect Cloud: webhook 이 μ™ΈλΆ€ HTTP μš”μ²­μ„ κ·ΈλŒ€λ‘œ event 둜 λ°›λŠ”λ‹€.
  • Self-hosted (OSS): webhook 이 μ—†μœΌλ―€λ‘œ FastAPI endpoint λ‚˜ KafkaΒ·MQ consumer κ°€ emit_event λ₯Ό 뢈러 κ·Έ μš”μ²­μ„ event 둜 λ°”κΎΌλ‹€.

Fab application

  • FDC alarm β†’ Reactive β†’ 원인 뢄석 agent
  • VM 였차 μ΄ˆκ³Όκ°€ 10 λΆ„ μ•ˆμ— 3 회 β†’ Threshold β†’ μž¬ν•™μŠ΅ flow
  • μ„Όμ„œ 데이터 30 λΆ„ λ―Έμˆ˜μ‹  β†’ Proactive β†’ μž₯λΉ„ 점검 μ•Œλ¦Ό
  • μž¬ν•™μŠ΅ μ™„λ£Œ β†’ Flow state β†’ 검증 agent β†’ report 생성

Appendix D. Agent Frameworks In Use As Of September 2026

이 λ¬Έμ„œκ°€ 비ꡐ λŒ€μƒμœΌλ‘œ μ“΄ 것은 #1 LangGraph 이며, κ³ λ₯Έ μ΄μœ λŠ” κΌ­μ§€ 2 에 μ μ—ˆλ‹€. μΆœμ‹œ μ‹œμ μ€ 각 μ œν’ˆμ˜ 곡개 λ°œν‘œ μ‹œμ μ΄λ‹€ [9].

Table 5. Agent frameworks and when each was first announced

# Framework Framework details Announced
1 LangGraph Graph 둜 μƒνƒœλ₯Ό 닀룬닀. μ‹€ν–‰ 기둝과 μ‚¬λžŒ 승인이 ν•„μš”ν•œ 곳의 κΈ°λ³Έκ°’ 2024-01
2 CrewAI 역할을 맑은 agent μ—¬λŸΏμ„ νŒ€μœΌλ‘œ λ¬ΆλŠ”λ‹€. Prototype κΉŒμ§€ κ°€μž₯ 빠름 2024-01
3 OpenAI Agents SDK Model 이 loop λ₯Ό 끌고 κ°„λ‹€. GPT 쀑심이면 손이 κ°€μž₯ 덜 감 2025-03
4 Google ADK Multimodal 에 κ°•ν•˜λ‹€. Google Cloud NEXT 2025 μ—μ„œ 곡개 2025-04
5 Claude Agent SDK Claude Code 의 agent harness. Claude Code SDK μ—μ„œ 이름을 λ°”κΏˆ 2025-09
6 Microsoft Agent Framework Graph 기반. Azure 와 .NET ν™˜κ²½μ˜ 선택 2026-04
7 Pydantic AI Type μ•ˆμ „ν•œ Python. V2 κ°€ durable execution 을 λ‹΄μŒ 2026-06

#7 Pydantic AI 와 Prefect λŠ” λ”°λ‘œ μ“°λŠ” 두 μ œν’ˆμ΄κ³ , κ·Έ λ‘˜μ„ μž‡λŠ” package κ°€ κ³΅κ°œλ˜μ–΄ μžˆλ‹€ [5]. κ·Έ package λ₯Ό μ„€μΉ˜ν•˜λ©΄ Pydantic AI 둜 μ“΄ agent κ°€ Prefect 의 flow 둜 돌고 κ·Έ agent 의 tool 이 Prefect 의 task κ°€ λ˜λ―€λ‘œ, κ°μ‹ΈλŠ” Python code λ₯Ό 직접 μ“Έ ν•„μš”κ°€ μ—†λ‹€. 두 μ œν’ˆμ΄ ν•©μ³μ‘Œλ‹€κ±°λ‚˜ ν•œμͺ½μ΄ λ‹€λ₯Έ μͺ½μ„ μ•ˆμ—μ„œ μ“°λŠ” 것은 μ•„λ‹ˆλ‹€.

일곱 κ°€μš΄λ° 연계 μ „μš© package κ°€ λ‚˜μ˜¨ 것은 #7 Pydantic AI ν•˜λ‚˜μ΄λ©°, λ‚˜λ¨Έμ§€λŠ” backend μ—”μ§€λ‹ˆμ–΄κ°€ 직접 감싼닀. Prefect λŠ” flow λ₯Ό Python ν•¨μˆ˜λ‘œ λ‹€λ£¨λ―€λ‘œ Pydantic AI 와 LangGraph λ₯Ό λΉ„λ‘―ν•΄ Python 으둜 된 μ–΄λ–€ agent framework 도 λŒλ¦°λ‹€ [10].

Our Score
Click to rate this post!
[Total: 1 Average: 4]
Visited 25 times, 1 visit(s) today

2 Comments

Leave a Comment

Your email address will not be published. Required fields are marked *