|
2 | 2 | "cells": [ |
3 | 3 | { |
4 | 4 | "cell_type": "code", |
5 | | - "execution_count": null, |
| 5 | + "execution_count": 1, |
6 | 6 | "id": "0", |
7 | 7 | "metadata": {}, |
8 | 8 | "outputs": [], |
|
14 | 14 | }, |
15 | 15 | { |
16 | 16 | "cell_type": "code", |
17 | | - "execution_count": null, |
| 17 | + "execution_count": 2, |
18 | 18 | "id": "1", |
19 | 19 | "metadata": {}, |
20 | 20 | "outputs": [], |
|
24 | 24 | }, |
25 | 25 | { |
26 | 26 | "cell_type": "code", |
27 | | - "execution_count": null, |
| 27 | + "execution_count": 3, |
28 | 28 | "id": "2", |
29 | 29 | "metadata": {}, |
30 | | - "outputs": [], |
| 30 | + "outputs": [ |
| 31 | + { |
| 32 | + "name": "stdout", |
| 33 | + "output_type": "stream", |
| 34 | + "text": [ |
| 35 | + "Task(id='5d950471-ac85-4847-8102-209d0a79b0a6', created_at=datetime.datetime(2025, 8, 13, 0, 15, 24, 722362, tzinfo=TzInfo(UTC)), name='93ec41a3-task', status='RUNNING', status_reason='Task created, forwarding to ACP server', updated_at=datetime.datetime(2025, 8, 13, 0, 15, 24, 722362, tzinfo=TzInfo(UTC)))\n" |
| 36 | + ] |
| 37 | + } |
| 38 | + ], |
31 | 39 | "source": [ |
32 | 40 | "# (REQUIRED) Create a new task. For Agentic agents, you must create a task for messages to be associated with.\n", |
33 | 41 | "import uuid\n", |
|
46 | 54 | }, |
47 | 55 | { |
48 | 56 | "cell_type": "code", |
49 | | - "execution_count": null, |
| 57 | + "execution_count": 4, |
50 | 58 | "id": "3", |
51 | 59 | "metadata": {}, |
52 | | - "outputs": [], |
| 60 | + "outputs": [ |
| 61 | + { |
| 62 | + "name": "stdout", |
| 63 | + "output_type": "stream", |
| 64 | + "text": [ |
| 65 | + "Event(id='75379175-48cc-4d45-93f5-0e2125e6465d', agent_id='71580630-2e43-4db2-912f-124a80d8aca4', sequence_id=1, task_id='5d950471-ac85-4847-8102-209d0a79b0a6', content=TextContent(author='user', content='Hello tell me the latest news about AI and AI startups', attachments=None, format='plain', style='static', type='text'), created_at=datetime.datetime(2025, 8, 13, 0, 15, 26, 693593, tzinfo=TzInfo(UTC)))\n" |
| 66 | + ] |
| 67 | + } |
| 68 | + ], |
53 | 69 | "source": [ |
54 | 70 | "# Send an event to the agent\n", |
55 | 71 | "\n", |
|
75 | 91 | }, |
76 | 92 | { |
77 | 93 | "cell_type": "code", |
78 | | - "execution_count": null, |
| 94 | + "execution_count": 5, |
79 | 95 | "id": "4", |
80 | 96 | "metadata": {}, |
81 | | - "outputs": [], |
| 97 | + "outputs": [ |
| 98 | + { |
| 99 | + "data": { |
| 100 | + "text/html": [ |
| 101 | + "<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\"> [08/13/2025 00:15:26] ─────────────────────────╮</span>\n", |
| 102 | + "<span style=\"color: #00ffff; text-decoration-color: #00ffff\">│</span> Hello tell me the latest news about AI and AI startups <span style=\"color: #00ffff; text-decoration-color: #00ffff\">│</span>\n", |
| 103 | + "<span style=\"color: #00ffff; text-decoration-color: #00ffff\">╰──────────────────────────────────────────────────────────────────────────────╯</span>\n", |
| 104 | + "</pre>\n" |
| 105 | + ], |
| 106 | + "text/plain": [ |
| 107 | + "\u001b[96m╭─\u001b[0m\u001b[96m────────────────────────\u001b[0m\u001b[96m \u001b[0m\u001b[1;96mUSER\u001b[0m\u001b[96m [08/13/2025 00:15:26] \u001b[0m\u001b[96m────────────────────────\u001b[0m\u001b[96m─╮\u001b[0m\n", |
| 108 | + "\u001b[96m│\u001b[0m Hello tell me the latest news about AI and AI startups \u001b[96m│\u001b[0m\n", |
| 109 | + "\u001b[96m╰──────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n" |
| 110 | + ] |
| 111 | + }, |
| 112 | + "metadata": {}, |
| 113 | + "output_type": "display_data" |
| 114 | + }, |
| 115 | + { |
| 116 | + "name": "stdout", |
| 117 | + "output_type": "stream", |
| 118 | + "text": [ |
| 119 | + "Streaming timed out after 5 seconds - returning collected messages\n" |
| 120 | + ] |
| 121 | + } |
| 122 | + ], |
82 | 123 | "source": [ |
83 | 124 | "# Subscribe to the async task messages produced by the agent\n", |
84 | 125 | "from agentex.lib.utils.dev_tools import subscribe_to_async_task_messages\n", |
|
95 | 136 | }, |
96 | 137 | { |
97 | 138 | "cell_type": "code", |
98 | | - "execution_count": null, |
| 139 | + "execution_count": 6, |
99 | 140 | "id": "5", |
100 | 141 | "metadata": {}, |
101 | | - "outputs": [], |
| 142 | + "outputs": [ |
| 143 | + { |
| 144 | + "name": "stdout", |
| 145 | + "output_type": "stream", |
| 146 | + "text": [ |
| 147 | + "Event(id='f0bbedb7-95db-4708-acc0-e3094f34036a', agent_id='71580630-2e43-4db2-912f-124a80d8aca4', sequence_id=2, task_id='5d950471-ac85-4847-8102-209d0a79b0a6', content=TextContent(author='user', content='I want to know what viral news came up and which startups failed, got acquired, or became very successful or popular in the last 3 months', attachments=None, format='plain', style='static', type='text'), created_at=datetime.datetime(2025, 8, 13, 0, 15, 32, 633013, tzinfo=TzInfo(UTC)))\n" |
| 148 | + ] |
| 149 | + } |
| 150 | + ], |
102 | 151 | "source": [ |
103 | 152 | "# Send a follow up event to the agent in response to the agent's follow up question\n", |
104 | 153 | "\n", |
|
116 | 165 | }, |
117 | 166 | { |
118 | 167 | "cell_type": "code", |
119 | | - "execution_count": null, |
| 168 | + "execution_count": 7, |
120 | 169 | "id": "6", |
121 | 170 | "metadata": {}, |
122 | | - "outputs": [], |
| 171 | + "outputs": [ |
| 172 | + { |
| 173 | + "data": { |
| 174 | + "text/html": [ |
| 175 | + "<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\"> [08/13/2025 00:15:32] ─────────────────────────╮</span>\n", |
| 176 | + "<span style=\"color: #00ffff; text-decoration-color: #00ffff\">│</span> I want to know what viral news came up and which startups failed, got <span style=\"color: #00ffff; text-decoration-color: #00ffff\">│</span>\n", |
| 177 | + "<span style=\"color: #00ffff; text-decoration-color: #00ffff\">│</span> acquired, or became very successful or popular in the last 3 months <span style=\"color: #00ffff; text-decoration-color: #00ffff\">│</span>\n", |
| 178 | + "<span style=\"color: #00ffff; text-decoration-color: #00ffff\">╰──────────────────────────────────────────────────────────────────────────────╯</span>\n", |
| 179 | + "</pre>\n" |
| 180 | + ], |
| 181 | + "text/plain": [ |
| 182 | + "\u001b[96m╭─\u001b[0m\u001b[96m────────────────────────\u001b[0m\u001b[96m \u001b[0m\u001b[1;96mUSER\u001b[0m\u001b[96m [08/13/2025 00:15:32] \u001b[0m\u001b[96m────────────────────────\u001b[0m\u001b[96m─╮\u001b[0m\n", |
| 183 | + "\u001b[96m│\u001b[0m I want to know what viral news came up and which startups failed, got \u001b[96m│\u001b[0m\n", |
| 184 | + "\u001b[96m│\u001b[0m acquired, or became very successful or popular in the last 3 months \u001b[96m│\u001b[0m\n", |
| 185 | + "\u001b[96m╰──────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n" |
| 186 | + ] |
| 187 | + }, |
| 188 | + "metadata": {}, |
| 189 | + "output_type": "display_data" |
| 190 | + }, |
| 191 | + { |
| 192 | + "data": { |
| 193 | + "text/html": [ |
| 194 | + "<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\"> [08/13/2025 00:15:32] ─────────────────────────╮</span>\n", |
| 195 | + "<span style=\"color: #008000; text-decoration-color: #008000\">│</span> Starting deep research process based on your query and follow-up <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n", |
| 196 | + "<span style=\"color: #008000; text-decoration-color: #008000\">│</span> responses... <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n", |
| 197 | + "<span style=\"color: #008000; text-decoration-color: #008000\">╰──────────────────────────────────────────────────────────────────────────────╯</span>\n", |
| 198 | + "</pre>\n" |
| 199 | + ], |
| 200 | + "text/plain": [ |
| 201 | + "\u001b[32m╭─\u001b[0m\u001b[32m───────────────────────\u001b[0m\u001b[32m \u001b[0m\u001b[1;32mAGENT\u001b[0m\u001b[32m [08/13/2025 00:15:32] \u001b[0m\u001b[32m────────────────────────\u001b[0m\u001b[32m─╮\u001b[0m\n", |
| 202 | + "\u001b[32m│\u001b[0m Starting deep research process based on your query and follow-up \u001b[32m│\u001b[0m\n", |
| 203 | + "\u001b[32m│\u001b[0m responses... \u001b[32m│\u001b[0m\n", |
| 204 | + "\u001b[32m╰──────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n" |
| 205 | + ] |
| 206 | + }, |
| 207 | + "metadata": {}, |
| 208 | + "output_type": "display_data" |
| 209 | + }, |
| 210 | + { |
| 211 | + "name": "stdout", |
| 212 | + "output_type": "stream", |
| 213 | + "text": [ |
| 214 | + "Streaming timed out after 30 seconds - returning collected messages\n" |
| 215 | + ] |
| 216 | + } |
| 217 | + ], |
123 | 218 | "source": [ |
124 | 219 | "# Subscribe to the async task messages produced by the agent\n", |
125 | 220 | "from agentex.lib.utils.dev_tools import subscribe_to_async_task_messages\n", |
|
159 | 254 | "name": "python", |
160 | 255 | "nbconvert_exporter": "python", |
161 | 256 | "pygments_lexer": "ipython3", |
162 | | - "version": "3.12.9" |
| 257 | + "version": "3.12.11" |
163 | 258 | } |
164 | 259 | }, |
165 | 260 | "nbformat": 4, |
|
0 commit comments