Skip to content
Merged
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import {
test,
expect,
waitForAIResponse,
retryOnAIFailure,
} from "../../test-isolation-helper";
import { PredictiveStateUpdatesPage } from "../../pages/crewAIPages/PredictiveStateUpdatesPage";

test.describe("Predictive Status Updates Feature", () => {
test.fixme("[CrewAI] should interact with agent and approve asked changes", async ({
test("[CrewAI] should interact with agent and approve asked changes", async ({
page,
}) => {
await retryOnAIFailure(async () => {
Expand All @@ -22,7 +21,7 @@ test.describe("Predictive Status Updates Feature", () => {
await predictiveStateUpdates.sendMessage(
"Give me a story for a dragon called Atlantis in document"
);
await waitForAIResponse(page);
await page.waitForTimeout(2000);
await predictiveStateUpdates.getPredictiveResponse();
await predictiveStateUpdates.getUserApproval();
await predictiveStateUpdates.confirmedChangesResponse.isVisible();
Expand All @@ -33,7 +32,7 @@ test.describe("Predictive Status Updates Feature", () => {

// Send update to change the dragon name
await predictiveStateUpdates.sendMessage("Change dragon name to Lola");
await waitForAIResponse(page);
await page.waitForTimeout(2000);
await predictiveStateUpdates.verifyHighlightedText();
await predictiveStateUpdates.getUserApproval();
await predictiveStateUpdates.confirmedChangesResponse.nth(1).isVisible();
Expand All @@ -44,7 +43,7 @@ test.describe("Predictive Status Updates Feature", () => {
});
});

test.fixme("[CrewAI] should interact with agent and reject asked changes", async ({
test("[CrewAI] should interact with agent and reject asked changes", async ({
page,
}) => {
await retryOnAIFailure(async () => {
Expand All @@ -70,7 +69,7 @@ test.describe("Predictive Status Updates Feature", () => {

// Send update to change the dragon name
await predictiveStateUpdates.sendMessage("Change dragon name to Lola");
await waitForAIResponse(page);
await page.waitForTimeout(2000);
await predictiveStateUpdates.verifyHighlightedText();
await predictiveStateUpdates.getUserRejection();
await predictiveStateUpdates.rejectedChangesResponse.isVisible();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import {
test,
expect,
waitForAIResponse,
retryOnAIFailure,
} from "../../test-isolation-helper";
import { PredictiveStateUpdatesPage } from "../../pages/langGraphFastAPIPages/PredictiveStateUpdatesPage";

test.describe("Predictive Status Updates Feature", () => {
test.fixme("[LangGraph FastAPI] should interact with agent and approve asked changes", async ({
test("[LangGraph FastAPI] should interact with agent and approve asked changes", async ({
page,
}) => {
await retryOnAIFailure(async () => {
Expand All @@ -23,7 +22,6 @@ test.describe("Predictive Status Updates Feature", () => {
await predictiveStateUpdates.sendMessage(
"Give me a story for a dragon called Atlantis in document"
);
await waitForAIResponse(page);
await page.waitForTimeout(2000);

await predictiveStateUpdates.getPredictiveResponse();
Expand All @@ -37,7 +35,6 @@ test.describe("Predictive Status Updates Feature", () => {
await page.waitForTimeout(3000);

await predictiveStateUpdates.sendMessage("Change dragon name to Lola");
await waitForAIResponse(page);
await page.waitForTimeout(2000);

await predictiveStateUpdates.verifyHighlightedText();
Expand All @@ -50,7 +47,7 @@ test.describe("Predictive Status Updates Feature", () => {
});
});

test.fixme("[LangGraph FastAPI] should interact with agent and reject asked changes", async ({
test("[LangGraph FastAPI] should interact with agent and reject asked changes", async ({
page,
}) => {
await retryOnAIFailure(async () => {
Expand All @@ -66,7 +63,6 @@ test.describe("Predictive Status Updates Feature", () => {
await predictiveStateUpdates.sendMessage(
"Give me a story for a dragon called Atlantis in document"
);
await waitForAIResponse(page);
await page.waitForTimeout(2000);

await predictiveStateUpdates.getPredictiveResponse();
Expand All @@ -80,7 +76,6 @@ test.describe("Predictive Status Updates Feature", () => {
await page.waitForTimeout(3000);

await predictiveStateUpdates.sendMessage("Change dragon name to Lola");
await waitForAIResponse(page);
await page.waitForTimeout(2000);

await predictiveStateUpdates.verifyHighlightedText();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import {
test,
expect,
waitForAIResponse,
retryOnAIFailure,
} from "../../test-isolation-helper";
import { PredictiveStateUpdatesPage } from "../../pages/langGraphPages/PredictiveStateUpdatesPage";

test.describe("Predictive Status Updates Feature", () => {
test.fixme("[LangGraph] should interact with agent and approve asked changes", async ({
test("[LangGraph] should interact with agent and approve asked changes", async ({
page,
}) => {
await retryOnAIFailure(async () => {
Expand All @@ -23,7 +22,6 @@ test.describe("Predictive Status Updates Feature", () => {
await predictiveStateUpdates.sendMessage(
"Give me a story for a dragon called Atlantis in document"
);
await waitForAIResponse(page);
await page.waitForTimeout(2000);

await predictiveStateUpdates.getPredictiveResponse();
Expand All @@ -37,7 +35,6 @@ test.describe("Predictive Status Updates Feature", () => {
await page.waitForTimeout(3000);

await predictiveStateUpdates.sendMessage("Change dragon name to Lola");
await waitForAIResponse(page);
await page.waitForTimeout(2000);

await predictiveStateUpdates.verifyHighlightedText();
Expand All @@ -50,7 +47,7 @@ test.describe("Predictive Status Updates Feature", () => {
});
});

test.fixme("[LangGraph] should interact with agent and reject asked changes", async ({
test("[LangGraph] should interact with agent and reject asked changes", async ({
page,
}) => {
await retryOnAIFailure(async () => {
Expand All @@ -66,7 +63,6 @@ test.describe("Predictive Status Updates Feature", () => {
await predictiveStateUpdates.sendMessage(
"Give me a story for a dragon called Atlantis in document"
);
await waitForAIResponse(page);
await page.waitForTimeout(2000);

await predictiveStateUpdates.getPredictiveResponse();
Expand All @@ -80,7 +76,6 @@ test.describe("Predictive Status Updates Feature", () => {
await page.waitForTimeout(3000);

await predictiveStateUpdates.sendMessage("Change dragon name to Lola");
await waitForAIResponse(page);
await page.waitForTimeout(2000);

await predictiveStateUpdates.verifyHighlightedText();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
test,
expect,
waitForAIResponse,
retryOnAIFailure,
} from "../../test-isolation-helper";
import { PredictiveStateUpdatesPage } from "../../pages/pydanticAIPages/PredictiveStateUpdatesPage";
Expand All @@ -22,7 +21,7 @@ test.describe("Predictive Status Updates Feature", () => {
await predictiveStateUpdates.sendMessage(
"Give me a story for a dragon called Atlantis in document"
);
await waitForAIResponse(page);
await page.waitForTimeout(2000);
await predictiveStateUpdates.getPredictiveResponse();
await predictiveStateUpdates.getUserApproval();
await predictiveStateUpdates.confirmedChangesResponse.isVisible();
Expand All @@ -33,7 +32,7 @@ test.describe("Predictive Status Updates Feature", () => {

// Send update to change the dragon name
await predictiveStateUpdates.sendMessage("Change dragon name to Lola");
await waitForAIResponse(page);
await page.waitForTimeout(2000);
await predictiveStateUpdates.verifyHighlightedText();
await predictiveStateUpdates.getUserApproval();
await predictiveStateUpdates.confirmedChangesResponse.nth(1).isVisible();
Expand Down Expand Up @@ -70,7 +69,7 @@ test.describe("Predictive Status Updates Feature", () => {

// Send update to change the dragon name
await predictiveStateUpdates.sendMessage("Change dragon name to Lola");
await waitForAIResponse(page);
await page.waitForTimeout(2000);
await predictiveStateUpdates.verifyHighlightedText();
await predictiveStateUpdates.getUserRejection();
await predictiveStateUpdates.rejectedChangesResponse.isVisible();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { test, expect, waitForAIResponse, retryOnAIFailure, } from "../../test-isolation-helper";
import { test, expect, retryOnAIFailure, } from "../../test-isolation-helper";
import { PredictiveStateUpdatesPage } from "../../pages/serverStarterAllFeaturesPages/PredictiveStateUpdatesPage";

test.describe("Predictive Status Updates Feature", () => {
test.fixme("[Server Starter all features] should interact with agent and approve asked changes", async ({ page, }) => {
test("[Server Starter all features] should interact with agent and approve asked changes", async ({ page, }) => {
await retryOnAIFailure(async () => {
const predictiveStateUpdates = new PredictiveStateUpdatesPage(page);

Expand All @@ -14,7 +14,7 @@ test.describe("Predictive Status Updates Feature", () => {
await page.waitForTimeout(2000);

await predictiveStateUpdates.sendMessage("Hi");
await waitForAIResponse(page);
await page.waitForTimeout(2000);
await page.waitForTimeout(2000);

await predictiveStateUpdates.getPredictiveResponse();
Expand All @@ -27,7 +27,7 @@ test.describe("Predictive Status Updates Feature", () => {
await page.waitForTimeout(3000);

await predictiveStateUpdates.sendMessage("Change the dog name");
await waitForAIResponse(page);
await page.waitForTimeout(2000);
await page.waitForTimeout(2000);

await predictiveStateUpdates.verifyHighlightedText();
Expand All @@ -41,7 +41,7 @@ test.describe("Predictive Status Updates Feature", () => {
});
});

test.fixme("[Server Starter all features] should interact with agent and reject asked changes", async ({ page, }) => {
test("[Server Starter all features] should interact with agent and reject asked changes", async ({ page, }) => {
await retryOnAIFailure(async () => {
const predictiveStateUpdates = new PredictiveStateUpdatesPage(page);

Expand All @@ -53,7 +53,7 @@ test.describe("Predictive Status Updates Feature", () => {
await page.waitForTimeout(2000);

await predictiveStateUpdates.sendMessage("Hi");
await waitForAIResponse(page);
await page.waitForTimeout(2000);
await page.waitForTimeout(2000);

await predictiveStateUpdates.getPredictiveResponse();
Expand All @@ -66,7 +66,7 @@ test.describe("Predictive Status Updates Feature", () => {
await page.waitForTimeout(3000);

await predictiveStateUpdates.sendMessage("Change the dog name");
await waitForAIResponse(page);
await page.waitForTimeout(2000);
await page.waitForTimeout(2000);

await predictiveStateUpdates.verifyHighlightedText();
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ langchain-experimental = ">=0.0.11"
langchain-google-genai = ">=2.1.9"
langchain-openai = ">=0.0.1"
langgraph = "^0.6.1"
ag-ui-langgraph = { version = "0.0.5", extras = ["fastapi"] }
ag-ui-langgraph = { version = "0.0.7", extras = ["fastapi"] }
python-dotenv = "^1.0.0"
fastapi = "^0.115.12"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,13 @@ async def run(self, input: RunAgentInput) -> AsyncGenerator[str, None]:

async def _handle_stream_events(self, input: RunAgentInput) -> AsyncGenerator[str, None]:
thread_id = input.thread_id or str(uuid.uuid4())
self.active_run = {
INITIAL_ACTIVE_RUN = {
"id": input.run_id,
"thread_id": thread_id,
"thinking_process": None,
"node_name": None,
}
self.active_run = INITIAL_ACTIVE_RUN

forwarded_props = input.forwarded_props
node_name_input = forwarded_props.get('node_name', None) if forwarded_props else None
Expand Down Expand Up @@ -256,7 +258,8 @@ async def _handle_stream_events(self, input: RunAgentInput) -> AsyncGenerator[st
yield self._dispatch_event(
RunFinishedEvent(type=EventType.RUN_FINISHED, thread_id=thread_id, run_id=self.active_run["id"])
)
self.active_run = None
# Reset active run to how it was before the stream started
self.active_run = INITIAL_ACTIVE_RUN


async def prepare_stream(self, input: RunAgentInput, agent_state: State, config: RunnableConfig):
Expand Down
Loading