Skip to content

Commit 17de6ae

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 d6bcfa0 commit 17de6ae

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

18791879
def to_ag_ui(
18801880
self,
1881-
*,
18821881
# Adapter parameters.
1882+
path: str = '/',
1883+
*,
18831884
tool_prefix: str = '',
18841885
logger: logging.Logger | None = None,
18851886
# Agent.iter parameters
@@ -1900,6 +1901,7 @@ def to_ag_ui(
19001901
19011902
Args:
19021903
logger: Optional logger to use for the adapter.
1904+
path: Path to expose the agent at, defaults to the root path.
19031905
tool_prefix: Optional prefix to add to tool names in the AG-UI.
19041906
19051907
output_type: Custom output type to use for this run, `output_type` may only be used if the agent has no
@@ -1925,6 +1927,7 @@ def to_ag_ui(
19251927

19261928
return agent_to_ag_ui(
19271929
agent=self,
1930+
path=path,
19281931
tool_prefix=tool_prefix,
19291932
logger=logger,
19301933
# Agent.iter parameters

0 commit comments

Comments
 (0)