Skip to content

Commit 1562b9f

Browse files
committed
feat(ag-ui): expose agent path in adapter
Allow the agent path to be specified when using to_ag_ui.
1 parent 97368c4 commit 1562b9f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pydantic_ai_slim/pydantic_ai/agent.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1846,8 +1846,9 @@ async def run_mcp_servers(
18461846

18471847
def to_ag_ui(
18481848
self,
1849-
*,
18501849
# Adapter parameters.
1850+
path: str = '/',
1851+
*,
18511852
tool_prefix: str = '',
18521853
logger: logging.Logger | None = None,
18531854
# Agent.iter parameters
@@ -1868,6 +1869,7 @@ def to_ag_ui(
18681869
18691870
Args:
18701871
logger: Optional logger to use for the adapter.
1872+
path: Path to expose the agent at, defaults to the root path.
18711873
tool_prefix: Optional prefix to add to tool names in the AG-UI.
18721874
18731875
output_type: Custom output type to use for this run, `output_type` may only be used if the agent has no
@@ -1893,6 +1895,7 @@ def to_ag_ui(
18931895

18941896
return agent_to_ag_ui(
18951897
agent=self,
1898+
path=path,
18961899
tool_prefix=tool_prefix,
18971900
logger=logger,
18981901
# Agent.iter parameters

0 commit comments

Comments
 (0)