Guardrails and usage

Filters

Discover operator capabilities, required filters, and pipeline ordering.

Praxis AI v0.12.1 (alpha) 3 min read
On this page

Start with the problem you need to solve. The generated filter reference owns exact settings; this page explains composition. Unless marked optional, these capabilities are registered in the default production binary. See build features before selecting an image.

Choose a capability

Operator taskFilters and prerequisitesOrder and working material
Identify the client operationai_operation; protocol body owners openai_chat_completions_request, anthropic_messages_request, or experimental openai_responses_requestClassify before operation-dependent policy. Client paths, reference
Forward a native APICore router, headers, load_balancer; provider endpoint, Host, TLS/SNI, credentialsSelect a cluster before credential injection. Quickstart, Anthropic recipe
Translate protocolsDirection-specific request/response adapter plus SSE adapter where requiredRequest owner before translation; select the provider before selected-provider translation. Compatibility matrix, path table
Map public model aliasesmodel_to_provider, then load_balancerDo not add a competing router. Routing recipe, reference
Select providers dynamicallymodel_to_header, intelligent_route, credential_inject, load_balancer; trusted candidate catalog and secretsSelection publishes the profile used by adapters and credentials. Routing recipe, reference
Route within a providerpeer_identity_trust, provider_route, endpoint selectionRequires authenticated downstream mTLS and trusted routing assertions. Example, reference
Change prompt contentprompt_enrich; protocol-compatible Chat bodyApply before final token ceilings and inference. Example, reference
Separate identities and secretsAuthentication boundary, state_owner, identity_header_guard, project_state_owner_headers, callout_credentials as appropriateHeader capture does not authenticate provenance. Authenticate or delete-then-set assertions at a trusted ingress. Credential boundaries, state owner
Screen contentai_operation, then ai_guardrails; NeMo 0.24.0+ and deployed railsConfigure outbound callout policy. Response screening has streaming restrictions. Recipe, reference
Extract and observe usagemodel_to_header, token_count, optional token_usage_metrics, time_to_first_tokenBody counts are available after headers; do not promise token_usage_headers on these paths. Recipe, count reference
Bound output or reserve token budgetsOptional experimental token_ceiling, token_rate_limit, inflight_trackerCeiling evaluates the final provider-bound body; rate limiting needs its configured budget backend and trusted key dimensions. Ceiling example, rate-limit reference, inflight reference
Check balance and report usageexternal_metering; reachable metering service, destination-bound callout authenticationPre-request admission and post-response reporting are separate. File-key example, reference
Broker MCP or route A2Amcp, a2a, core JSON-RPC and routing; reachable servicesProtocol discovery/routing does not execute model tools. MCP example, A2A example, architecture
Manage Responses, tools, files, historyExperimental Responses filters, selected tool groups and store backendFollow the whole pipeline, including IRR, streaming composition, owner scope, and callout limits. Recipe, store architecture

Ordering and boundaries

Request hooks generally follow declared order; response hooks run in reverse. Body and header phases are distinct: placing a usage reader later cannot make body-derived data available before response headers are sent. Branches and IRR steps have their own lifecycle; do not transplant a body filter into a branch without checking its declared phase and pipeline validation.

Use the complete examples linked above and run praxis-ai --validate -c FILE with the selected binary. A valid configuration proves registration and static constraints, not backend compatibility, credentials, or successful tool execution. Streaming transformations must retain their SSE adapters and bounds; a finite JSON translation alone does not establish streaming support.

Core routing, load balancing, TLS, authentication, headers, rate limiting, CORS, compression, and other base proxy behavior belong to the Praxis core reference. AI provider credentials have two distinct owners: core credential_injection uses a selected cluster, while AI credential_inject consumes the selected dynamic provider profile. Their configuration formats are different.

Organization

Rust crate layout and host integration are in the embedding guide.

Registration

Custom Rust hosts use the registration instructions, including the response-store pipeline extension when needed.


a2a

Extracts A2A protocol metadata from JSON-RPC request bodies and promotes method, family, task ID, streaming detection, and version to request headers, filter results, and durable metadata for routing.

ai_guardrails

Calls an external AI guardrail provider to evaluate request and response bodies. The provider determines whether content should be passed, blocked, or redacted.

ai_operation

Classifies supported AI operations from the request head.

anthropic_messages_protocol

Normalizes Anthropic Messages protocol headers for native backends.

anthropic_messages_request

Read the release-matched anthropic messages request documentation and its scope.

anthropic_messages_to_chat_completions

Transforms Anthropic Messages API requests to Chat Completions-compatible request bodies and transforms compatible responses back.

anthropic_messages_to_chat_completions_stream

Transforms streaming SSE responses between the Chat Completions and Anthropic Messages formats, processing each chunk as it arrives.

anthropic_messages_to_vertexai_anthropic

Read the release-matched anthropic messages to vertexai anthropic documentation and its scope.

anthropic_web_search

Executes server-owned WebSearch tool calls in an Anthropic Messages loop.

aws_sigv4_sign

Signs outbound requests to AWS services using SigV4.

azure_ad

Injects an Azure AD (Entra ID) bearer token into outbound requests.

callout_credentials

Establishing filter that captures typed per-user callout secrets from ingress headers.

credential_inject

