geo/backend/app/agent_framework/__init__.py

92 lines
2.5 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""GEO AI Agent 框架
架构说明:
- 框架核心能力来自 fischer-agentkit 包pip 依赖)
- 旧框架文件base.py, dispatcher.py 等)保留作为兼容层
- 新 Agent 通过 YAML 配置 + ConfigDrivenAgent 创建
- 旧 Agent 类逐步迁移为薄适配层
推荐使用方式:
from agentkit.core.config_driven import ConfigDrivenAgent # 新方式
from app.agent_framework import get_agent_registry # 适配入口
"""
# ---- 旧框架兼容导出(保持现有代码不 break----
from app.agent_framework.base import BaseAgent
from app.agent_framework.config_manager import AgentConfigManager
from app.agent_framework.dispatcher import TaskDispatcher
from app.agent_framework.exceptions import (
AgentAlreadyRegisteredError,
AgentFrameworkError,
AgentNotFoundError,
AgentNotReadyError,
AgentUnavailableError,
ConfigValidationError,
NoAvailableAgentError,
TaskCancelledError,
TaskDispatchError,
TaskExecutionError,
TaskNotFoundError,
TaskTimeoutError,
)
from app.agent_framework.protocol import (
AgentCapability,
AgentStatus,
AgentType,
TaskMessage,
TaskProgress,
TaskResult,
TaskStatus,
)
from app.agent_framework.registry import AgentRegistry
# ---- agentkit 框架导出(新方式)----
from agentkit.core.config_driven import AgentConfig, ConfigDrivenAgent
from agentkit.tools.function_tool import FunctionTool
from agentkit.tools.registry import ToolRegistry
# ---- 业务适配入口 ----
from app.agent_framework.adapter import (
create_agents_from_configs,
get_agent_registry,
get_task_dispatcher,
)
__all__ = [
# Core (旧框架兼容)
"BaseAgent",
"AgentRegistry",
"TaskDispatcher",
"AgentConfigManager",
# Protocol (旧框架兼容)
"AgentCapability",
"AgentType",
"AgentStatus",
"TaskMessage",
"TaskProgress",
"TaskResult",
"TaskStatus",
# Exceptions (旧框架兼容)
"AgentFrameworkError",
"AgentNotFoundError",
"AgentAlreadyRegisteredError",
"AgentUnavailableError",
"AgentNotReadyError",
"TaskNotFoundError",
"TaskDispatchError",
"TaskExecutionError",
"TaskTimeoutError",
"TaskCancelledError",
"NoAvailableAgentError",
"ConfigValidationError",
# agentkit 新方式
"AgentConfig",
"ConfigDrivenAgent",
"FunctionTool",
"ToolRegistry",
# 业务适配入口
"create_agents_from_configs",
"get_agent_registry",
"get_task_dispatcher",
]