Skip to content

Commit d4bc14b

Browse files
committed
all dev notebooks working
1 parent e72b7ea commit d4bc14b

File tree

5 files changed

+988
-46
lines changed

5 files changed

+988
-46
lines changed

examples/tutorials/10_agentic/00_base/040_other_sdks/dev.ipynb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
},
102102
{
103103
"cell_type": "code",
104-
"execution_count": null,
104+
"execution_count": 5,
105105
"id": "a6927cc0",
106106
"metadata": {},
107107
"outputs": [
@@ -441,6 +441,13 @@
441441
},
442442
"metadata": {},
443443
"output_type": "display_data"
444+
},
445+
{
446+
"name": "stdout",
447+
"output_type": "stream",
448+
"text": [
449+
"Streaming timed out after 20 seconds - returning collected messages\n"
450+
]
444451
}
445452
],
446453
"source": [

examples/tutorials/10_agentic/00_base/080_batch_events/dev.ipynb

Lines changed: 121 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": null,
5+
"execution_count": 1,
66
"id": "36834357",
77
"metadata": {},
88
"outputs": [],
@@ -14,7 +14,7 @@
1414
},
1515
{
1616
"cell_type": "code",
17-
"execution_count": null,
17+
"execution_count": 2,
1818
"id": "d1c309d6",
1919
"metadata": {},
2020
"outputs": [],
@@ -24,10 +24,18 @@
2424
},
2525
{
2626
"cell_type": "code",
27-
"execution_count": null,
27+
"execution_count": 3,
2828
"id": "9f6e6ef0",
2929
"metadata": {},
30-
"outputs": [],
30+
"outputs": [
31+
{
32+
"name": "stdout",
33+
"output_type": "stream",
34+
"text": [
35+
"Task(id='83aeec42-3e63-4652-aff5-506252e7cb67', created_at=datetime.datetime(2025, 7, 27, 5, 56, 44, 321516, tzinfo=TzInfo(UTC)), name='776014ce-task', status='RUNNING', status_reason='Task created, forwarding to ACP server', updated_at=datetime.datetime(2025, 7, 27, 5, 56, 44, 321516, tzinfo=TzInfo(UTC)))\n"
36+
]
37+
}
38+
],
3139
"source": [
3240
"# (REQUIRED) Create a new task. For Agentic agents, you must create a task for messages to be associated with.\n",
3341
"\n",
@@ -53,14 +61,27 @@
5361
},
5462
{
5563
"cell_type": "code",
56-
"execution_count": null,
64+
"execution_count": 6,
5765
"id": "b03b0d37",
5866
"metadata": {},
59-
"outputs": [],
67+
"outputs": [
68+
{
69+
"name": "stdout",
70+
"output_type": "stream",
71+
"text": [
72+
"Event(id='f83319aa-6f63-4495-be1e-6ca52595e865', agent_id='406f9f42-9f3f-4bb2-869c-d6b36028e487', sequence_id=225, task_id='83aeec42-3e63-4652-aff5-506252e7cb67', content=TextContent(author='user', content='Hello, what can you do?', attachments=None, format='plain', style='static', type='text'), created_at=datetime.datetime(2025, 7, 27, 6, 0, 8, 557860, tzinfo=TzInfo(UTC)))\n",
73+
"Event(id='be4b68b3-991a-4dfe-8be5-31f1cc032ef1', agent_id='406f9f42-9f3f-4bb2-869c-d6b36028e487', sequence_id=226, task_id='83aeec42-3e63-4652-aff5-506252e7cb67', content=TextContent(author='user', content='Can you tell me a joke?', attachments=None, format='plain', style='static', type='text'), created_at=datetime.datetime(2025, 7, 27, 6, 0, 8, 615897, tzinfo=TzInfo(UTC)))\n",
74+
"Event(id='3001a88f-de80-44bf-b2ff-686428da043b', agent_id='406f9f42-9f3f-4bb2-869c-d6b36028e487', sequence_id=227, task_id='83aeec42-3e63-4652-aff5-506252e7cb67', content=TextContent(author='user', content='What is the capital of France?', attachments=None, format='plain', style='static', type='text'), created_at=datetime.datetime(2025, 7, 27, 6, 0, 8, 665333, tzinfo=TzInfo(UTC)))\n",
75+
"Event(id='49ca99da-1c88-41f3-abea-91845cd927d5', agent_id='406f9f42-9f3f-4bb2-869c-d6b36028e487', sequence_id=228, task_id='83aeec42-3e63-4652-aff5-506252e7cb67', content=TextContent(author='user', content='Write a short story about a cat', attachments=None, format='plain', style='static', type='text'), created_at=datetime.datetime(2025, 7, 27, 6, 0, 8, 704690, tzinfo=TzInfo(UTC)))\n",
76+
"Event(id='da567964-5fa6-419d-a573-66e673f18669', agent_id='406f9f42-9f3f-4bb2-869c-d6b36028e487', sequence_id=229, task_id='83aeec42-3e63-4652-aff5-506252e7cb67', content=TextContent(author='user', content='Tell me how an LLM works', attachments=None, format='plain', style='static', type='text'), created_at=datetime.datetime(2025, 7, 27, 6, 0, 8, 748329, tzinfo=TzInfo(UTC)))\n"
77+
]
78+
}
79+
],
6080
"source": [
6181
"# Test non streaming response\n",
6282
"from typing import cast\n",
6383
"from agentex.types import Event\n",
84+
"from agentex.types.agent_rpc_params import ParamsSendEventRequest\n",
6485
"\n",
6586
"# The response is expected to be a list of TaskMessage objects, which is a union of the following types:\n",
6687
"# - TextContent: A message with just text content \n",
@@ -70,25 +91,99 @@
7091
"\n",
7192
"# When processing the message/send response, if you are expecting more than TextContent, such as DataContent, ToolRequestContent, or ToolResponseContent, you can process them as well\n",
7293
"\n",
73-
"rpc_response = client.agents.rpc_by_name(\n",
74-
" agent_name=AGENT_NAME,\n",
75-
" method=\"event/send\",\n",
76-
" params={\n",
77-
" \"content\": {\"type\": \"text\", \"author\": \"user\", \"content\": \"Hello what can you do?\"},\n",
94+
"concurrent_event_messages: list[ParamsSendEventRequest] = [\n",
95+
" {\n",
96+
" \"content\": {\"type\": \"text\", \"author\": \"user\", \"content\": \"Hello, what can you do?\"},\n",
7897
" \"task_id\": task.id,\n",
79-
" }\n",
80-
")\n",
98+
" },\n",
99+
" {\n",
100+
" \"content\": {\"type\": \"text\", \"author\": \"user\", \"content\": \"Can you tell me a joke?\"},\n",
101+
" \"task_id\": task.id,\n",
102+
" },\n",
103+
" {\n",
104+
" \"content\": {\"type\": \"text\", \"author\": \"user\", \"content\": \"What is the capital of France?\"},\n",
105+
" \"task_id\": task.id,\n",
106+
" },\n",
107+
" {\n",
108+
" \"content\": {\"type\": \"text\", \"author\": \"user\", \"content\": \"Write a short story about a cat\"},\n",
109+
" \"task_id\": task.id,\n",
110+
" },\n",
111+
" {\n",
112+
" \"content\": {\"type\": \"text\", \"author\": \"user\", \"content\": \"Tell me how an LLM works\"},\n",
113+
" \"task_id\": task.id,\n",
114+
" },\n",
115+
"]\n",
116+
"\n",
117+
"events: list[Event] = []\n",
118+
"\n",
119+
"for event_message in concurrent_event_messages:\n",
120+
" rpc_response = client.agents.rpc_by_name(\n",
121+
" agent_name=AGENT_NAME,\n",
122+
" method=\"event/send\",\n",
123+
" params=event_message\n",
124+
" )\n",
81125
"\n",
82-
"event = cast(Event, rpc_response.result)\n",
83-
"print(event)"
126+
" event = cast(Event, rpc_response.result)\n",
127+
" events.append(event)\n",
128+
"\n",
129+
"for event in events:\n",
130+
" print(event)"
84131
]
85132
},
86133
{
87134
"cell_type": "code",
88-
"execution_count": null,
135+
"execution_count": 7,
89136
"id": "a6927cc0",
90137
"metadata": {},
91-
"outputs": [],
138+
"outputs": [
139+
{
140+
"data": {
141+
"text/html": [
142+
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #008000; text-decoration-color: #008000\">╭──────────────────────── </span><span style=\"color: #008000; text-decoration-color: #008000; font-weight: bold\">AGENT</span><span style=\"color: #008000; text-decoration-color: #008000\"> [07/27/2025 06:00:18] ─────────────────────────╮</span>\n",
143+
"<span style=\"color: #008000; text-decoration-color: #008000\">│</span> Processed event IDs: ['f83319aa-6f63-4495-be1e-6ca52595e865', <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
144+
"<span style=\"color: #008000; text-decoration-color: #008000\">│</span> 'be4b68b3-991a-4dfe-8be5-31f1cc032ef1'] <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
145+
"<span style=\"color: #008000; text-decoration-color: #008000\">╰──────────────────────────────────────────────────────────────────────────────╯</span>\n",
146+
"</pre>\n"
147+
],
148+
"text/plain": [
149+
"\u001b[32m╭─\u001b[0m\u001b[32m───────────────────────\u001b[0m\u001b[32m \u001b[0m\u001b[1;32mAGENT\u001b[0m\u001b[32m [07/27/2025 06:00:18] \u001b[0m\u001b[32m────────────────────────\u001b[0m\u001b[32m─╮\u001b[0m\n",
150+
"\u001b[32m│\u001b[0m Processed event IDs: ['f83319aa-6f63-4495-be1e-6ca52595e865', \u001b[32m│\u001b[0m\n",
151+
"\u001b[32m│\u001b[0m 'be4b68b3-991a-4dfe-8be5-31f1cc032ef1'] \u001b[32m│\u001b[0m\n",
152+
"\u001b[32m╰──────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n"
153+
]
154+
},
155+
"metadata": {},
156+
"output_type": "display_data"
157+
},
158+
{
159+
"data": {
160+
"text/html": [
161+
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #008000; text-decoration-color: #008000\">╭──────────────────────── </span><span style=\"color: #008000; text-decoration-color: #008000; font-weight: bold\">AGENT</span><span style=\"color: #008000; text-decoration-color: #008000\"> [07/27/2025 06:00:33] ─────────────────────────╮</span>\n",
162+
"<span style=\"color: #008000; text-decoration-color: #008000\">│</span> Processed event IDs: ['3001a88f-de80-44bf-b2ff-686428da043b', <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
163+
"<span style=\"color: #008000; text-decoration-color: #008000\">│</span> '49ca99da-1c88-41f3-abea-91845cd927d5', <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
164+
"<span style=\"color: #008000; text-decoration-color: #008000\">│</span> 'da567964-5fa6-419d-a573-66e673f18669'] <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
165+
"<span style=\"color: #008000; text-decoration-color: #008000\">╰──────────────────────────────────────────────────────────────────────────────╯</span>\n",
166+
"</pre>\n"
167+
],
168+
"text/plain": [
169+
"\u001b[32m╭─\u001b[0m\u001b[32m───────────────────────\u001b[0m\u001b[32m \u001b[0m\u001b[1;32mAGENT\u001b[0m\u001b[32m [07/27/2025 06:00:33] \u001b[0m\u001b[32m────────────────────────\u001b[0m\u001b[32m─╮\u001b[0m\n",
170+
"\u001b[32m│\u001b[0m Processed event IDs: ['3001a88f-de80-44bf-b2ff-686428da043b', \u001b[32m│\u001b[0m\n",
171+
"\u001b[32m│\u001b[0m '49ca99da-1c88-41f3-abea-91845cd927d5', \u001b[32m│\u001b[0m\n",
172+
"\u001b[32m│\u001b[0m 'da567964-5fa6-419d-a573-66e673f18669'] \u001b[32m│\u001b[0m\n",
173+
"\u001b[32m╰──────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n"
174+
]
175+
},
176+
"metadata": {},
177+
"output_type": "display_data"
178+
},
179+
{
180+
"name": "stdout",
181+
"output_type": "stream",
182+
"text": [
183+
"Streaming timed out after 20 seconds - returning collected messages\n"
184+
]
185+
}
186+
],
92187
"source": [
93188
"from agentex.lib.utils.dev_tools import subscribe_to_async_task_messages\n",
94189
"\n",
@@ -98,9 +193,17 @@
98193
" only_after_timestamp=event.created_at, \n",
99194
" print_messages=True,\n",
100195
" rich_print=True,\n",
101-
" timeout=5,\n",
196+
" timeout=20,\n",
102197
")"
103198
]
199+
},
200+
{
201+
"cell_type": "code",
202+
"execution_count": null,
203+
"id": "593a0a47",
204+
"metadata": {},
205+
"outputs": [],
206+
"source": []
104207
}
105208
],
106209
"metadata": {

examples/tutorials/10_agentic/10_temporal/000_hello_acp/dev.ipynb

Lines changed: 78 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": null,
5+
"execution_count": 2,
66
"id": "36834357",
77
"metadata": {},
88
"outputs": [],
@@ -14,7 +14,7 @@
1414
},
1515
{
1616
"cell_type": "code",
17-
"execution_count": null,
17+
"execution_count": 3,
1818
"id": "d1c309d6",
1919
"metadata": {},
2020
"outputs": [],
@@ -24,10 +24,18 @@
2424
},
2525
{
2626
"cell_type": "code",
27-
"execution_count": null,
27+
"execution_count": 4,
2828
"id": "9f6e6ef0",
2929
"metadata": {},
30-
"outputs": [],
30+
"outputs": [
31+
{
32+
"name": "stdout",
33+
"output_type": "stream",
34+
"text": [
35+
"Task(id='908547e1-5796-48c4-8b72-b02366025584', created_at=datetime.datetime(2025, 7, 27, 6, 2, 40, 117494, tzinfo=TzInfo(UTC)), name='4f1591db-task', status='RUNNING', status_reason='Task created, forwarding to ACP server', updated_at=datetime.datetime(2025, 7, 27, 6, 2, 40, 117494, tzinfo=TzInfo(UTC)))\n"
36+
]
37+
}
38+
],
3139
"source": [
3240
"# (REQUIRED) Create a new task. For Agentic agents, you must create a task for messages to be associated with.\n",
3341
"\n",
@@ -53,10 +61,18 @@
5361
},
5462
{
5563
"cell_type": "code",
56-
"execution_count": null,
64+
"execution_count": 5,
5765
"id": "b03b0d37",
5866
"metadata": {},
59-
"outputs": [],
67+
"outputs": [
68+
{
69+
"name": "stdout",
70+
"output_type": "stream",
71+
"text": [
72+
"Event(id='84a84d4c-d3e7-4e58-801c-ac1bafcefcff', agent_id='1f6cd429-4e4a-4884-b449-72a1f2740393', sequence_id=230, task_id='908547e1-5796-48c4-8b72-b02366025584', content=TextContent(author='user', content='Hello what can you do?', attachments=None, format='plain', style='static', type='text'), created_at=datetime.datetime(2025, 7, 27, 6, 2, 46, 253653, tzinfo=TzInfo(UTC)))\n"
73+
]
74+
}
75+
],
6076
"source": [
6177
"# Test non streaming response\n",
6278
"from typing import cast\n",
@@ -85,10 +101,56 @@
85101
},
86102
{
87103
"cell_type": "code",
88-
"execution_count": null,
104+
"execution_count": 6,
89105
"id": "a6927cc0",
90106
"metadata": {},
91-
"outputs": [],
107+
"outputs": [
108+
{
109+
"data": {
110+
"text/html": [
111+
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #00ffff; text-decoration-color: #00ffff\">╭───────────────────────── </span><span style=\"color: #00ffff; text-decoration-color: #00ffff; font-weight: bold\">USER</span><span style=\"color: #00ffff; text-decoration-color: #00ffff\"> [07/27/2025 06:02:46] ─────────────────────────╮</span>\n",
112+
"<span style=\"color: #00ffff; text-decoration-color: #00ffff\">│</span> Hello what can you do? <span style=\"color: #00ffff; text-decoration-color: #00ffff\">│</span>\n",
113+
"<span style=\"color: #00ffff; text-decoration-color: #00ffff\">╰──────────────────────────────────────────────────────────────────────────────╯</span>\n",
114+
"</pre>\n"
115+
],
116+
"text/plain": [
117+
"\u001b[96m╭─\u001b[0m\u001b[96m────────────────────────\u001b[0m\u001b[96m \u001b[0m\u001b[1;96mUSER\u001b[0m\u001b[96m [07/27/2025 06:02:46] \u001b[0m\u001b[96m────────────────────────\u001b[0m\u001b[96m─╮\u001b[0m\n",
118+
"\u001b[96m│\u001b[0m Hello what can you do? \u001b[96m│\u001b[0m\n",
119+
"\u001b[96m╰──────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n"
120+
]
121+
},
122+
"metadata": {},
123+
"output_type": "display_data"
124+
},
125+
{
126+
"data": {
127+
"text/html": [
128+
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #008000; text-decoration-color: #008000\">╭──────────────────────── </span><span style=\"color: #008000; text-decoration-color: #008000; font-weight: bold\">AGENT</span><span style=\"color: #008000; text-decoration-color: #008000\"> [07/27/2025 06:02:46] ─────────────────────────╮</span>\n",
129+
"<span style=\"color: #008000; text-decoration-color: #008000\">│</span> Hello! I've received your message. I can't respond right now, but in future <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
130+
"<span style=\"color: #008000; text-decoration-color: #008000\">│</span> tutorials we'll see how you can get me to intelligently respond to your <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
131+
"<span style=\"color: #008000; text-decoration-color: #008000\">│</span> message. <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
132+
"<span style=\"color: #008000; text-decoration-color: #008000\">╰──────────────────────────────────────────────────────────────────────────────╯</span>\n",
133+
"</pre>\n"
134+
],
135+
"text/plain": [
136+
"\u001b[32m╭─\u001b[0m\u001b[32m───────────────────────\u001b[0m\u001b[32m \u001b[0m\u001b[1;32mAGENT\u001b[0m\u001b[32m [07/27/2025 06:02:46] \u001b[0m\u001b[32m────────────────────────\u001b[0m\u001b[32m─╮\u001b[0m\n",
137+
"\u001b[32m│\u001b[0m Hello! I've received your message. I can't respond right now, but in future \u001b[32m│\u001b[0m\n",
138+
"\u001b[32m│\u001b[0m tutorials we'll see how you can get me to intelligently respond to your \u001b[32m│\u001b[0m\n",
139+
"\u001b[32m│\u001b[0m message. \u001b[32m│\u001b[0m\n",
140+
"\u001b[32m╰──────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n"
141+
]
142+
},
143+
"metadata": {},
144+
"output_type": "display_data"
145+
},
146+
{
147+
"name": "stdout",
148+
"output_type": "stream",
149+
"text": [
150+
"Streaming timed out after 5 seconds - returning collected messages\n"
151+
]
152+
}
153+
],
92154
"source": [
93155
"from agentex.lib.utils.dev_tools import subscribe_to_async_task_messages\n",
94156
"\n",
@@ -101,6 +163,14 @@
101163
" timeout=5,\n",
102164
")"
103165
]
166+
},
167+
{
168+
"cell_type": "code",
169+
"execution_count": null,
170+
"id": "b60701ae",
171+
"metadata": {},
172+
"outputs": [],
173+
"source": []
104174
}
105175
],
106176
"metadata": {

0 commit comments

Comments
 (0)