83 lines
2.2 KiB
Python
83 lines
2.2 KiB
Python
"""非流式 Agent 应用层:工具调用闭环编排。
|
|
|
|
入口:
|
|
- ``run_agent_turn`` 执行一轮带工具调用的对话循环
|
|
- ``AgentTurnResult`` 循环产出
|
|
- ``to_ai_provider_tools`` 把 ToolSpec 转成 OpenAI function schema dict
|
|
- ``default_tools`` 返回全部内置工具(依赖司命 + 确认流控风险)
|
|
"""
|
|
|
|
from app.application.agent.agent import (
|
|
Agent,
|
|
AgentConfig,
|
|
AgentState,
|
|
AgentStatus,
|
|
PendingMessageQueue,
|
|
QueueMode,
|
|
)
|
|
from app.application.agent.confirmation import ConfirmationRegistry
|
|
from app.application.agent.extensions import (
|
|
AfterToolCallDecision,
|
|
AgentContext,
|
|
AgentEvent,
|
|
AgentRunContext,
|
|
BeforeToolCallDecision,
|
|
CancellationToken,
|
|
ExtensionRegistry,
|
|
ToolCallContext,
|
|
TurnSnapshot,
|
|
)
|
|
from app.application.agent.prompt_composer import compose_system_messages
|
|
from app.application.agent.python_skills import (
|
|
PythonSkillActivation,
|
|
PythonSkillCatalog,
|
|
PythonSkillDefinition,
|
|
activate_python_skills,
|
|
discover_python_skills,
|
|
)
|
|
from app.application.agent.run_registry import AgentRunRegistry
|
|
from app.application.agent.runtime import AgentTurnResult, run_agent_turn
|
|
from app.application.agent.skill_loader import load_skill_manifests
|
|
from app.application.agent.tasks import (
|
|
next_step_for_tool,
|
|
step_event_payload,
|
|
task_from_deliberative_plan,
|
|
task_plan_payload,
|
|
)
|
|
from app.application.agent.tools import default_tools, to_ai_provider_tools
|
|
|
|
__all__ = [
|
|
"AfterToolCallDecision",
|
|
"Agent",
|
|
"AgentConfig",
|
|
"AgentContext",
|
|
"AgentEvent",
|
|
"AgentRunContext",
|
|
"AgentRunRegistry",
|
|
"AgentState",
|
|
"AgentStatus",
|
|
"AgentTurnResult",
|
|
"BeforeToolCallDecision",
|
|
"CancellationToken",
|
|
"ConfirmationRegistry",
|
|
"ExtensionRegistry",
|
|
"PendingMessageQueue",
|
|
"PythonSkillActivation",
|
|
"PythonSkillCatalog",
|
|
"PythonSkillDefinition",
|
|
"QueueMode",
|
|
"ToolCallContext",
|
|
"TurnSnapshot",
|
|
"activate_python_skills",
|
|
"compose_system_messages",
|
|
"default_tools",
|
|
"discover_python_skills",
|
|
"load_skill_manifests",
|
|
"next_step_for_tool",
|
|
"run_agent_turn",
|
|
"step_event_payload",
|
|
"task_from_deliberative_plan",
|
|
"task_plan_payload",
|
|
"to_ai_provider_tools",
|
|
]
|