Description
on_response_body is currently synchronous in the HttpFilter trait
due to a Pingora constraint. External guardrail providers (and any
filter that needs async HTTP calls during response processing) require
an async version of this hook.
- Investigate the Pingora
response_body_filter hook — it is defined as a sync fn, which propagates to Praxis's on_response_body
- Evaluate feasibility of a sync-to-async bridge at the Pingora boundary.
- Consider whether upstream Pingora changes are needed or if this can be solved within Praxis
- Document findings and recommended approach
Context:
on_request_body is already async — this is only a response-side limitation
- "ai_guardrails: NeMo response-side guardrails" is blocked on this
- Any future filter that needs to make HTTP calls during response processing is also blocked
Motivation
Multiple features require async operations during response body
processing (AI guardrails response-side, HTTP callout filter for
responses, etc.). Without this, any filter that needs to call an
external service during response processing cannot be implemented.
Alternatives Considered
Running the external call synchronously with block_on — this risks
blocking the Pingora event loop and degrading proxy throughput. Needs
investigation to determine if it is safe in practice.
Area
Filter Pipeline
Parent Epic (optional)
#76
Description
on_response_bodyis currently synchronous in theHttpFiltertraitdue to a Pingora constraint. External guardrail providers (and any
filter that needs async HTTP calls during response processing) require
an async version of this hook.
response_body_filterhook — it is defined as a syncfn, which propagates to Praxis'son_response_bodyContext:
on_request_bodyis already async — this is only a response-side limitationMotivation
Multiple features require async operations during response body
processing (AI guardrails response-side, HTTP callout filter for
responses, etc.). Without this, any filter that needs to call an
external service during response processing cannot be implemented.
Alternatives Considered
Running the external call synchronously with
block_on— this risksblocking the Pingora event loop and degrading proxy throughput. Needs
investigation to determine if it is safe in practice.
Area
Filter Pipeline
Parent Epic (optional)
#76