Skip to content

Investigate async on_response_body support #51

Description

@liavweiss

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

Fields

No fields configured for Spike.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions