Skip to content

Commit 3ed53ff

Browse files
committed
Fix interrupt on tools
1 parent 4aef884 commit 3ed53ff

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

backend/app/api/runs.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from sse_starlette import EventSourceResponse
1414

1515
from app.auth.handlers import AuthedUser
16-
from app.storage import get_thread
16+
from app.storage import get_assistant, get_thread
1717
from app.lifespan import get_langserve
1818

1919
router = APIRouter()
@@ -50,6 +50,9 @@ async def stream_run(
5050
thread = await get_thread(user["user_id"], payload.thread_id)
5151
if not thread:
5252
raise HTTPException(status_code=404, detail="Thread not found")
53+
assistant = await get_assistant(user["user_id"], thread["assistant_id"])
54+
if not assistant:
55+
raise HTTPException(status_code=404, detail="Assistant not found")
5356

5457
return EventSourceResponse(
5558
(
@@ -60,6 +63,11 @@ async def stream_run(
6063
input=payload.input,
6164
config=payload.config,
6265
stream_mode="messages",
66+
interrupt_before=["action"]
67+
if assistant["config"]["configurable"].get(
68+
"type==agent/interrupt_before_action"
69+
)
70+
else None,
6371
)
6472
)
6573
)

0 commit comments

Comments
 (0)