Skip to content

Commit 82c5fee

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 0ff3a7f commit 82c5fee

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
@@ -1858,8 +1858,9 @@ async def run_mcp_servers(
18581858

18591859
def to_ag_ui(
18601860
self,
1861-
*,
18621861
# Adapter parameters.
1862+
path: str = '/',
1863+
*,
18631864
tool_prefix: str = '',
18641865
logger: logging.Logger | None = None,
18651866
# Agent.iter parameters
@@ -1880,6 +1881,7 @@ def to_ag_ui(
18801881
18811882
Args:
18821883
logger: Optional logger to use for the adapter.
1884+
path: Path to expose the agent at, defaults to the root path.
18831885
tool_prefix: Optional prefix to add to tool names in the AG-UI.
18841886
18851887
output_type: Custom output type to use for this run, `output_type` may only be used if the agent has no
@@ -1905,6 +1907,7 @@ def to_ag_ui(
19051907

19061908
return agent_to_ag_ui(
19071909
agent=self,
1910+
path=path,
19081911
tool_prefix=tool_prefix,
19091912
logger=logger,
19101913
# Agent.iter parameters

0 commit comments

Comments
 (0)