Skip to content

Commit 2338408

Browse files
NiteshDhanpalclaude
andcommitted
feat(temporal): expose max_cached_workflows on AgentexWorker
Add a max_cached_workflows parameter (default 1000, unchanged) to AgentexWorker and pass it through to the temporalio Worker. The sticky workflow-cache size was previously not configurable, so agents with many concurrent long-lived workflows (e.g. ones that park waiting for events) could not raise it above the SDK default, causing heavy sticky-cache eviction and constant workflow replay under load. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 3c7015e commit 2338408

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

  • src/agentex/lib/core/temporal/workers

src/agentex/lib/core/temporal/workers/worker.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ def __init__(
151151
task_queue,
152152
max_workers: int = 10,
153153
max_concurrent_activities: int = 10,
154+
max_cached_workflows: int = 1000,
154155
health_check_port: int | None = None,
155156
plugins: list = [],
156157
interceptors: list = [],
@@ -162,6 +163,7 @@ def __init__(
162163
self.activity_handles = []
163164
self.max_workers = max_workers
164165
self.max_concurrent_activities = max_concurrent_activities
166+
self.max_cached_workflows = max_cached_workflows
165167
self.health_check_server_running = False
166168
self.healthy = False
167169
self.health_check_port = (
@@ -227,6 +229,7 @@ async def run(
227229
activities=activities,
228230
workflow_runner=UnsandboxedWorkflowRunner(),
229231
max_concurrent_activities=self.max_concurrent_activities,
232+
max_cached_workflows=self.max_cached_workflows,
230233
build_id=str(uuid.uuid4()),
231234
debug_mode=debug_enabled, # Disable deadlock detection in debug mode
232235
interceptors=self.interceptors, # Pass interceptors to Worker

0 commit comments

Comments
 (0)