Skip to content

Commit a1875ee

Browse files
authored
Merge pull request #305 from ag-ui-protocol/chore/examples-fix-bundle
Examples fix bundle & small maintenance
2 parents f04588d + eec55bd commit a1875ee

File tree

8 files changed

+29
-38
lines changed

8 files changed

+29
-38
lines changed

typescript-sdk/apps/dojo/e2e/tests/crewAITests/predictvieStateUpdatePage.spec.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import {
22
test,
33
expect,
4-
waitForAIResponse,
54
retryOnAIFailure,
65
} from "../../test-isolation-helper";
76
import { PredictiveStateUpdatesPage } from "../../pages/crewAIPages/PredictiveStateUpdatesPage";
87

98
test.describe("Predictive Status Updates Feature", () => {
10-
test.fixme("[CrewAI] should interact with agent and approve asked changes", async ({
9+
test("[CrewAI] should interact with agent and approve asked changes", async ({
1110
page,
1211
}) => {
1312
await retryOnAIFailure(async () => {
@@ -22,7 +21,7 @@ test.describe("Predictive Status Updates Feature", () => {
2221
await predictiveStateUpdates.sendMessage(
2322
"Give me a story for a dragon called Atlantis in document"
2423
);
25-
await waitForAIResponse(page);
24+
await page.waitForTimeout(2000);
2625
await predictiveStateUpdates.getPredictiveResponse();
2726
await predictiveStateUpdates.getUserApproval();
2827
await predictiveStateUpdates.confirmedChangesResponse.isVisible();
@@ -33,7 +32,7 @@ test.describe("Predictive Status Updates Feature", () => {
3332

3433
// Send update to change the dragon name
3534
await predictiveStateUpdates.sendMessage("Change dragon name to Lola");
36-
await waitForAIResponse(page);
35+
await page.waitForTimeout(2000);
3736
await predictiveStateUpdates.verifyHighlightedText();
3837
await predictiveStateUpdates.getUserApproval();
3938
await predictiveStateUpdates.confirmedChangesResponse.nth(1).isVisible();
@@ -44,7 +43,7 @@ test.describe("Predictive Status Updates Feature", () => {
4443
});
4544
});
4645

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

7170
// Send update to change the dragon name
7271
await predictiveStateUpdates.sendMessage("Change dragon name to Lola");
73-
await waitForAIResponse(page);
72+
await page.waitForTimeout(2000);
7473
await predictiveStateUpdates.verifyHighlightedText();
7574
await predictiveStateUpdates.getUserRejection();
7675
await predictiveStateUpdates.rejectedChangesResponse.isVisible();

typescript-sdk/apps/dojo/e2e/tests/langgraphFastAPITests/predictvieStateUpdatePage.spec.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import {
22
test,
33
expect,
4-
waitForAIResponse,
54
retryOnAIFailure,
65
} from "../../test-isolation-helper";
76
import { PredictiveStateUpdatesPage } from "../../pages/langGraphFastAPIPages/PredictiveStateUpdatesPage";
87

98
test.describe("Predictive Status Updates Feature", () => {
10-
test.fixme("[LangGraph FastAPI] should interact with agent and approve asked changes", async ({
9+
test("[LangGraph FastAPI] should interact with agent and approve asked changes", async ({
1110
page,
1211
}) => {
1312
await retryOnAIFailure(async () => {
@@ -23,7 +22,6 @@ test.describe("Predictive Status Updates Feature", () => {
2322
await predictiveStateUpdates.sendMessage(
2423
"Give me a story for a dragon called Atlantis in document"
2524
);
26-
await waitForAIResponse(page);
2725
await page.waitForTimeout(2000);
2826

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

3937
await predictiveStateUpdates.sendMessage("Change dragon name to Lola");
40-
await waitForAIResponse(page);
4138
await page.waitForTimeout(2000);
4239

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

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

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

8278
await predictiveStateUpdates.sendMessage("Change dragon name to Lola");
83-
await waitForAIResponse(page);
8479
await page.waitForTimeout(2000);
8580

8681
await predictiveStateUpdates.verifyHighlightedText();

typescript-sdk/apps/dojo/e2e/tests/langgraphTests/predictvieStateUpdatePage.spec.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import {
22
test,
33
expect,
4-
waitForAIResponse,
54
retryOnAIFailure,
65
} from "../../test-isolation-helper";
76
import { PredictiveStateUpdatesPage } from "../../pages/langGraphPages/PredictiveStateUpdatesPage";
87

98
test.describe("Predictive Status Updates Feature", () => {
10-
test.fixme("[LangGraph] should interact with agent and approve asked changes", async ({
9+
test("[LangGraph] should interact with agent and approve asked changes", async ({
1110
page,
1211
}) => {
1312
await retryOnAIFailure(async () => {
@@ -23,7 +22,6 @@ test.describe("Predictive Status Updates Feature", () => {
2322
await predictiveStateUpdates.sendMessage(
2423
"Give me a story for a dragon called Atlantis in document"
2524
);
26-
await waitForAIResponse(page);
2725
await page.waitForTimeout(2000);
2826

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

3937
await predictiveStateUpdates.sendMessage("Change dragon name to Lola");
40-
await waitForAIResponse(page);
4138
await page.waitForTimeout(2000);
4239

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

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

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

8278
await predictiveStateUpdates.sendMessage("Change dragon name to Lola");
83-
await waitForAIResponse(page);
8479
await page.waitForTimeout(2000);
8580

8681
await predictiveStateUpdates.verifyHighlightedText();

typescript-sdk/apps/dojo/e2e/tests/pydanticAITests/predictvieStateUpdatePage.spec.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import {
22
test,
33
expect,
4-
waitForAIResponse,
54
retryOnAIFailure,
65
} from "../../test-isolation-helper";
76
import { PredictiveStateUpdatesPage } from "../../pages/pydanticAIPages/PredictiveStateUpdatesPage";
@@ -22,7 +21,7 @@ test.describe("Predictive Status Updates Feature", () => {
2221
await predictiveStateUpdates.sendMessage(
2322
"Give me a story for a dragon called Atlantis in document"
2423
);
25-
await waitForAIResponse(page);
24+
await page.waitForTimeout(2000);
2625
await predictiveStateUpdates.getPredictiveResponse();
2726
await predictiveStateUpdates.getUserApproval();
2827
await predictiveStateUpdates.confirmedChangesResponse.isVisible();
@@ -33,7 +32,7 @@ test.describe("Predictive Status Updates Feature", () => {
3332

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

7170
// Send update to change the dragon name
7271
await predictiveStateUpdates.sendMessage("Change dragon name to Lola");
73-
await waitForAIResponse(page);
72+
await page.waitForTimeout(2000);
7473
await predictiveStateUpdates.verifyHighlightedText();
7574
await predictiveStateUpdates.getUserRejection();
7675
await predictiveStateUpdates.rejectedChangesResponse.isVisible();

typescript-sdk/apps/dojo/e2e/tests/serverStarterAllFeaturesTests/predictvieStateUpdatePage.spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { test, expect, waitForAIResponse, retryOnAIFailure, } from "../../test-isolation-helper";
1+
import { test, expect, retryOnAIFailure, } from "../../test-isolation-helper";
22
import { PredictiveStateUpdatesPage } from "../../pages/serverStarterAllFeaturesPages/PredictiveStateUpdatesPage";
33

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

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

1616
await predictiveStateUpdates.sendMessage("Hi");
17-
await waitForAIResponse(page);
17+
await page.waitForTimeout(2000);
1818
await page.waitForTimeout(2000);
1919

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

2929
await predictiveStateUpdates.sendMessage("Change the dog name");
30-
await waitForAIResponse(page);
30+
await page.waitForTimeout(2000);
3131
await page.waitForTimeout(2000);
3232

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

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

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

5555
await predictiveStateUpdates.sendMessage("Hi");
56-
await waitForAIResponse(page);
56+
await page.waitForTimeout(2000);
5757
await page.waitForTimeout(2000);
5858

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

6868
await predictiveStateUpdates.sendMessage("Change the dog name");
69-
await waitForAIResponse(page);
69+
await page.waitForTimeout(2000);
7070
await page.waitForTimeout(2000);
7171

7272
await predictiveStateUpdates.verifyHighlightedText();

typescript-sdk/integrations/langgraph/examples/python/poetry.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

typescript-sdk/integrations/langgraph/examples/python/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ langchain-experimental = ">=0.0.11"
2121
langchain-google-genai = ">=2.1.9"
2222
langchain-openai = ">=0.0.1"
2323
langgraph = "^0.6.1"
24-
ag-ui-langgraph = { version = "0.0.5", extras = ["fastapi"] }
24+
ag-ui-langgraph = { version = "0.0.7", extras = ["fastapi"] }
2525
python-dotenv = "^1.0.0"
2626
fastapi = "^0.115.12"
2727

typescript-sdk/integrations/langgraph/python/ag_ui_langgraph/agent.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,13 @@ async def run(self, input: RunAgentInput) -> AsyncGenerator[str, None]:
100100

101101
async def _handle_stream_events(self, input: RunAgentInput) -> AsyncGenerator[str, None]:
102102
thread_id = input.thread_id or str(uuid.uuid4())
103-
self.active_run = {
103+
INITIAL_ACTIVE_RUN = {
104104
"id": input.run_id,
105105
"thread_id": thread_id,
106106
"thinking_process": None,
107+
"node_name": None,
107108
}
109+
self.active_run = INITIAL_ACTIVE_RUN
108110

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

261264

262265
async def prepare_stream(self, input: RunAgentInput, agent_state: State, config: RunnableConfig):

0 commit comments

Comments
 (0)