Skip to content

Commit f10b378

Browse files
fix(cli): add local_development.redis_enabled manifest opt-out (MAY-1086)
agentex agents run unconditionally sets REDIS_URL=redis://localhost:6379 in the agent process env. Combined with the module-level RedisStreamRepository instantiated by `from agentex.lib import adk`, this causes silent request hangs for agents that don't use adk.messages/adk.streaming when no local Redis is reachable (e.g. Temporal-direct async agents in restricted dev pods). The lazy redis.asyncio client only fails on first publish, so there is no startup error to point at the misconfiguration. Add an explicit `local_development.redis_enabled: bool = true` flag. Default true preserves existing behavior; users with no local Redis can set false to skip the REDIS_URL default. acp_type is not a reliable discriminator here — the codebase has acp_type=async tutorials that legitimately call adk.messages.create. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 7817ced commit f10b378

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

src/agentex/lib/cli/handlers/run_handlers.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,13 +365,19 @@ def create_agent_environment(manifest: AgentManifest) -> dict[str, str]:
365365
env_vars = {
366366
"ENVIRONMENT": "development",
367367
"TEMPORAL_ADDRESS": "localhost:7233",
368-
"REDIS_URL": "redis://localhost:6379",
369368
"AGENT_NAME": manifest.agent.name,
370369
"ACP_TYPE": manifest.agent.acp_type,
371370
"ACP_URL": f"http://{manifest.local_development.agent.host_address}", # type: ignore[union-attr]
372371
"ACP_PORT": str(manifest.local_development.agent.port), # type: ignore[union-attr]
373372
}
374373

374+
# Gate the default REDIS_URL on an explicit manifest flag. Agents that don't use
375+
# adk.messages/adk.streaming can set local_development.redis_enabled: false to avoid
376+
# the localhost:6379 default, which otherwise causes silent request hangs when no
377+
# local Redis is reachable (MAY-1086).
378+
if manifest.local_development is None or manifest.local_development.redis_enabled:
379+
env_vars["REDIS_URL"] = "redis://localhost:6379"
380+
375381
if manifest.agent.agent_input_type:
376382
env_vars["AGENT_INPUT_TYPE"] = manifest.agent.agent_input_type
377383

src/agentex/lib/sdk/config/local_development_config.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,12 @@ class LocalDevelopmentConfig(BaseModel):
5656
paths: LocalPathsConfig | None = Field(
5757
default=None, description="File paths for local development"
5858
)
59+
redis_enabled: bool = Field(
60+
default=True,
61+
description=(
62+
"Whether the local CLI should set REDIS_URL=redis://localhost:6379 for the "
63+
"agent process. Set to false for agents that don't use adk.messages/adk.streaming "
64+
"when no local Redis is available, to avoid silent request hangs from the lazy "
65+
"Redis client."
66+
),
67+
)

0 commit comments

Comments
 (0)