cd /news/ai-agents/smart-delegation-pipeline-for-ai-age… · home › topics › ai-agents › article
[ARTICLE · art-153614] src=github.com ↗ pub= topic=ai-agents verified=true sentiment=· neutral

Smart delegation pipeline for AI agents (up to 15-20% on costs)

A shared RTK pipeline named laya-delegate cut mean cost per trial 13.9% across 48 SkillsBench trials on Claude Opus 5.5 run on 2026-10-18 and 2026-10-19, with reward unchanged at 0.81, according to self-reported numbers from the pipeline's author that RTK states it does not verify. The pipeline routes write and data tasks to a Haiku Explore sub-agent via a local Laya classifier served at http://127.0.0.1:41733/v1/systemone, and savings ranged from -30% on parallel-tfidf-search ($1.345 to $0.946) to +80% on debug-trl-grpo ($0.185 to $0.333). Across the 48 trials it logged 29 refusals, 28 Haiku sub-agent hand-offs in 24 trials, and 77.5K tokens removed by RTK output filtering, 14% of filtered command output.

read6 min views1 publishedOct 20, 2026
Smart delegation pipeline for AI agents (up to 15-20% on costs)
Image: Michielbdejong (auto-discovered)

Numbers on this card are self-reported by the author's own rtk. rtk verifies nothing.

rtk pipeline add github:aeppling/rtk-pipeline-laya-delegate

rtk shows this pipeline's rules and asks before anything installs, and pins the install to a commit. A pipeline can rewrite the commands your agent runs, filter and replace what it reads, and send content to any upstream it declares — review the rules and install only what you trust. RTK does not review or endorse shared pipelines; the author is responsible for this repo, and you are responsible for what you install.

  • before read — delegate -> bulk-read when file_lines_gt=350, score.need_lte=0.65, whole_file=true
  • before read — delegate -> bulk-read when class.kind_in=["write", "data"], recent_calls_matches='^(Bash|Read|Grep|Glob) [^|]( | (Bash|Read|Grep|Glob) [^|] )?$'
  • before shell — delegate -> investigate when class.kind_in=["write", "data"], command_matches='^(cd [^;&]+(;|&&))?(ls|cat|head|tail|grep|rg|find|tree|pwd|echo|which|wc|file|stat|du|for|while|awk|nl|xxd|git|sed -n)\b', recent_calls_matches='^(Bash|Read|Grep|Glob) [^|] ( | (Bash|Read|Grep|Glob) [^|]*)?$'
  • before shell — rewrite -> rtk
  • after read — compress [lockfile] when basename_in=["package-lock.json", "Cargo.lock", "yarn.lock", "pnpm-lock.yaml"]
  • after shell — compress [term] when is_rtk_command=false
  • after search — compress [matches] when format="matches"
  • after web — compress [web]
  • proxy tool result — compress [ansi, progress, dedup]

No recorded activity yet — run some sessions with this pipeline active, then re-run rtk pipeline share.

#
#
#
#
#
#
schema_version = 1

[pipeline]
name    = "laya-delegate"
extends = ["rtk:posthook", "rtk:delegate-reads"]

[upstream.judge]
provider     = "laya"
model        = "laya"
base_url     = "http://127.0.0.1:41733/v1/systemone"
api_key_env  = "RTK_LAYA_TOKEN"
timeout_secs = 60

[upstream.haiku]
provider     = "anthropic"
model        = "claude-haiku-5-5"
timeout_secs = 90

[classifier.need]
upstream     = "judge"
question     = "score"
instructions = "How much of this file's exact text does the agent need for its next step?"
rubric       = ["none: a short summary is enough", "a few exact lines", "most of the file verbatim"]
input_chars  = 2000

[classifier.kind]
upstream     = "judge"
question     = "choice"
instructions = "What kind of work is this coding task?"
input_chars  = 2000
min_confidence = 0.0

[classifier.kind.labels]
bug   = "find and fix a bug by reading source code closely"
setup = "understand or repair a build, configuration, dependency or environment"
write = "write new code, a script or a port"
data  = "analyse data or files and report results"

[task.investigate]
kind         = "digest"
upstream     = "haiku"
temperature  = 0
context      = true

[task.bulk-read]
kind         = "summarize"
upstream     = "haiku"
temperature  = 0
context      = true
instructions = "You read a file for a coding agent that will NOT see it, only your reply. First answer what the agent needs for its current step, in a few terse lines, with exact identifiers. Then map the file: one line on what it is; every class, function and method with its exact signature, in file order. Then quote verbatim, grouped under the name of the function that contains them, the lines whose exact text the agent would most need for its step (non-obvious arithmetic, constants, conditions, error handling, config values). Never give line numbers. Never paraphrase code you quote. No advice, no headings. End with exactly: (Exact text: grep -n a quoted line, then Read that file with offset and limit, at most 350 lines.)"

[override.shunt-large-read]
enabled = false

[[hook.before_tool.read]]
name   = "answer-big-reads"
when   = { file_lines_gt = 350, whole_file = true, "score.need_lte" = 0.65 }
action = "route"
task   = "bulk-read"
mode   = "answer"

[[directive]]
name = "explore-in-subagent"
text = """
When RTK asks you to hand an investigation to the Explore sub-agent, call it on the haiku model (Agent tool: subagent_type "Explore", model "haiku") with one precise question built from the task, ask it for file paths, line numbers and the exact lines you will need, and work from its report instead of repeating its searches.
"""

[[hook.before_tool.shell]]
name    = "delegate-investigation"
when    = { command_matches = "^(cd [^;&]+(;|&&) *)?(ls|cat|head|tail|grep|rg|find|tree|pwd|echo|which|wc|file|stat|du|for|while|awk|nl|xxd|git|sed -n)\\b", recent_calls_matches = "^(Bash|Read|Grep|Glob) [^|]*( \\| (Bash|Read|Grep|Glob) [^|]*)?$", "class.kind_in" = ["write", "data"] }
action  = "route"
task    = "investigate"
mode    = "suggest"
message = "Do not run this search or open these files yourself: hand the investigation to the Explore sub-agent (Agent tool: subagent_type \"Explore\", model \"haiku\") with one precise question, and ask it for file paths, line numbers and the exact lines you will need. Then work from its report."

[[hook.before_tool.read]]
name    = "delegate-investigation-read"
when    = { recent_calls_matches = "^(Bash|Read|Grep|Glob) [^|]*( \\| (Bash|Read|Grep|Glob) [^|]*)?$", "class.kind_in" = ["write", "data"] }
action  = "route"
task    = "bulk-read"
mode    = "suggest"
message = "Do not run this search or open these files yourself: hand the investigation to the Explore sub-agent (Agent tool: subagent_type \"Explore\", model \"haiku\") with one precise question, and ask it for file paths, line numbers and the exact lines you will need. Then work from its report."

Measured by rtk v1.0.1 on 2026-10-19.

Install this pipeline: rtk pipeline add <url-of-this-card>

── more in #ai-agents 4 stories · sorted by recency
── more on @rtk 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/smart-delegation-pip…] indexed:0 read:6min 2026-10-20 · —