2025-12-11 19:09:10 +08:00
|
|
|
|
"""
|
|
|
|
|
|
DeepAudit Agent 服务模块
|
2025-12-25 17:58:14 +08:00
|
|
|
|
基于动态 Agent 树架构的 AI 代码安全审计
|
2025-12-11 19:09:10 +08:00
|
|
|
|
|
2025-12-25 17:58:14 +08:00
|
|
|
|
架构:
|
|
|
|
|
|
- OrchestratorAgent 作为编排层,动态调度子 Agent
|
|
|
|
|
|
- ReconAgent 负责侦察和文件分析
|
|
|
|
|
|
- AnalysisAgent 负责漏洞分析
|
|
|
|
|
|
- VerificationAgent 负责验证发现
|
feat(agent): implement comprehensive agent architecture with knowledge base and persistence layer
- Add database migrations for agent checkpoints and tree node tracking
- Implement core agent execution framework with executor, state management, and message handling
- Create knowledge base system with framework-specific modules (Django, FastAPI, Flask, Express, React, Supabase)
- Add vulnerability knowledge modules covering authentication, cryptography, injection, XSS, XXE, SSRF, path traversal, deserialization, and race conditions
- Introduce new agent tools: thinking tool, reporting tool, and agent-specific utilities
- Implement LLM memory compression and prompt caching for improved performance
- Add agent registry and persistence layer for checkpoint management
- Refactor agent implementations (analysis, recon, verification, orchestrator) with enhanced capabilities
- Remove legacy agent implementations (analysis_v2, react_agent)
- Update API endpoints for agent task creation and project management
- Add frontend components for agent task creation and enhanced audit UI
- Consolidate agent service architecture with improved separation of concerns
- This refactoring provides a scalable foundation for multi-agent collaboration with knowledge-driven decision making and state persistence
2025-12-12 15:27:12 +08:00
|
|
|
|
|
|
|
|
|
|
工作流:
|
2025-12-25 17:58:14 +08:00
|
|
|
|
START → Orchestrator → [Recon/Analysis/Verification] → Report → END
|
|
|
|
|
|
|
feat(agent): implement comprehensive agent architecture with knowledge base and persistence layer
- Add database migrations for agent checkpoints and tree node tracking
- Implement core agent execution framework with executor, state management, and message handling
- Create knowledge base system with framework-specific modules (Django, FastAPI, Flask, Express, React, Supabase)
- Add vulnerability knowledge modules covering authentication, cryptography, injection, XSS, XXE, SSRF, path traversal, deserialization, and race conditions
- Introduce new agent tools: thinking tool, reporting tool, and agent-specific utilities
- Implement LLM memory compression and prompt caching for improved performance
- Add agent registry and persistence layer for checkpoint management
- Refactor agent implementations (analysis, recon, verification, orchestrator) with enhanced capabilities
- Remove legacy agent implementations (analysis_v2, react_agent)
- Update API endpoints for agent task creation and project management
- Add frontend components for agent task creation and enhanced audit UI
- Consolidate agent service architecture with improved separation of concerns
- This refactoring provides a scalable foundation for multi-agent collaboration with knowledge-driven decision making and state persistence
2025-12-12 15:27:12 +08:00
|
|
|
|
支持动态创建子Agent进行专业化分析
|
2025-12-11 19:09:10 +08:00
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
# 事件管理
|
|
|
|
|
|
from .event_manager import EventManager, AgentEventEmitter
|
|
|
|
|
|
|
|
|
|
|
|
# Agent 类
|
|
|
|
|
|
from .agents import (
|
|
|
|
|
|
BaseAgent, AgentConfig, AgentResult,
|
|
|
|
|
|
OrchestratorAgent, ReconAgent, AnalysisAgent, VerificationAgent,
|
|
|
|
|
|
)
|
|
|
|
|
|
|
2025-12-25 17:58:14 +08:00
|
|
|
|
# 核心模块(状态管理、注册表、消息)
|
feat(agent): implement comprehensive agent architecture with knowledge base and persistence layer
- Add database migrations for agent checkpoints and tree node tracking
- Implement core agent execution framework with executor, state management, and message handling
- Create knowledge base system with framework-specific modules (Django, FastAPI, Flask, Express, React, Supabase)
- Add vulnerability knowledge modules covering authentication, cryptography, injection, XSS, XXE, SSRF, path traversal, deserialization, and race conditions
- Introduce new agent tools: thinking tool, reporting tool, and agent-specific utilities
- Implement LLM memory compression and prompt caching for improved performance
- Add agent registry and persistence layer for checkpoint management
- Refactor agent implementations (analysis, recon, verification, orchestrator) with enhanced capabilities
- Remove legacy agent implementations (analysis_v2, react_agent)
- Update API endpoints for agent task creation and project management
- Add frontend components for agent task creation and enhanced audit UI
- Consolidate agent service architecture with improved separation of concerns
- This refactoring provides a scalable foundation for multi-agent collaboration with knowledge-driven decision making and state persistence
2025-12-12 15:27:12 +08:00
|
|
|
|
from .core import (
|
|
|
|
|
|
AgentState, AgentStatus,
|
|
|
|
|
|
AgentRegistry, agent_registry,
|
|
|
|
|
|
AgentMessage, MessageType, MessagePriority, MessageBus,
|
|
|
|
|
|
)
|
|
|
|
|
|
|
2025-12-25 17:58:14 +08:00
|
|
|
|
# 知识模块系统(基于RAG)
|
feat(agent): implement comprehensive agent architecture with knowledge base and persistence layer
- Add database migrations for agent checkpoints and tree node tracking
- Implement core agent execution framework with executor, state management, and message handling
- Create knowledge base system with framework-specific modules (Django, FastAPI, Flask, Express, React, Supabase)
- Add vulnerability knowledge modules covering authentication, cryptography, injection, XSS, XXE, SSRF, path traversal, deserialization, and race conditions
- Introduce new agent tools: thinking tool, reporting tool, and agent-specific utilities
- Implement LLM memory compression and prompt caching for improved performance
- Add agent registry and persistence layer for checkpoint management
- Refactor agent implementations (analysis, recon, verification, orchestrator) with enhanced capabilities
- Remove legacy agent implementations (analysis_v2, react_agent)
- Update API endpoints for agent task creation and project management
- Add frontend components for agent task creation and enhanced audit UI
- Consolidate agent service architecture with improved separation of concerns
- This refactoring provides a scalable foundation for multi-agent collaboration with knowledge-driven decision making and state persistence
2025-12-12 15:27:12 +08:00
|
|
|
|
from .knowledge import (
|
|
|
|
|
|
KnowledgeLoader, knowledge_loader,
|
|
|
|
|
|
get_available_modules, get_module_content,
|
|
|
|
|
|
SecurityKnowledgeRAG, security_knowledge_rag,
|
|
|
|
|
|
SecurityKnowledgeQueryTool, GetVulnerabilityKnowledgeTool,
|
|
|
|
|
|
)
|
|
|
|
|
|
|
2025-12-25 17:58:14 +08:00
|
|
|
|
# 协作工具
|
feat(agent): implement comprehensive agent architecture with knowledge base and persistence layer
- Add database migrations for agent checkpoints and tree node tracking
- Implement core agent execution framework with executor, state management, and message handling
- Create knowledge base system with framework-specific modules (Django, FastAPI, Flask, Express, React, Supabase)
- Add vulnerability knowledge modules covering authentication, cryptography, injection, XSS, XXE, SSRF, path traversal, deserialization, and race conditions
- Introduce new agent tools: thinking tool, reporting tool, and agent-specific utilities
- Implement LLM memory compression and prompt caching for improved performance
- Add agent registry and persistence layer for checkpoint management
- Refactor agent implementations (analysis, recon, verification, orchestrator) with enhanced capabilities
- Remove legacy agent implementations (analysis_v2, react_agent)
- Update API endpoints for agent task creation and project management
- Add frontend components for agent task creation and enhanced audit UI
- Consolidate agent service architecture with improved separation of concerns
- This refactoring provides a scalable foundation for multi-agent collaboration with knowledge-driven decision making and state persistence
2025-12-12 15:27:12 +08:00
|
|
|
|
from .tools import (
|
|
|
|
|
|
ThinkTool, ReflectTool,
|
|
|
|
|
|
CreateVulnerabilityReportTool,
|
2025-12-13 12:35:03 +08:00
|
|
|
|
FinishScanTool,
|
feat(agent): implement comprehensive agent architecture with knowledge base and persistence layer
- Add database migrations for agent checkpoints and tree node tracking
- Implement core agent execution framework with executor, state management, and message handling
- Create knowledge base system with framework-specific modules (Django, FastAPI, Flask, Express, React, Supabase)
- Add vulnerability knowledge modules covering authentication, cryptography, injection, XSS, XXE, SSRF, path traversal, deserialization, and race conditions
- Introduce new agent tools: thinking tool, reporting tool, and agent-specific utilities
- Implement LLM memory compression and prompt caching for improved performance
- Add agent registry and persistence layer for checkpoint management
- Refactor agent implementations (analysis, recon, verification, orchestrator) with enhanced capabilities
- Remove legacy agent implementations (analysis_v2, react_agent)
- Update API endpoints for agent task creation and project management
- Add frontend components for agent task creation and enhanced audit UI
- Consolidate agent service architecture with improved separation of concerns
- This refactoring provides a scalable foundation for multi-agent collaboration with knowledge-driven decision making and state persistence
2025-12-12 15:27:12 +08:00
|
|
|
|
CreateSubAgentTool, SendMessageTool, ViewAgentGraphTool,
|
|
|
|
|
|
WaitForMessageTool, AgentFinishTool,
|
|
|
|
|
|
)
|
|
|
|
|
|
|
2025-12-25 17:58:14 +08:00
|
|
|
|
# 遥测模块
|
2025-12-13 12:35:03 +08:00
|
|
|
|
from .telemetry import Tracer, get_global_tracer, set_global_tracer
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-12-11 19:09:10 +08:00
|
|
|
|
__all__ = [
|
|
|
|
|
|
# 事件管理
|
|
|
|
|
|
"EventManager",
|
|
|
|
|
|
"AgentEventEmitter",
|
2025-12-25 17:58:14 +08:00
|
|
|
|
|
2025-12-11 19:09:10 +08:00
|
|
|
|
# Agent 类
|
|
|
|
|
|
"BaseAgent",
|
|
|
|
|
|
"AgentConfig",
|
|
|
|
|
|
"AgentResult",
|
|
|
|
|
|
"OrchestratorAgent",
|
|
|
|
|
|
"ReconAgent",
|
|
|
|
|
|
"AnalysisAgent",
|
|
|
|
|
|
"VerificationAgent",
|
2025-12-25 17:58:14 +08:00
|
|
|
|
|
|
|
|
|
|
# 核心模块
|
feat(agent): implement comprehensive agent architecture with knowledge base and persistence layer
- Add database migrations for agent checkpoints and tree node tracking
- Implement core agent execution framework with executor, state management, and message handling
- Create knowledge base system with framework-specific modules (Django, FastAPI, Flask, Express, React, Supabase)
- Add vulnerability knowledge modules covering authentication, cryptography, injection, XSS, XXE, SSRF, path traversal, deserialization, and race conditions
- Introduce new agent tools: thinking tool, reporting tool, and agent-specific utilities
- Implement LLM memory compression and prompt caching for improved performance
- Add agent registry and persistence layer for checkpoint management
- Refactor agent implementations (analysis, recon, verification, orchestrator) with enhanced capabilities
- Remove legacy agent implementations (analysis_v2, react_agent)
- Update API endpoints for agent task creation and project management
- Add frontend components for agent task creation and enhanced audit UI
- Consolidate agent service architecture with improved separation of concerns
- This refactoring provides a scalable foundation for multi-agent collaboration with knowledge-driven decision making and state persistence
2025-12-12 15:27:12 +08:00
|
|
|
|
"AgentState",
|
|
|
|
|
|
"AgentStatus",
|
|
|
|
|
|
"AgentRegistry",
|
|
|
|
|
|
"agent_registry",
|
|
|
|
|
|
"AgentMessage",
|
|
|
|
|
|
"MessageType",
|
|
|
|
|
|
"MessagePriority",
|
|
|
|
|
|
"MessageBus",
|
2025-12-25 17:58:14 +08:00
|
|
|
|
|
|
|
|
|
|
# 知识模块(基于RAG)
|
feat(agent): implement comprehensive agent architecture with knowledge base and persistence layer
- Add database migrations for agent checkpoints and tree node tracking
- Implement core agent execution framework with executor, state management, and message handling
- Create knowledge base system with framework-specific modules (Django, FastAPI, Flask, Express, React, Supabase)
- Add vulnerability knowledge modules covering authentication, cryptography, injection, XSS, XXE, SSRF, path traversal, deserialization, and race conditions
- Introduce new agent tools: thinking tool, reporting tool, and agent-specific utilities
- Implement LLM memory compression and prompt caching for improved performance
- Add agent registry and persistence layer for checkpoint management
- Refactor agent implementations (analysis, recon, verification, orchestrator) with enhanced capabilities
- Remove legacy agent implementations (analysis_v2, react_agent)
- Update API endpoints for agent task creation and project management
- Add frontend components for agent task creation and enhanced audit UI
- Consolidate agent service architecture with improved separation of concerns
- This refactoring provides a scalable foundation for multi-agent collaboration with knowledge-driven decision making and state persistence
2025-12-12 15:27:12 +08:00
|
|
|
|
"KnowledgeLoader",
|
|
|
|
|
|
"knowledge_loader",
|
|
|
|
|
|
"get_available_modules",
|
|
|
|
|
|
"get_module_content",
|
|
|
|
|
|
"SecurityKnowledgeRAG",
|
|
|
|
|
|
"security_knowledge_rag",
|
|
|
|
|
|
"SecurityKnowledgeQueryTool",
|
|
|
|
|
|
"GetVulnerabilityKnowledgeTool",
|
2025-12-25 17:58:14 +08:00
|
|
|
|
|
|
|
|
|
|
# 协作工具
|
feat(agent): implement comprehensive agent architecture with knowledge base and persistence layer
- Add database migrations for agent checkpoints and tree node tracking
- Implement core agent execution framework with executor, state management, and message handling
- Create knowledge base system with framework-specific modules (Django, FastAPI, Flask, Express, React, Supabase)
- Add vulnerability knowledge modules covering authentication, cryptography, injection, XSS, XXE, SSRF, path traversal, deserialization, and race conditions
- Introduce new agent tools: thinking tool, reporting tool, and agent-specific utilities
- Implement LLM memory compression and prompt caching for improved performance
- Add agent registry and persistence layer for checkpoint management
- Refactor agent implementations (analysis, recon, verification, orchestrator) with enhanced capabilities
- Remove legacy agent implementations (analysis_v2, react_agent)
- Update API endpoints for agent task creation and project management
- Add frontend components for agent task creation and enhanced audit UI
- Consolidate agent service architecture with improved separation of concerns
- This refactoring provides a scalable foundation for multi-agent collaboration with knowledge-driven decision making and state persistence
2025-12-12 15:27:12 +08:00
|
|
|
|
"ThinkTool",
|
|
|
|
|
|
"ReflectTool",
|
|
|
|
|
|
"CreateVulnerabilityReportTool",
|
2025-12-13 12:35:03 +08:00
|
|
|
|
"FinishScanTool",
|
feat(agent): implement comprehensive agent architecture with knowledge base and persistence layer
- Add database migrations for agent checkpoints and tree node tracking
- Implement core agent execution framework with executor, state management, and message handling
- Create knowledge base system with framework-specific modules (Django, FastAPI, Flask, Express, React, Supabase)
- Add vulnerability knowledge modules covering authentication, cryptography, injection, XSS, XXE, SSRF, path traversal, deserialization, and race conditions
- Introduce new agent tools: thinking tool, reporting tool, and agent-specific utilities
- Implement LLM memory compression and prompt caching for improved performance
- Add agent registry and persistence layer for checkpoint management
- Refactor agent implementations (analysis, recon, verification, orchestrator) with enhanced capabilities
- Remove legacy agent implementations (analysis_v2, react_agent)
- Update API endpoints for agent task creation and project management
- Add frontend components for agent task creation and enhanced audit UI
- Consolidate agent service architecture with improved separation of concerns
- This refactoring provides a scalable foundation for multi-agent collaboration with knowledge-driven decision making and state persistence
2025-12-12 15:27:12 +08:00
|
|
|
|
"CreateSubAgentTool",
|
|
|
|
|
|
"SendMessageTool",
|
|
|
|
|
|
"ViewAgentGraphTool",
|
|
|
|
|
|
"WaitForMessageTool",
|
|
|
|
|
|
"AgentFinishTool",
|
2025-12-25 17:58:14 +08:00
|
|
|
|
|
|
|
|
|
|
# 遥测模块
|
2025-12-13 12:35:03 +08:00
|
|
|
|
"Tracer",
|
|
|
|
|
|
"get_global_tracer",
|
|
|
|
|
|
"set_global_tracer",
|
2025-12-11 19:09:10 +08:00
|
|
|
|
]
|