Governed AI workflow example using Prefect and Tuning Engines #22161
Replies: 5 comments 3 replies
|
Thanks for the direction on making this more Prefect-native. I opened a replacement PR with a fuller example around task retries/timeouts, global concurrency limits, persisted results, deployments, and run/request trace correlation: #22162 |
|
That framing makes sense to me. For a first Prefect example, we would aim for operational usage visibility rather than billing-grade accuracy. The useful Prefect pattern is: every model call emits normalized request metadata tied to the Prefect flow/task run, plus optional user, feature, workflow, model, provider, token counts, latency, and request IDs. That gives teams enough to answer questions like “which workflow/user/feature is driving usage?” without turning the example into a full billing system. Billing-grade accuracy probably belongs one layer downstream, because provider token accounting, retries, streaming, tool calls, cached tokens, and model-specific pricing rules can vary. I’d keep the Prefect side focused on durable orchestration and attribution, then let a dashboard or cost service apply pricing and reconciliation later. For OpenAI-compatible Chinese model layers, I think the same split applies: normalize the response shape and usage metadata per request first, preserve raw provider metadata for audit/debugging, and only then present grouped cost views by user, workflow, or model tier. |
|
We would keep the normalized usage event and correlation IDs close to the workflow run, but keep raw provider evidence outside Prefect. |
|
We would define a small, provider-neutral contract rather than make the reference completely opaque: |
Uh oh!
There was an error while loading. Please reload this page.
Hi Prefect team,
Thanks for the review on #22066. The feedback made sense: the first PR was too much of a generic endpoint example and did not show enough Prefect-specific value.
I wanted to continue the conversation here before opening another PR.
The stronger example I would propose is a Prefect flow for governed AI work where Prefect owns orchestration and Tuning Engines is only the governed model/tool endpoint:
The intent would be:
Would an example like that fit better in the Prefect examples/docs? If yes, I can open a fresh PR shaped around the Prefect-native parts rather than the generic gateway setup.
All reactions