Skip to content

Commit c2282f9

Browse files
authored
cli: add current path to sys.path (#1703)
1 parent 3bc5219 commit c2282f9

File tree

1 file changed

+4
-0
lines changed
  • pydantic_ai_slim/pydantic_ai

1 file changed

+4
-0
lines changed

pydantic_ai_slim/pydantic_ai/_cli.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import argparse
44
import asyncio
55
import importlib
6+
import os
67
import sys
78
from asyncio import CancelledError
89
from collections.abc import Sequence
@@ -167,6 +168,9 @@ def cli(args_list: Sequence[str] | None = None, *, prog_name: str = 'pai') -> in
167168
agent: Agent[None, str] = cli_agent
168169
if args.agent:
169170
try:
171+
current_path = os.getcwd()
172+
sys.path.append(current_path)
173+
170174
module_path, variable_name = args.agent.split(':')
171175
module = importlib.import_module(module_path)
172176
agent = getattr(module, variable_name)

0 commit comments

Comments
 (0)