Skip to content

Commit 02c0c47

Browse files
committed
Adjust 1. tutorials for new AriesAgentController layout
1 parent 7a489b7 commit 02c0c47

21 files changed

+315
-192
lines changed

tutorials/1. Learning Aries, ACA-Py and the Basic Controller/notebooks/alice/1 Basic Concepts and 1st Connection/Part 2 - Aries Basic Controller.ipynb

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
},
137137
{
138138
"cell_type": "code",
139-
"execution_count": 1,
139+
"execution_count": null,
140140
"metadata": {},
141141
"outputs": [],
142142
"source": [
@@ -158,8 +158,7 @@
158158
"API_KEY = \"alice_api_123456789\"\n",
159159
"\n",
160160
"# Instantiate the AriesAgentController using the correct parameters\n",
161-
"agent_controller = AriesAgentController(webhook_host=WEBHOOK_HOST, webhook_port=WEBHOOK_PORT,\n",
162-
" webhook_base=WEBHOOK_BASE, admin_url=ADMIN_URL, api_key=API_KEY)"
161+
"agent_controller = AriesAgentController(admin_url=ADMIN_URL, api_key=API_KEY)"
163162
]
164163
},
165164
{
@@ -177,6 +176,17 @@
177176
"For an instance of AriesBasicController to be listening for these webhook events you must initialise the server by calling:"
178177
]
179178
},
179+
{
180+
"cell_type": "code",
181+
"execution_count": null,
182+
"metadata": {},
183+
"outputs": [],
184+
"source": [
185+
"agent_controller.init_webhook_server(webhook_host=WEBHOOK_HOST,\n",
186+
" webhook_port=WEBHOOK_PORT,\n",
187+
" webhook_base=WEBHOOK_BASE)"
188+
]
189+
},
180190
{
181191
"cell_type": "code",
182192
"execution_count": null,

tutorials/1. Learning Aries, ACA-Py and the Basic Controller/notebooks/alice/1 Basic Concepts and 1st Connection/Part 3 - Establishing a Connection.ipynb

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,18 @@
8585
"API_KEY = \"alice_api_123456789\"\n",
8686
"\n",
8787
"# Based on the aca-py agent you wish to control\n",
88-
"agent_controller = AriesAgentController(webhook_host=WEBHOOK_HOST, webhook_port=WEBHOOK_PORT,\n",
89-
" webhook_base=WEBHOOK_BASE, admin_url=ADMIN_URL, api_key=API_KEY)\n"
88+
"agent_controller = AriesAgentController(admin_url=ADMIN_URL, api_key=API_KEY)\n"
89+
]
90+
},
91+
{
92+
"cell_type": "code",
93+
"execution_count": null,
94+
"metadata": {},
95+
"outputs": [],
96+
"source": [
97+
"agent_controller.init_webhook_server(webhook_host=WEBHOOK_HOST, \n",
98+
" webhook_port=WEBHOOK_PORT,\n",
99+
" webhook_base=WEBHOOK_BASE)"
90100
]
91101
},
92102
{

tutorials/1. Learning Aries, ACA-Py and the Basic Controller/notebooks/alice/2 Credentials/Part 1 - Credential Schema and Definitions.ipynb

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,9 @@
2626
},
2727
{
2828
"cell_type": "code",
29-
"execution_count": 1,
29+
"execution_count": null,
3030
"metadata": {},
31-
"outputs": [
32-
{
33-
"name": "stdout",
34-
"output_type": "stream",
35-
"text": [
36-
"IPython autoawait is `on`, and set to use `asyncio`\n"
37-
]
38-
}
39-
],
31+
"outputs": [],
4032
"source": [
4133
"%autoawait\n",
4234
"import time\n",
@@ -53,8 +45,18 @@
5345
"API_KEY = \"alice_api_123456789\"\n",
5446
"\n",
5547
"# Based on the aca-py agent you wish to control\n",
56-
"agent_controller = AriesAgentController(webhook_host=WEBHOOK_HOST, webhook_port=WEBHOOK_PORT,\n",
57-
" webhook_base=WEBHOOK_BASE, admin_url=ADMIN_URL, api_key=API_KEY)\n"
48+
"agent_controller = AriesAgentController(admin_url=ADMIN_URL, api_key=API_KEY)\n"
49+
]
50+
},
51+
{
52+
"cell_type": "code",
53+
"execution_count": null,
54+
"metadata": {},
55+
"outputs": [],
56+
"source": [
57+
"agent_controller.init_webhook_server(webhook_host=WEBHOOK_HOST,\n",
58+
" webhook_port=WEBHOOK_PORT,\n",
59+
" webhook_base=WEBHOOK_BASE)"
5860
]
5961
},
6062
{
@@ -68,7 +70,7 @@
6870
},
6971
{
7072
"cell_type": "code",
71-
"execution_count": 2,
73+
"execution_count": null,
7274
"metadata": {},
7375
"outputs": [],
7476
"source": [
@@ -91,17 +93,9 @@
9193
},
9294
{
9395
"cell_type": "code",
94-
"execution_count": 3,
96+
"execution_count": null,
9597
"metadata": {},
96-
"outputs": [
97-
{
98-
"name": "stdout",
99-
"output_type": "stream",
100-
"text": [
101-
"PQRXDxdGqQGSZ8z69p4xZP:2:alice_test_schema:0.0.1\n"
102-
]
103-
}
104-
],
98+
"outputs": [],
10599
"source": [
106100
"response = await agent_controller.schema.write_schema(schema_name, attributes, schema_version)\n",
107101
"schema_id = response[\"schema_id\"]\n",

tutorials/1. Learning Aries, ACA-Py and the Basic Controller/notebooks/alice/2 Credentials/Part 2 - Issue Credential.ipynb

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"metadata": {
6-
"collapsed": true
7-
},
5+
"metadata": {},
86
"source": [
97
"# Issue Credential - Alice\n",
108
"## Role: Issuer\n",
@@ -42,11 +40,21 @@
4240
"API_KEY = \"alice_api_123456789\"\n",
4341
"\n",
4442
"# Based on the aca-py agent you wish to control\n",
45-
"agent_controller = AriesAgentController(webhook_host=WEBHOOK_HOST, webhook_port=WEBHOOK_PORT,\n",
46-
" webhook_base=WEBHOOK_BASE, admin_url=ADMIN_URL, api_key=API_KEY)\n",
43+
"agent_controller = AriesAgentController(admin_url=ADMIN_URL, api_key=API_KEY)\n",
4744
" "
4845
]
4946
},
47+
{
48+
"cell_type": "code",
49+
"execution_count": null,
50+
"metadata": {},
51+
"outputs": [],
52+
"source": [
53+
"agent_controller.init_webhook_server(webhook_host=WEBHOOK_HOST,\n",
54+
" webhook_port=WEBHOOK_PORT,\n",
55+
" webhook_base=WEBHOOK_BASE)"
56+
]
57+
},
5058
{
5159
"cell_type": "markdown",
5260
"metadata": {},
@@ -376,5 +384,5 @@
376384
}
377385
},
378386
"nbformat": 4,
379-
"nbformat_minor": 1
387+
"nbformat_minor": 4
380388
}