Replaces caller credentials with the upstream credential selected by intelligent_route or provider_route.

Extensions

Extend Praxis AI with custom filters using the Praxis core filter interfaces and registration model.

external_metering

Integrates with an external metering service for pre-request balance checks and post-response token usage reporting.

Filter Reference

AI filters provided by Praxis AI. For base proxy filters (router, load balancer, headers, CORS, etc.), see the Praxis core filter reference.

gcp_adc

Injects a GCP OAuth2 access token into outbound requests.

http_callout

Calls an external HTTP service during request processing and feeds its response into branch-chain evaluation.

identity_header_guard

Captures request headers matching a configured prefix into filter_metadata and removes them from the upstream request.

inflight_tracker

Read the release-matched inflight tracker documentation and its scope.

intelligent_route

Select an upstream cluster for an inference model or MCP tool from a validated routing snapshot. Place this filter after request classification and before load_balancer.

llmisvc_model_provider_resolver

Rewrites publisher-ID body model values to the short model name for LLMISvc / KServe routing; the routing header is left unchanged.

mcp

Extracts MCP JSON-RPC method, tool, resource, prompt, version, and session metadata into filter-visible request fields.

model_to_header

Promotes the JSON “model” field from the request body to a request header.

model_to_provider

Read the release-matched model to provider documentation and its scope.

openai_agentic_loop

Agentic loop controller for the Responses API pipeline.

openai_chat_completions_request

Read the release-matched openai chat completions request documentation and its scope.

openai_chat_completions_streaming_selector

Read the release-matched openai chat completions streaming selector documentation and its scope.

openai_chat_completions_to_anthropic

Read the release-matched openai chat completions to anthropic documentation and its scope.

openai_chat_completions_to_anthropic_stream

Read the release-matched openai chat completions to anthropic stream documentation and its scope.

openai_chat_completions_to_azureai_chat_completions

Transforms requests targeting Azure OpenAI deployments into standard Chat Completions-compatible form and normalizes responses back.

openai_chat_completions_to_vertexai_gemini

Transforms OpenAI Chat Completions requests into Vertex AI Gemini generateContent format and translates responses back.

openai_client_tool_compat

Lowers rich client-owned tool declarations to private function tools for a function-only Responses backend and restores the typed items on the way back.

openai_conversations

Serve OpenAI Conversations API endpoints locally through the configured response store.

openai_doc_extract

Converts input_file content parts to input_text for backends that do not support input_file natively (e.g. vLLM, llm-d).

openai_file_resolve

Resolves file_id and file_url references in Responses API input by fetching content from a Files API or remote URL via ApiClient and inlining the base64-encoded content in the provider-native field.

openai_file_search_dispatch

Read the release-matched openai file search dispatch documentation and its scope.

openai_mcp_dispatch

Executes MCP tool calls against upstream MCP servers within the Responses API agentic loop.

openai_mcp_tool_resolve

Resolves MCP tool entries from the Responses API tools array into concrete tool definitions by calling tools/list on each upstream MCP server.

openai_responses_compact

Summarizes conversation history when the token count exceeds a configured threshold.

openai_responses_model_rewrite

Rewrites the model field in Responses and Chat Completions request bodies.

openai_responses_proxy

Rebuilds the request body from ResponsesState when present.

openai_responses_rehydrate

Validates previous_response_id by fetching the stored response, confirming its status is “completed”, and populating ResponsesState with the full conversation history (stored turns + current input).

openai_responses_request

Processes a Responses request body once and initializes state.

openai_responses_store

Read the release-matched openai responses store documentation and its scope.

openai_responses_to_chat_completions

Read the release-matched openai responses to chat completions documentation and its scope.

openai_stream_events

Composes the current IRR execution into one logical Responses stream.

openai_tool_parse

Parses tool definitions and tool_choice from Responses API request bodies and promotes routing facts to metadata and filter results without mutating the body.

openai_web_search_dispatch

Read the release-matched openai web search dispatch documentation and its scope.

PPE token quota plugin

The experimental token-quota-filter feature registers the ai/token-quota host plugin with the Praxis Policy Engine (PPE).

project_state_owner_headers

Projects a normalized [StateOwner] into destination-specific HTTP headers.

prompt_enrich

Injects statically configured messages into the messages array of OpenAI-compatible chat completion request bodies.

provider_route

Exact provider-local mapping from an authenticated intelligent routing selection to a private backend cluster.

state_owner

Establishes a normalized [StateOwner] from trusted identity sources.

stream_usage_inject

Injects stream_options.include_usage = true into streaming OpenAI chat-completions requests so the upstream response contains token usage.

time_to_first_token

Measures time-to-first-token for streaming AI responses.

token_ceiling

Rejects provider-bound requests whose estimated serialized request body or requested output exceeds configured limits.

token_count

Extracts token usage from AI inference responses and writes unified counts to [filter_metadata].

token_rate_limit

Token-denominated rate limiter: reserves an estimated cost at admission, reconciles against actual usage after the response completes.

token_usage_headers

Injects Praxis-Token-Input, Praxis-Token-Output, and Praxis-Token-Total headers into downstream responses when token usage data is present in [filter_metadata].

token_usage_metrics

Read the release-matched token usage metrics documentation and its scope.