[WIP] feat: configurable worker sticky-cache + event-delivery metric#468
Draft
NiteshDhanpal wants to merge 2 commits into
Draft
[WIP] feat: configurable worker sticky-cache + event-delivery metric#468NiteshDhanpal wants to merge 2 commits into
NiteshDhanpal wants to merge 2 commits into
Conversation
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>
…ts.delivery) event/send is accepted and acked by the ACP server before the Temporal signal is attempted, so an HTTP success does not mean the event reached a live workflow. Add an agentex.events.delivery counter tagged with an outcome label (delivered / no_live_workflow / error) and record it around send_signal in TemporalTaskService.send_event. no_live_workflow (RPCError NOT_FOUND) captures events that arrived after the task completed or idle-timed-out. Recording is best-effort and gated on AGENTEX_EVENT_METRICS; behaviour is otherwise unchanged (send_event still raises). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Two independent, load-test-driven changes to the Temporal worker path:
**
feat(temporal): exposemax_cached_workflowsonAgentexWorker** The sticky workflow-cache size was hardcoded to the temporalio default (1000/worker) and not surfaced. Add amax_cached_workflowsparam (default **1000**, unchanged) and pass it intoWorker(...)`. No behaviour change for existing agents.**
feat(observability):agentex.events.deliverycounter**event/sendis accepted + acked by the ACP server **before** the Temporal signal is attempted, so HTTP success does not mean the event reached a live workflow. New counter tagged withoutcome(delivered/no_live_workflow/error), recorded aroundsend_signalinTemporalTaskService.send_event.no_live_workflow=RPCError/NOT_FOUND(task already completed or idle-timed-out). Best-effort, gated onAGENTEX_EVENT_METRICS;send_event` still raises as before.Why
A rocket-mock-async-agent load test showed 61% sticky-cache miss / 618k forced evictions → constant workflow replay, and the only "event success" signal was the ACP server's accept log (which hides events that never reached a live workflow). These two changes make the cache tunable and give a true delivery metric.
Verify (Mimir; OTLP →
_total, dots→underscores)Note
Paired with
agentex-agentsPR (raises this agent'smax_cached_workflows/activity limits) — this SDK PR should merge first, sincemax_cached_workflowsisn't a validAgentexWorkerkwarg until then.🤖 Generated with Claude Code