Skip to content

symfonic.agent.presented_agent

presented_agent

Opt-in presentation bridge for the public Agent.

Agent.run returns the model's raw reply. The legacy engine returned it with extraction directives and HMS citation tags removed. PresentedAgent wraps any object with the Agent run/stream shape and applies that transformation without changing the default Agent output. The kernel has already stripped complete XML blocks before this adapter runs; for an XML block in mid-text it leaves whitespace differently from legacy, so this is not by itself full visible-output parity for a CLI cutover.

Extraction ops visible to this adapter are handed to on_extraction once per turn; complete XML consumed upstream is not delivered to that hook. This port does not write ops anywhere. Persistence remains a separate concern.

PresentedAgent

PresentedAgent(agent: Any, *, on_extraction: ExtractionHook | None = None)

Wraps an Agent; run/stream return presented text.

Source code in src/symfonic/agent/presented_agent.py
def __init__(self, agent: Any, *, on_extraction: ExtractionHook | None = None) -> None:
    self._agent = agent
    self._on_extraction = on_extraction

stream

stream(prompt: str, **kwargs: Any) -> AsyncIterator[AgentEvent]

Eager like Agent.stream: argument errors raise at the call site.

Source code in src/symfonic/agent/presented_agent.py
def stream(self, prompt: str, **kwargs: Any) -> AsyncIterator[AgentEvent]:
    """Eager like ``Agent.stream``: argument errors raise at the call site."""
    return self._presented_events(self._agent.stream(prompt, **kwargs))