34 lines
851 B
Python
34 lines
851 B
Python
"""多轮 Agent 调用。不认识 Muse 业务对象。"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Callable, Iterable
|
|
|
|
from framework.adapters.pi.runner import (
|
|
AgentStreamOutcome,
|
|
ExecutionPolicy,
|
|
PiAgentRunner,
|
|
TraceSink,
|
|
)
|
|
from framework.primitives.execution import FrameworkExecutionRequest
|
|
|
|
|
|
def execute_agent(
|
|
request: FrameworkExecutionRequest,
|
|
policy: ExecutionPolicy,
|
|
sink: TraceSink,
|
|
*,
|
|
timeout_seconds: float,
|
|
raw_sink: Callable[[bytes], None] | None = None,
|
|
launcher: Callable[..., Iterable[bytes]] | None = None,
|
|
) -> AgentStreamOutcome:
|
|
"""把通用执行请求交给当前生产宿主适配器。"""
|
|
|
|
return PiAgentRunner(launcher=launcher).run(
|
|
request,
|
|
policy,
|
|
sink,
|
|
timeout_seconds=timeout_seconds,
|
|
raw_sink=raw_sink,
|
|
)
|