2025-12-11 19:09:10 +08:00
|
|
|
|
"""
|
|
|
|
|
|
DeepAudit Agent 服务模块
|
|
|
|
|
|
基于 LangGraph 的 AI Agent 代码安全审计
|
|
|
|
|
|
|
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树结构
|
|
|
|
|
|
- 专业知识模块系统
|
|
|
|
|
|
- Agent间通信机制
|
|
|
|
|
|
- 完整状态管理
|
|
|
|
|
|
- Think工具和漏洞报告工具
|
|
|
|
|
|
|
|
|
|
|
|
工作流:
|
2025-12-11 19:09:10 +08:00
|
|
|
|
START → 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
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
# 从 graph 模块导入主要组件
|
|
|
|
|
|
from .graph import (
|
|
|
|
|
|
AgentRunner,
|
|
|
|
|
|
run_agent_task,
|
|
|
|
|
|
LLMService,
|
|
|
|
|
|
AuditState,
|
|
|
|
|
|
create_audit_graph,
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
# 事件管理
|
|
|
|
|
|
from .event_manager import EventManager, AgentEventEmitter
|
|
|
|
|
|
|
|
|
|
|
|
# Agent 类
|
|
|
|
|
|
from .agents import (
|
|
|
|
|
|
BaseAgent, AgentConfig, AgentResult,
|
|
|
|
|
|
OrchestratorAgent, 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
|
|
|
|
# 🔥 新增:核心模块(状态管理、注册表、消息)
|
|
|
|
|
|
from .core import (
|
|
|
|
|
|
AgentState, AgentStatus,
|
|
|
|
|
|
AgentRegistry, agent_registry,
|
|
|
|
|
|
AgentMessage, MessageType, MessagePriority, MessageBus,
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
# 🔥 新增:知识模块系统(基于RAG)
|
|
|
|
|
|
from .knowledge import (
|
|
|
|
|
|
KnowledgeLoader, knowledge_loader,
|
|
|
|
|
|
get_available_modules, get_module_content,
|
|
|
|
|
|
SecurityKnowledgeRAG, security_knowledge_rag,
|
|
|
|
|
|
SecurityKnowledgeQueryTool, GetVulnerabilityKnowledgeTool,
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
# 🔥 新增:协作工具
|
|
|
|
|
|
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-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__ = [
|
|
|
|
|
|
# 核心 Runner
|
|
|
|
|
|
"AgentRunner",
|
|
|
|
|
|
"run_agent_task",
|
|
|
|
|
|
"LLMService",
|
|
|
|
|
|
|
|
|
|
|
|
# LangGraph
|
|
|
|
|
|
"AuditState",
|
|
|
|
|
|
"create_audit_graph",
|
|
|
|
|
|
|
|
|
|
|
|
# 事件管理
|
|
|
|
|
|
"EventManager",
|
|
|
|
|
|
"AgentEventEmitter",
|
|
|
|
|
|
|
|
|
|
|
|
# Agent 类
|
|
|
|
|
|
"BaseAgent",
|
|
|
|
|
|
"AgentConfig",
|
|
|
|
|
|
"AgentResult",
|
|
|
|
|
|
"OrchestratorAgent",
|
|
|
|
|
|
"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
|
|
|
|
|
|
|
|
|
|
# 🔥 核心模块
|
|
|
|
|
|
"AgentState",
|
|
|
|
|
|
"AgentStatus",
|
|
|
|
|
|
"AgentRegistry",
|
|
|
|
|
|
"agent_registry",
|
|
|
|
|
|
"AgentMessage",
|
|
|
|
|
|
"MessageType",
|
|
|
|
|
|
"MessagePriority",
|
|
|
|
|
|
"MessageBus",
|
|
|
|
|
|
|
|
|
|
|
|
# 🔥 知识模块(基于RAG)
|
|
|
|
|
|
"KnowledgeLoader",
|
|
|
|
|
|
"knowledge_loader",
|
|
|
|
|
|
"get_available_modules",
|
|
|
|
|
|
"get_module_content",
|
|
|
|
|
|
"SecurityKnowledgeRAG",
|
|
|
|
|
|
"security_knowledge_rag",
|
|
|
|
|
|
"SecurityKnowledgeQueryTool",
|
|
|
|
|
|
"GetVulnerabilityKnowledgeTool",
|
|
|
|
|
|
|
|
|
|
|
|
# 🔥 协作工具
|
|
|
|
|
|
"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-13 12:35:03 +08:00
|
|
|
|
|
|
|
|
|
|
# 🔥 遥测模块
|
|
|
|
|
|
"Tracer",
|
|
|
|
|
|
"get_global_tracer",
|
|
|
|
|
|
"set_global_tracer",
|
2025-12-11 19:09:10 +08:00
|
|
|
|
]
|
|
|
|
|
|
|