Библиотека / ИИ-агенты и ассистенты
ИИ-агенты и ассистенты
Trace refund approval flows with OpenRouter and OpenTelemetry
When an API call/webhook arrives, it runs an AI agent with OpenRouter and OpenAI / ChatGPT.
Что делает
## Trace a human approval across a wait with OpenRouter and OpenTelemetry ### Quick overview This workflow enriches a refund request, drafts an approval proposal with an AI agent, and waits for a human to approve or reject it, so you can follow one execution across the wait with OpenTelemetry tracing. It is the Exercise 5 template from the n8n Production AI Playbook post on Audit & Trace. No payment is processed. ### How it works 1. Receives a POST webhook request with a requestId, amount in cents, reason and a traceparent header. 2. Enrich Request Sub-workflow validates the request and adds simulated customer context. 3. Policy Service Call sends an HTTP request that carries the trace context to an echo service. 4. Approval Proposal Agent drafts a proposal using an OpenRouter chat model. 5. Return Approval Request responds with the proposal, executionId and resumeUrl. 6. Wait for Human Approval pauses until a decision is posted to the resume URL. 7. Validate Approval checks the decision, and Record Approval saves it. Invalid decisions stop at Reject Approval. ### Setup 1. Import, save and publish the Exercise 5 enrichment sub-workflow, then select it in Enrich Request Sub-workflow. 2. Add an OpenRouter API credential to OpenRouter - Approval. 3. Optionally enable OpenTelemetry tracing in Settings > OpenTelemetry. 4. Select Execute workflow and POST {"requestId":"REQ-2001","amount":4999,"reason":"duplicate charge"} with a traceparent header. 5. POST {"approved":true,"approver":"Demo reviewer"} to the returned resumeUrl. In production, authenticate the reviewer and protect the resume endpoint.
Шаги
- Webhook - Approval Request
- Enrich Request Sub-workflow
- Policy Service Call
- Approval Proposal Agent
- OpenRouter - Approval
- Return Approval Request
- Wait for Human Approval
- Validate Approval
- Reject Approval
- Record Approval
Похожие автоматизации
Мониторинг, эксплуатация и инцидентыTrace simulated card charges with OpenTelemetry and JaegerШагов: 8Финансы, счета и бухгалтерияОценка запросов на возврат средств на мошенничество по вебхуку с проверками одобрения и журналом аудитаШагов: 11Код, Git и инструменты разработчикаРезервное копирование потоков Typebot в GitHubШагов: 27ИИ-агенты и ассистентыTag and log AI refund decisions as searchable execution data with OpenRouterШагов: 11