diff --git a/backend/app/api/runs.py b/backend/app/api/runs.py index 666b40a6..00e05343 100644 --- a/backend/app/api/runs.py +++ b/backend/app/api/runs.py @@ -13,7 +13,7 @@ from sse_starlette import EventSourceResponse from app.auth.handlers import AuthedUser -from app.storage import get_thread +from app.storage import get_assistant, get_thread from app.lifespan import get_langserve router = APIRouter() @@ -50,6 +50,9 @@ async def stream_run( thread = await get_thread(user["user_id"], payload.thread_id) if not thread: raise HTTPException(status_code=404, detail="Thread not found") + assistant = await get_assistant(user["user_id"], thread["assistant_id"]) + if not assistant: + raise HTTPException(status_code=404, detail="Assistant not found") return EventSourceResponse( ( @@ -60,6 +63,11 @@ async def stream_run( input=payload.input, config=payload.config, stream_mode="messages", + interrupt_before=["action"] + if assistant["config"]["configurable"].get( + "type==agent/interrupt_before_action" + ) + else None, ) ) )