mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-08-01 19:06:01 +00:00
* feat: add redis stream bridge * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * fix(gateway): address redis stream bridge review Redis was imported eagerly through deerflow.runtime and declared as a hard dependency, which made memory-only installs load redis.asyncio at startup and left the lazy factory import ineffective. Move redis behind an optional extra, remove the public eager re-export, and keep make_stream_bridge as the only runtime import path with an actionable install hint when the extra is missing. Because Docker deployments now default the stream bridge to Redis via DEER_FLOW_STREAM_BRIDGE_REDIS_URL, install the redis extra explicitly in Docker/dev container flows and teach the local uv-extra detector to infer redis from both stream_bridge.type and the Redis URL env var. This keeps Docker working while preserving slim non-Docker installs. Harden the Redis bridge by batching XREAD replay, replacing brittle ResponseError string matching with a single fallback to 0-0 for malformed Last-Event-ID values, documenting connection/retention/fail-hard behavior, and adding fake plus opt-in real Redis coverage for XADD/XREAD, replay, invalid IDs, and MAXLEN trimming. * fix(config): bump config version for stream bridge * fix redis stream bridge terminal handling * fix: repair uv.lock, format redis.py, and align Dockerfile extras test The uv.lock file was missing a closing bracket for the redis extras section, redis.py had a formatting issue caught by ruff, and the Dockerfile extras test did not account for the hardcoded --extra redis flag. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Willem Jiang <willem.jiang@gmail.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
53 lines
1.8 KiB
Python
53 lines
1.8 KiB
Python
"""LangGraph-compatible runtime — runs, streaming, and lifecycle management.
|
|
|
|
Re-exports the public API of :mod:`~deerflow.runtime.runs` and
|
|
:mod:`~deerflow.runtime.stream_bridge` so that consumers can import
|
|
directly from ``deerflow.runtime``.
|
|
"""
|
|
|
|
from .checkpointer import checkpointer_context, get_checkpointer, make_checkpointer, reset_checkpointer
|
|
from .runs import ConflictError, DisconnectMode, RunContext, RunManager, RunRecord, RunStatus, UnsupportedStrategyError, run_agent
|
|
from .serialization import serialize, serialize_channel_values, serialize_channel_values_for_api, serialize_lc_object, serialize_messages_tuple, strip_data_url_image_blocks
|
|
from .store import get_store, make_store, reset_store, store_context
|
|
|
|
# NOTE: ``RedisStreamBridge`` is intentionally not re-exported — ``redis`` is an
|
|
# optional extra and importing it here would load ``redis.asyncio`` in every
|
|
# process. Import it from ``deerflow.runtime.stream_bridge.redis`` when needed.
|
|
from .stream_bridge import END_SENTINEL, HEARTBEAT_SENTINEL, MemoryStreamBridge, StreamBridge, StreamEvent, make_stream_bridge
|
|
|
|
__all__ = [
|
|
# checkpointer
|
|
"checkpointer_context",
|
|
"get_checkpointer",
|
|
"make_checkpointer",
|
|
"reset_checkpointer",
|
|
# runs
|
|
"ConflictError",
|
|
"DisconnectMode",
|
|
"RunContext",
|
|
"RunManager",
|
|
"RunRecord",
|
|
"RunStatus",
|
|
"UnsupportedStrategyError",
|
|
"run_agent",
|
|
# serialization
|
|
"serialize",
|
|
"serialize_channel_values",
|
|
"serialize_channel_values_for_api",
|
|
"serialize_lc_object",
|
|
"serialize_messages_tuple",
|
|
"strip_data_url_image_blocks",
|
|
# store
|
|
"get_store",
|
|
"make_store",
|
|
"reset_store",
|
|
"store_context",
|
|
# stream_bridge
|
|
"END_SENTINEL",
|
|
"HEARTBEAT_SENTINEL",
|
|
"MemoryStreamBridge",
|
|
"StreamBridge",
|
|
"StreamEvent",
|
|
"make_stream_bridge",
|
|
]
|