Repository navigation
Replies: 3 comments
|
Hi @dinpd! Here is the recommended architectural approach in Medusa v2:
|
|
We built the propose, approve, apply path for merchant-initiated writes over Medusa 2.20.1, prices, stock, status, content and promotions rather than refunds. Three notes from that, on questions 1 and 2. A custom authenticated route wrapping the workflow held up. The hard parts were not the route boundary, they were what happens between authorization and execution.
On question 2 we did not find a pre-execution gate over the native admin routes either. What we do instead is leave the agent unable to write at all: it proposes, and only an operator action applies. The native routes stay as they are, and the governance sits in one place. Implementation if useful: https://github.com/vishkaty/commerce-agents-medusa, Apache 2.0. |
|
One documentation clarification: the Medusa workflow reference names this refund flow refundPaymentsWorkflow (plural payments), and the payment guide points to it for refunds. A guarded custom endpoint is a clear boundary for agent requests, but it only covers requests sent through that endpoint. If the same approval rule must also govern refunds initiated through the built-in Admin API, Medusa docs say existing API routes cannot have their middleware replaced; replicate or override that specific route and add the guard there. Workflow hooks run at named points inside a workflow, so verify that the exact flow exposes a pre-refund hook before treating one as a hard veto. References: https://docs.medusajs.com/resources/references/medusa-workflows/refundPaymentsWorkflow and https://docs.medusajs.com/learn/fundamentals/api-routes/override |
Uh oh!
There was an error while loading. Please reload this page.
Hi Medusa team — we’re exploring a Medusa v2 integration for AgentAction, an open-source authorization and evidence layer for actions initiated by AI agents.
The initial use case is a governed refund:
allow,deny, orchallenge_required.202; after approval, the agent retries with authorization bound to the exact original payload.Our current thought is an independently maintained Medusa plugin with dedicated guarded routes, rather than modifying Medusa core or claiming to intercept every Admin API call.
Before building, we’d appreciate guidance on three points:
refundPaymentsWorkflowthe recommended Medusa v2 approach?medusajs/examples, while the plugin remains independently maintained?We’d start with refunds only, then consider cancellations and fulfillment after validating the architecture. No Medusa core changes are currently proposed.
Thanks—we’d rather align with Medusa’s extension model before writing the plugin.
All reactions