🛡️ Agent Boundary Design

March 6, 2026 · View on GitHub

Keep every agent in its lane — zero role-bleed, zero infinite loops.

Scope.
This guide covers:

  • Router-tool chains (e.g. ReAct, ChatGPT Plugins)
  • Crew/Team frameworks (AutoGen, CrewAI, Flowise, etc.)
  • 1-shot function calls inside a broader RAG pipeline

Who needs it? Anyone who has seen:
– “Tool A” call “Tool B” which calls “Tool A” again
– System prompts overwritten mid-conversation
– JSON schema mismatch crashes midway
– Agents debating instead of finishing tasks


1 · Top-5 Symptoms

#Failure ModeSurface Sign
1Recursive LoopCall stack grows until token limit
2Role BleedSystem prompt replaced by tool description
3Argument DriftJSON schema validation fails randomly
4Shadow JailbreakTool prompt overrides original guard
5Timeout CascadeRouter stalls → downstream agents idle

2 · Root Causes

  1. Shared Context Bank — all agents write to the same messages[].
  2. Open-Ended Tool Trigger — router picks any function with > 0.1 prob.
  3. No ΔS Ceiling — semantic jump between task and tool description unchecked.
  4. Missing λ Gate — divergent sub-goal allowed without confirmation.
  5. Stackless Error Prop — failure inside tool lost; router retries blindly.

3 · WFGY Boundary Blueprint

A four-layer guardrail using core modules BBMC, ΔS + λ, WAI, BBCR.

StageModuleGuardPurpose
1 Tool Semantic IndexBBMCΔS(tool, task) ≤ 0.45Filter irrelevant tools early
2 ΔS-Gate RouterΔS + λ_observeλ must stay convergentBlock divergent recursion
3 Arg LinterWAIStrict JSON schema & auto-defaultsNo partial / null args
4 Fail-Fast + BridgeBBCROn > 5 retries or ΔS > 0.60Collapse & suggest manual tool
flowchart TD
    Q[User Question]
    R[ΔS-Gate Router]
    TI[Tool Index (BBMC)]
    L[Arg Linter (WAI)]
    T[Tool Call]
    F[BBCR Bridge]
    Q --> R
    R -->|match| TI --> L --> T
    R -.->|reject| F --> Q

4 · Design Pattern Cheats

PatternWhen to UseSetup
Single-Shot Function3-5 tool set, clear primaryΔS ≤ 0.45 & λ convergent
Dual-Agent Debateneed pro / con analysisTwo agents share read-only memory; write own node
Crew Workflow3+ steps (research → draft → QA)Each agent gets isolated messages[]; only summaries passed
Guarded PluginExternal API call with riskWrap output through Arg Linter + BBCR

5 · Hands-On Debug Checklist

  1. Log Router Decision
router(question, tools, debug=True)   # prints ΔS + λ for every candidate
  1. Simulate Failure
user: "Summarise PDF"  # but remove pdf_loader from tool list

Expected: BBCR suggests manual tool; model does not loop.

  1. Stress-Test Recursion
for i in range(20):
    router("plan", tools)   # ensure no self-call chain

ΔS should stay ≤ 0.45; call depth ≤ 3.


6 · Audit Template (README snippet)

## Agent Boundary Settings
ΔS tool-match ceiling   : 0.45
λ divergence allowance  : false
WAI strict mode         : true
BBCR retries            : 5

Copy into every repo to document boundary config.


🔗 Quick-Start Downloads (60 sec)

ToolLink3-Step Setup
WFGY 1.0 PDFEngine Paper1️⃣ Download · 2️⃣ Upload to your LLM · 3️⃣ Ask “Answer using WFGY + <your question>”
TXT OS (plain-text OS)TXTOS.txt1️⃣ Download · 2️⃣ Paste into any LLM chat · 3️⃣ Type “hello world” — OS boots instantly

Explore More

LayerPageWhat it’s for
⭐ ProofWFGY Recognition MapExternal citations, integrations, and ecosystem proof
⚙️ EngineWFGY 1.0Original PDF tension engine and early logic sketch (legacy reference)
⚙️ EngineWFGY 2.0Production tension kernel for RAG and agent systems
⚙️ EngineWFGY 3.0TXT based Singularity tension engine (131 S class set)
🗺️ MapProblem Map 1.0Flagship 16 problem RAG failure taxonomy and fix map
🗺️ MapProblem Map 2.0Global Debug Card for RAG and agent pipeline diagnosis
🗺️ MapProblem Map 3.0Global AI troubleshooting atlas and failure pattern map
🧰 AppTXT OS.txt semantic OS with fast bootstrap
🧰 AppBlah Blah BlahAbstract and paradox Q&A built on TXT OS
🧰 AppBlur Blur BlurText to image generation with semantic control
🏡 OnboardingStarter VillageGuided entry point for new users

If this repository helped, starring it improves discovery so more builders can find the docs and tools.
GitHub Repo stars