tutorials/1. Learning Aries, ACA-Py and the Basic Controller/notebooks/alice/2 Credentials/Part 3 - Present Proof.ipynb

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,21 @@
5151
"API_KEY = \"alice_api_123456789\"\n",
5252
"\n",
5353
"# Based on the aca-py agent you wish to control\n",
54-
"agent_controller = AriesAgentController(webhook_host=WEBHOOK_HOST, webhook_port=WEBHOOK_PORT,\n",
55-
" webhook_base=WEBHOOK_BASE, admin_url=ADMIN_URL, api_key=API_KEY)\n",
54+
"agent_controller = AriesAgentController(admin_url=ADMIN_URL, api_key=API_KEY)\n",
5655
"\n"
5756
]
5857
},
58+
{
59+
"cell_type": "code",
60+
"execution_count": null,
61+
"metadata": {},
62+
"outputs": [],
63+
"source": [
64+
"agent_controller.init_webhook_server(webhook_host=WEBHOOK_HOST,\n",
65+
" webhook_port=WEBHOOK_PORT,\n",
66+
" webhook_base=WEBHOOK_BASE)"
67+
]
68+
},
5969
{
6070
"cell_type": "markdown",
6171
"metadata": {},
@@ -393,5 +403,5 @@
393403
}
394404
},
395405
"nbformat": 4,
396-
"nbformat_minor": 1
406+
"nbformat_minor": 4
397407
}

tutorials/1. Learning Aries, ACA-Py and the Basic Controller/notebooks/alice/3 Messages/Part 1 - Basic Message.ipynb

