Skip to content

symfonic.agent.facade_dispatch

facade_dispatch

The one non-streaming facade dispatch path.

dispatch async

dispatch(kernel: Any, prepare: Callable[[str, type[BaseModel] | None], InvocationPlan], request: TurnRequest, output_type: type[BaseModel] | None) -> AgentResult[Any]

Prepare once and send every non-streaming request through the kernel.

Source code in src/symfonic/agent/facade_dispatch.py
async def dispatch(
    kernel: Any,
    prepare: Callable[[str, type[BaseModel] | None], InvocationPlan],
    request: TurnRequest,
    output_type: type[BaseModel] | None,
) -> AgentResult[Any]:
    """Prepare once and send every non-streaming request through the kernel."""
    return await kernel.run(prepare(request.prompt, output_type), request)

stream

stream(kernel: Any, prepare: Callable[[str, type[BaseModel] | None], InvocationPlan], request: TurnRequest, output_type: type[BaseModel] | None) -> AsyncIterator[AgentEvent]

Prepare once and hand the request to the shared streaming kernel.

Source code in src/symfonic/agent/facade_dispatch.py
def stream(
    kernel: Any,
    prepare: Callable[[str, type[BaseModel] | None], InvocationPlan],
    request: TurnRequest,
    output_type: type[BaseModel] | None,
) -> AsyncIterator[AgentEvent]:
    """Prepare once and hand the request to the shared streaming kernel."""
    return kernel.stream(prepare(request.prompt, output_type), request)