Skip to main content

Crate agent_proxy_rust_core

Crate agent_proxy_rust_core 

Source
Expand description

agent-proxy-rust-core — middleware trait, axum server engine, and upstream forwarding.

This crate provides the foundation for the agent-proxy-rust project. It defines the ProxyMiddleware trait (the central extension point), core domain types, error handling, configuration, an authentication layer, and the axum-based HTTP proxy engine.

§Architecture

Client → Auth Layer → Router → handle_proxy_request
                                    ├── on_request chain (registration order)
                                    ├── forward to upstream
                                    └── on_response chain (reverse order)

Middleware crates (compress, bridge, model-router, cost) implement ProxyMiddleware and are composed via the builder.

Re-exports§

pub use compression::CompressionStats;
pub use compression::read_tokenless_stats;
pub use config::ProxyConfig;
pub use error::ProxyError;
pub use middleware::CostRecorder;
pub use middleware::ProxyMiddleware;
pub use server::AgentProxy;
pub use server::AgentProxyBuilder;
pub use types::AgentType;
pub use types::ChannelConfig;
pub use types::ConnectionContext;
pub use types::ProxyRequest;
pub use types::ProxyResponse;
pub use types::detect_api_format;

Modules§

auth
Authentication middleware for the proxy.
compression
Compression statistics tracking across three layers.
config
Proxy configuration types.
error
Proxy error types and HTTP response mapping.
extensions
Well-known extension keys for ConnectionContext::extensions.
middleware
The ProxyMiddleware trait — the core extension point for the proxy engine.
report
Tokenless report file consumer.
server
The axum-based proxy server engine.
testing
Shared test helpers for the core crate and downstream middleware crates.
types
Core domain types for the proxy engine.

Enums§

ApiFormat
Re-exported from llm_bridge_core::model::ApiFormat as the single source of truth. The target API format for protocol transformation.