Lines changed: 26 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,9 @@
1111
},
1212
{
1313
"cell_type": "code",
14-
"execution_count": 1,
14+
"execution_count": null,
1515
"metadata": {},
16-
"outputs": [
17-
{
18-
"name": "stdout",
19-
"output_type": "stream",
20-
"text": [
21-
"IPython autoawait is `on`, and set to use `asyncio`\n"
22-
]
23-
}
24-
],
16+
"outputs": [],
2517
"source": [
2618
"%autoawait\n",
2719
"import time\n",
@@ -30,7 +22,7 @@
3022
},
3123
{
3224
"cell_type": "code",
33-
"execution_count": 2,
25+
"execution_count": null,
3426
"metadata": {},
3527
"outputs": [],
3628
"source": [
@@ -47,8 +39,18 @@
4739
"\n",
4840
"\n",
4941
"# Based on the aca-py agent you wish to control\n",
50-
"agent_controller = AriesAgentController(webhook_host=WEBHOOK_HOST, webhook_port=WEBHOOK_PORT,\n",
51-
" webhook_base=WEBHOOK_BASE, admin_url=ADMIN_URL, api_key=API_KEY)"
42+
"agent_controller = AriesAgentController(admin_url=ADMIN_URL, api_key=API_KEY)"
43+
]
44+
},
45+
{
46+
"cell_type": "code",
47+
"execution_count": null,
48+
"metadata": {},
49+
"outputs": [],
50+
"source": [
51+
"agent_controller.init_webhook_server(webhook_host=WEBHOOK_HOST,\n",
52+
" webhook_port=WEBHOOK_PORT,\n",
53+
" webhook_base=WEBHOOK_BASE)"
5254
]
5355
},
5456
{
@@ -62,7 +64,7 @@
6264
},
6365
{
6466
"cell_type": "code",
65-
"execution_count": 3,
67+
"execution_count": null,
6668
"metadata": {},
6769
"outputs": [],
6870
"source": [
@@ -84,7 +86,7 @@
8486
},
8587
{
8688
"cell_type": "code",
87-
"execution_count": 4,
89+
"execution_count": null,
8890
"metadata": {},
8991
"outputs": [],
9092
"source": [
@@ -112,19 +114,9 @@
112114
},
113115
{
114116
"cell_type": "code",
115-
"execution_count": 5,
117+
"execution_count": null,
116118
"metadata": {},
117-
"outputs": [
118-
{
119-
"name": "stdout",
120-
"output_type": "stream",
121-
"text": [
122-
"Results : [{'rfc23_state': 'completed', 'their_role': 'inviter', 'request_id': '5d457ff6-28c5-429d-b7cd-e3ab3b0dc829', 'invitation_key': 'D6x1TzfFP76ihR9zRZFdUgL4mvcE2F8JKCroQJyno1SE', 'created_at': '2021-03-29 15:20:13.311490Z', 'their_did': 'Rn6qN2oFfgPyRKoYP2JuTe', 'their_label': 'Bob', 'invitation_mode': 'once', 'my_did': 'MrasHcPmBT3H8VVYiaR7eA', 'connection_id': 'd61e6495-1b0a-41de-b9e6-db799e6e8bdf', 'routing_state': 'none', 'updated_at': '2021-03-29 15:20:33.593695Z', 'state': 'active', 'accept': 'manual'}]\n",
123-
"Connection : {'rfc23_state': 'completed', 'their_role': 'inviter', 'request_id': '5d457ff6-28c5-429d-b7cd-e3ab3b0dc829', 'invitation_key': 'D6x1TzfFP76ihR9zRZFdUgL4mvcE2F8JKCroQJyno1SE', 'created_at': '2021-03-29 15:20:13.311490Z', 'their_did': 'Rn6qN2oFfgPyRKoYP2JuTe', 'their_label': 'Bob', 'invitation_mode': 'once', 'my_did': 'MrasHcPmBT3H8VVYiaR7eA', 'connection_id': 'd61e6495-1b0a-41de-b9e6-db799e6e8bdf', 'routing_state': 'none', 'updated_at': '2021-03-29 15:20:33.593695Z', 'state': 'active', 'accept': 'manual'}\n",
124-
"Active Connection ID : d61e6495-1b0a-41de-b9e6-db799e6e8bdf\n"
125-
]
126-
}
127-
],
119+
"outputs": [],
128120
"source": [
129121
"response = await agent_controller.connections.get_connections()\n",
130122
"results = response['results']\n",
@@ -144,48 +136,19 @@
144136
},
145137
{
146138
"cell_type": "code",
147-
"execution_count": 6,
139+
"execution_count": null,
148140
"metadata": {},
149-
"outputs": [
150-
{
151-
"name": "stdout",
152-
"output_type": "stream",
153-
"text": [
154-
"d61e6495-1b0a-41de-b9e6-db799e6e8bdf\n",
155-
"WEBHOOK RECIEVED - basicmessages\n",
156-
"WEBHOOK RECIEVED - basicmessages\n",
157-
"HANDLE WEBHOOK - basicmessages\n",
158-
"Handle message {'connection_id': 'd61e6495-1b0a-41de-b9e6-db799e6e8bdf', 'message_id': 'ee83bb20-c7ff-4961-9be2-a123eeff927c', 'content': 'Hello from Bob', 'state': 'received'} d61e6495-1b0a-41de-b9e6-db799e6e8bdf\n",
159-
"Second Handler {'connection_id': 'd61e6495-1b0a-41de-b9e6-db799e6e8bdf', 'message_id': 'ee83bb20-c7ff-4961-9be2-a123eeff927c', 'content': 'Hello from Bob', 'state': 'received'} d61e6495-1b0a-41de-b9e6-db799e6e8bdf\n",
160-
"PUBSUB SENT - basicmessages\n",
161-
"HANDLE WEBHOOK - basicmessages\n",
162-
"Handle message {'connection_id': 'd61e6495-1b0a-41de-b9e6-db799e6e8bdf', 'message_id': 'ee83bb20-c7ff-4961-9be2-a123eeff927c', 'content': 'Hello from Bob', 'state': 'received'} d61e6495-1b0a-41de-b9e6-db799e6e8bdf\n",
163-
"Second Handler {'connection_id': 'd61e6495-1b0a-41de-b9e6-db799e6e8bdf', 'message_id': 'ee83bb20-c7ff-4961-9be2-a123eeff927c', 'content': 'Hello from Bob', 'state': 'received'} d61e6495-1b0a-41de-b9e6-db799e6e8bdf\n",
164-
"PUBSUB SENT - basicmessages\n"
165-
]
166-
}
167-
],
141+
"outputs": [],
168142
"source": [
169143
"print(connection[\"connection_id\"])\n",
170144
"id = connection[\"connection_id\"]"
171145
]
172146
},
173147
{
174148
"cell_type": "code",
175-
"execution_count": 7,
149+
"execution_count": null,
176150
"metadata": {},
177-
"outputs": [
178-
{
179-
"data": {
180-
"text/plain": [
181-
"{'thread_id': '5568ca7b-4922-4360-8794-dcb3910403dc'}"
182-
]
183-
},
184-
"execution_count": 7,
185-
"metadata": {},
186-
"output_type": "execute_result"
187-
}
188-
],
151+
"outputs": [],
189152
"source": [
190153
"await agent_controller.messaging.trust_ping(id, \"hello, world!\")"
191154
]
@@ -203,22 +166,9 @@
203166
},
204167
{
205168
"cell_type": "code",
206-
"execution_count": 12,
169+
"execution_count": null,
207170
"metadata": {},
208-
"outputs": [
209-
{
210-
"name": "stdout",
211-
"output_type": "stream",
212-
"text": [
213-
"BASIC MESSAGE - Alice -> Bob\n",
214-
"{}\n",
215-
"Handle message {'connection_id': '4f66d7ac-2771-49c7-bf5c-0b84a228cb54', 'message_id': '5e8795cf-5311-4166-ad5f-259f22c40d93', 'content': 'This is a response from Bob', 'state': 'received'} 4f66d7ac-2771-49c7-bf5c-0b84a228cb54\n",
216-
"Handle message {'connection_id': '4f66d7ac-2771-49c7-bf5c-0b84a228cb54', 'message_id': '5e8795cf-5311-4166-ad5f-259f22c40d93', 'content': 'This is a response from Bob', 'state': 'received'} 4f66d7ac-2771-49c7-bf5c-0b84a228cb54\n",
217-
"Handle message {'connection_id': '4f66d7ac-2771-49c7-bf5c-0b84a228cb54', 'message_id': '93ddc727-6b92-4acd-8e1b-eaea87ec1091', 'content': 'This is a response from Bob', 'state': 'received'} 4f66d7ac-2771-49c7-bf5c-0b84a228cb54\n",
218-
"Handle message {'connection_id': '4f66d7ac-2771-49c7-bf5c-0b84a228cb54', 'message_id': '93ddc727-6b92-4acd-8e1b-eaea87ec1091', 'content': 'This is a response from Bob', 'state': 'received'} 4f66d7ac-2771-49c7-bf5c-0b84a228cb54\n"
219-
]
220-
}
221-
],
171+
"outputs": [],
222172
"source": [
223173
"basic_message = \"hello from Alice\"\n",
224174
"response = await agent_controller.messaging.send_message(connection_id, basic_message)\n",
@@ -269,7 +219,7 @@
269219
"name": "python",
270220
"nbconvert_exporter": "python",
271221
"pygments_lexer": "ipython3",
272-
"version": "3.7.6"
222+
"version": "3.8.5"
273223
}
274224
},
275225
"nbformat": 4,

0 commit comments

Comments
 (0)