Redis OpenAI Agents API#

Reference documentation for the Redis OpenAI Agents API.

Sessions & Memory#

redis_openai_agents.AgentSession(user_id[, ...])

Persistent session storage for OpenAI Agents SDK conversations.

redis_openai_agents.JSONSession(session_id, ...)

Native RedisJSON-based session storage for OpenAI Agents SDK.

Caching#

redis_openai_agents.SemanticCache([...])

Two-level semantic cache for LLM responses.

redis_openai_agents.CacheResult(response, ...)

Result from a cache lookup.

redis_openai_agents.RedisCachingModel(model)

Caching wrapper for OpenAI Agents SDK Model interface.

redis_openai_agents.CachedModelResponse(...)

Cached model response matching ModelResponse structure.

redis_openai_agents.CachedUsage([...])

Cached usage information.

Routing#

redis_openai_agents.SemanticRouter(name, routes)

Semantic router for classifying statements into predefined routes.

redis_openai_agents.Route(*, name, references)

Definition of a route for semantic classification.

redis_openai_agents.RouteMatch([name, distance])

Result of routing a statement.

Streaming#

redis_openai_agents.RedisStreamTransport(...)

Redis Streams-based event transport for token streaming.

redis_openai_agents.RobustStreamProcessor([...])

Fault-tolerant stream processor with DLQ support.

redis_openai_agents.ResumableStreamRunner([...])

Resumable LLM streaming backed by Redis Streams.

redis_openai_agents.StreamingEventPublisher(...)

High-level helper for publishing SDK streaming events.

Coordination#

redis_openai_agents.AgentCoordinator([...])

Streams-based coordination for distributed agents.

redis_openai_agents.EventType(*values)

Standard event types for agent coordination.

redis_openai_agents.AtomicOperations(client)

Lua script-based atomic operations for Redis.

redis_openai_agents.HandoffInProgressError

Raised when a handoff is already in progress for a session.

Observability#

redis_openai_agents.AgentMetrics(name[, ...])

Time-series metrics collector using RedisTimeSeries.

redis_openai_agents.PrometheusExporter(metrics)

Exports AgentMetrics in Prometheus text format.

redis_openai_agents.RedisTracingProcessor([...])

Stores OpenAI Agents SDK traces in Redis for observability.

SDK Integration#

redis_openai_agents.RedisAgentRunner([...])

Integrated runner with automatic caching, metrics, and session management.

redis_openai_agents.CachedRunResult(response)

Result from a cached run.

redis_openai_agents.RedisFileSearchTool(_service)

A callable tool for searching documents using Redis hybrid search.

redis_openai_agents.RedisRateLimitGuardrail([...])

Redis-backed rate limiting guardrail for OpenAI Agents SDK.

redis_openai_agents.cached_run(query, ...[, ...])

Execute run function with cache checking.

redis_openai_agents.with_metrics(metrics[, ...])

Decorator that records metrics for a run function.

redis_openai_agents.create_redis_file_search_tool(service)

Factory function to create a Redis file search tool.

Tool Caching#

redis_openai_agents.cached_tool(*, name[, ...])

Decorator that memoizes a callable's return value in Redis.

redis_openai_agents.DEFAULT_SIDE_EFFECT_PREFIXES

Built-in immutable sequence.

redis_openai_agents.DEFAULT_VOLATILE_ARG_NAMES

frozenset() -> empty frozenset object frozenset(iterable) -> frozenset object

Middleware#

redis_openai_agents.MiddlewareStack(model, ...)

Compose middleware around an OpenAI Agents SDK Model.

redis_openai_agents.AgentMiddleware(*args, ...)

Protocol for around-style middleware in the OpenAI Agents SDK.

redis_openai_agents.ModelRequest(...[, ...])

Snapshot of a Model.get_response invocation.

redis_openai_agents.middleware.SemanticCacheMiddleware(...)

Cache LLM responses keyed by the semantic similarity of the input.

redis_openai_agents.middleware.SemanticRouterMiddleware(...)

Short-circuit the LLM call when the input matches a known intent.

redis_openai_agents.middleware.ConversationMemoryMiddleware(...)

Prepend semantically relevant past messages into the request.

Infrastructure#

redis_openai_agents.RedisConnectionPool([...])

Shared Redis connection pool for all components.

redis_openai_agents.configure_pool([...])

Configure the default connection pool.

redis_openai_agents.get_pool()

Get the default shared connection pool.

redis_openai_agents.reset_pool()

Reset the default pool.

redis_openai_agents.RetryConfig([...])

Configuration for retry behavior.

redis_openai_agents.with_retry([...])

Decorator that adds retry logic to a sync function.

redis_openai_agents.with_async_retry([...])

Decorator that adds retry logic to an async function.

redis_openai_agents.configure_retry([...])

Configure the global default retry settings.

redis_openai_agents.get_retry_config()

Get the default retry configuration.

redis_openai_agents.RankedOperations([...])

Sorted set-based ranking for agent operations.

redis_openai_agents.DeduplicationService([...])

Bloom filter-based deduplication for agent operations.