UseDocumentation Index
Fetch the complete documentation index at: https://redop.useagents.site/docs/llms.txt
Use this file to discover all available pages before exploring further.
onAfterResponse(...) when you need shared logic that should run after Redop has already written the response to the client.
This is a global lifecycle hook. It runs for tools, resources, and prompts.
What it is for
onAfterResponse(...) is a good fit when you want to:
- log request completion without adding response latency
- emit analytics or impressions
- write metrics, traces, or audit events
- trigger non-critical follow-up work that must not change the response
Example
What the event includes
The global event includes:kindas"tool","resource", or"prompt"nameas the resolved tool name, resource URI, or prompt nametoolas the same normalized identifier used by the other global hooksctxrequestinputresultwhen execution succeedederrorwhen execution failed
Where it runs in the lifecycle
For tools, the successful path is:onAfterResponse(...) runs:
- after the response is already committed
- after local
afterResponse - for both successful and failed executions
- too late to modify what the client receives
Use it vs onAfterHandle
Use onAfterHandle(...) when you need to inspect or replace a successful result before Redop returns it.
Use onAfterResponse(...) when the work should happen after the client response and should not add latency to the response path.
Error behavior
onAfterResponse(...) is best-effort. If it throws, Redop reports the failure to error hooks when possible, but the client response has already been sent.
That makes it a good place for:
- analytics
- logging
- metrics
- audit events