Skip to content

Epic: AI Inference #70

Description

@shaneutt

Praxis's core differentiator: a full AI inference gateway built on the filter-first, body-first architecture, with per-provider control over binary size and attack surface.

Scope Boundary

This epic covers the core AI inference framework: provider abstraction, filter registry, streaming inspection, circuit breaking, pipeline validation, and GenAI observability. Related work tracked elsewhere:

Crate Architecture

AI inference filters live under filter/src/builtins/http/ai/. The current module structure is preferred over a separate praxis-ai crate unless binary size measurements demonstrate a need for crate-level feature gating. Per-provider Cargo feature flags at the workspace level provide equivalent control without the complexity of a separate crate.

Provider Abstraction Layer

Unified interface for OpenAI, Anthropic, Google, AWS Bedrock, and Azure OpenAI. Each provider is behind its own Cargo feature flag. The abstraction layer provides:

  • Common request/response envelope types for translation
  • Per-provider serialization/deserialization
  • Streaming response normalization across SSE format differences
  • Passthrough mode for provider-specific features

Streaming Inspection

SSE event parsing for inference responses:

  • Per-event filter hooks for inspection and modification
  • Streaming token extraction from delta content fields
  • Cross-chunk event reassembly
  • Backpressure-aware buffering

GenAI Observability

OpenTelemetry GenAI semantic conventions for standardized AI observability:

  • gen_ai.client.* span attributes (system, request.model, response.model)
  • Token usage metrics (gen_ai.client.token.usage)
  • Operation duration metrics
  • Streaming-aware span lifecycle

Foundation

  • Per-provider Cargo feature flags
  • Credential injection (per-cluster API key injection, env var source, strip client creds)

Body Access

  • StreamBuffer peek-then-stream (16KB cap, decision timeout fallback)
  • Inline body access for common AI patterns (model, provider, token budget, tool name)

Advanced

  • AI circuit breaking (tuned for AI latency profiles)
  • Body mutation for semantic routing
  • Token-aware routing (cost, latency, availability)
  • Pipeline validation for AI filter composition

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions