docs: staged strategy for scalable HUF agent runs#271
Draft
esafwan wants to merge 2 commits into
Draft
Conversation
esafwan
marked this pull request as draft
July 13, 2026 02:28
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.
Summary
This PR documents a staged, non-breaking strategy to improve HUF agent run scalability. The central change is moving long agent turns away from the web request path and toward queue-first execution, while keeping smaller deployments simple and leaving room for a detached external runner at higher scale.
Why this matters
HUF is not a short-request app. Agent runs can involve long LLM calls, multiple tool calls, and several audit writes across runs, messages, conversations, and tool-call records. If all of that stays on the web request path, concurrent usage can tie up Frappe workers, increase latency, and make the site fragile under bursty load.
Proposed path
now=trueescape hatch for trusted immediate execution.Scale strategies
This is intentionally not a one-size-fits-all model.
Streaming behavior
Streaming should remain available, but the transport changes by execution mode.
run_idquickly, then stream tokens, tool-call updates, status changes, and final output through HUF-owned run events such as Socket.IO or SSE.This keeps chat responsive without holding a Frappe web worker for the full LLM/tool loop.
External runner role
The detached runner is a later scaling option, not the center of this PR. Temporal is a strong candidate for that layer because it provides durable workflows, retries, cancellation, and long-running orchestration outside the web process. The immediate focus remains queue-first execution inside the standard HUF/Frappe deployment path.
Non-breaking principles
What this PR is
Documentation only. No runtime code, schema migration, or behavior change is included here.