mirror of
https://github.com/vxcontrol/pentagi.git
synced 2026-07-21 08:15:23 -04:00
[PR #206] [MERGED] Agent Supervision System and Open Source Model Enhancements #235
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/vxcontrol/pentagi/pull/206
Author: @asdek
Created: 3/15/2026
Status: ✅ Merged
Merged: 3/15/2026
Merged by: @asdek
Base:
master← Head:feature/next_release📝 Commits (10+)
4cddef4chore(deps): bump the npm_and_yarn group across 1 directory with 2 updates1f896a9fix: add iteration cap and repeating escalation to performAgentChain536ea86fix: address review feedback on iteration cap and repeating escalation8701f15fix: isolate detached command context from parent cancellation55aef6atest: add context cancellation tests for detached command isolation1e2cf11Rename mock type to avoid cross-PR symbol collisionfc90e9dtest: add unit tests for repeatingDetector and clearCallArguments0ffe6a4fix: add named test constant and same-name-different-args edge caseafef83ftest: add unit tests for DeepSeek, GLM, Kimi, and Qwen providers7c3d6d6Merge pull request #174 from vxcontrol/dependabot/npm_and_yarn/frontend/npm_and_yarn-8a6d6a6aaf📊 Changes
75 files changed (+6871 additions, -1588 deletions)
View changed files
📝
.env.example(+12 -0)📝
.vscode/launch.json(+1 -1)📝
Dockerfile(+1 -0)📝
README.md(+101 -22)📝
backend/cmd/ftester/mocks/tools.go(+32 -12)📝
backend/cmd/ftester/worker/executor.go(+22 -2)📝
backend/cmd/ftester/worker/tester.go(+4 -1)📝
backend/cmd/installer/wizard/controller/controller.go(+47 -3)📝
backend/cmd/installer/wizard/locale/locale.go(+63 -12)📝
backend/cmd/installer/wizard/models/ai_agents_settings_form.go(+268 -57)📝
backend/docs/config.md(+164 -1)📝
backend/docs/flow_execution.md(+241 -10)📝
backend/go.mod(+5 -2)📝
backend/go.sum(+10 -4)➕
backend/migrations/sql/20260310_153000_agent_supervision.sql(+114 -0)📝
backend/pkg/config/config.go(+72 -0)➕
backend/pkg/config/config_test.go(+259 -0)📝
backend/pkg/database/converter/converter.go(+3 -0)📝
backend/pkg/database/models.go(+39 -36)📝
backend/pkg/graph/generated.go(+217 -16)...and 55 more files
📄 Description
Description of the Change
Problem
Smaller open source models (< 32B parameters) required additional supervision to match cloud API quality. Agents could get stuck in loops or miss optimal attack paths. Vector store searches returned insufficient results due to single-query limitation. Target information leakage in vector memory could cause agents to switch targets mid-attack. No production-grade guide existed for air-gapped deployments with local LLM inference.
Solution
Implemented multi-layered agent supervision system with:
Closes #175, #176
Type of Change
Areas Affected
Testing and Verification
Test Configuration
Test Steps
go test ./...)Test Results
Security Considerations
Enhanced Security:
No New Attack Vectors:
Performance Impact
With Supervision Features Enabled (for models < 32B):
Multi-Query Vector Search:
Infinite Loop Prevention:
vLLM Performance (Qwen3.5-27B-FP8 on 4× RTX 5090):
Documentation Updates
Deployment Notes
New Environment Variables (Optional - Beta Features Disabled by Default):
Database Migrations:
20260310_153000_agent_supervision.sql- Adds supervision-related columns and indexesRecommended Configuration for Open Source Models < 32B:
Enable supervision features for 2x quality improvement:
Configure adviser with enhanced settings (see examples/configs/vllm-qwen3.5-27b-fp8.provider.yml)
Compatibility:
Checklist
Code Quality
go fmtandgo vet(for Go code)npm run lint(for TypeScript/JavaScript code)Security
Compatibility
Documentation
Additional Notes
Key Changes by Category
🤖 Agent Supervision System (New - Beta)
Execution Monitoring (PRs #178, #179, #180):
executionMonitorDetectortracks tool call patterns (same tool: 5, total: 10 thresholds)performMentorinvokes adviser agent for execution analysis<mentor_analysis>and<original_result>sectionsEXECUTION_MONITOR_ENABLED,EXECUTION_MONITOR_SAME_TOOL_LIMIT,EXECUTION_MONITOR_TOTAL_TOOL_LIMITTask Planning:
performPlannergenerates 3-7 step execution plans via adviser in planning modequestion_task_planner.tmplprompt template for structured planningtask_assignment_wrapper.tmplwraps requests with execution plansAGENT_PLANNING_STEP_ENABLEDTool Call Limits:
MAX_GENERAL_AGENT_TOOL_CALLS,MAX_LIMITED_AGENT_TOOL_CALLSPrompt Templates:
question_execution_monitor.tmplfor mentor invocationsquestion_task_planner.tmplfor plan generationtask_assignment_wrapper.tmplfor wrapping specialist requests🧠 Memory System Enhancements
Multi-Query Vector Search:
search_in_memory,search_guide,search_answer,search_codenow support up to 5 simultaneous queriesqueriesarray parameter replaces singlequerystringTarget Anonymization:
memory_utils.gowith IP/domain anonymization functions203.0.113.1→TARGET_IP_1,example.com→TARGET_DOMAIN_1)memory_utils_test.goEnhanced Storage:
🐛 Critical Bug Fixes
Infinite Loop Prevention (PR #178, Closes #175):
performAgentChainmain loopmaxSoftDetectionsBeforeAbortwith sync commentsContext Isolation for Detached Commands (PR #179, Closes #176):
context.WithoutCancel()for detached goroutinesTestExecCommandDetachSurvivesParentCancel,TestExecCommandNonDetachRespectsParentCancel🧪 Test Coverage
Chinese Provider Tests (PR #189):
Repeating Detector Tests (PR #180):
TestRepeatingDetector: 9 cases covering threshold triggering, reset logic, escalationTestRepeatingDetectorEscalationThreshold: validates abort math (threshold + 4 = 7)TestClearCallArguments: message field stripping, key sorting, invalid JSON passthroughConfig Tests:
backend/pkg/config/config_test.gowith supervision settings validation📚 Documentation & Guides
vLLM + Qwen3.5-27B-FP8 Guide (New):
examples/guides/vllm-qwen35-27b-fp8.mdProvider Configurations:
vllm-qwen3.5-27b-fp8.provider.ymlwith optimal sampling parametersvllm-qwen3.5-27b-fp8-no-think.provider.ymlfor faster inference without thinkingConfiguration Documentation:
backend/docs/config.md: New Agent Supervision Settings section with usage details, recommended settings, supervision system integrationbackend/docs/flow_execution.md: Expanded Advanced Agent Supervision section with execution monitoring, task planning, integration diagramsfalsefor beta featuresREADME Updates:
🔧 Installer Enhancements
AI Agents Settings Form Expansion:
createBooleanField,createIntegerField,validateBooleanField,validateIntegerField,formatNumberGetAIAgentsConfig,UpdateAIAgentsConfig,ResetAIAgentsConfigOllama Enhancements:
OLLAMA_SERVER_API_KEYfor Ollama Cloud supportPENTAGI_OLLAMA_DIRvolume configurationmin_pparameter support across all providers📦 Dependencies
langchaingo v0.1.14-update.5:
🎨 Code Quality
ftester Improvements:
Provider Enhancements:
Merged Pull Requests
Issues Addressed
Migration Path
For existing deployments:
git pull origin feature/next_releasedocker compose builddocker compose up -dEXECUTION_MONITOR_ENABLED=trueandAGENT_PLANNING_STEP_ENABLED=truein.envexamples/guides/vllm-qwen35-27b-fp8.mdNo manual intervention required. Existing deployments continue working without changes.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.