|
1 | 1 | {
|
2 | 2 | "cells": [
|
| 3 | + { |
| 4 | + "cell_type": "code", |
| 5 | + "execution_count": null, |
| 6 | + "metadata": {}, |
| 7 | + "outputs": [], |
| 8 | + "source": [ |
| 9 | + "%autoawait\n", |
| 10 | + "import time\n", |
| 11 | + "import asyncio" |
| 12 | + ] |
| 13 | + }, |
| 14 | + { |
| 15 | + "cell_type": "code", |
| 16 | + "execution_count": null, |
| 17 | + "metadata": {}, |
| 18 | + "outputs": [], |
| 19 | + "source": [ |
| 20 | + "from aries_basic_controller.aries_controller import AriesAgentController\n", |
| 21 | + " \n", |
| 22 | + "WEBHOOK_HOST = \"0.0.0.0\"\n", |
| 23 | + "WEBHOOK_PORT = 8022\n", |
| 24 | + "WEBHOOK_BASE = \"\"\n", |
| 25 | + "ADMIN_URL = \"http://alice-agent:8021\"\n", |
| 26 | + "\n", |
| 27 | + "# WARNING: You should use environment variables for this\n", |
| 28 | + "# TODO: Make env variables accessible through juypter notebooks\n", |
| 29 | + "API_KEY = \"alice_api_123456789\"\n", |
| 30 | + "\n", |
| 31 | + "# Based on the aca-py agent you wish to control\n", |
| 32 | + "agent_controller = AriesAgentController(webhook_host=WEBHOOK_HOST, webhook_port=WEBHOOK_PORT,\n", |
| 33 | + " webhook_base=WEBHOOK_BASE, admin_url=ADMIN_URL, api_key=API_KEY)\n" |
| 34 | + ] |
| 35 | + }, |
| 36 | + { |
| 37 | + "cell_type": "code", |
| 38 | + "execution_count": null, |
| 39 | + "metadata": {}, |
| 40 | + "outputs": [], |
| 41 | + "source": [ |
| 42 | + "\n", |
| 43 | + "loop = asyncio.get_event_loop()\n", |
| 44 | + "loop.create_task(agent_controller.listen_webhooks())\n", |
| 45 | + "\n", |
| 46 | + "agent_controller.register_listeners([], defaults=True)" |
| 47 | + ] |
| 48 | + }, |
3 | 49 | {
|
4 | 50 | "cell_type": "code",
|
5 | 51 | "execution_count": null,
|
6 | 52 | "metadata": {},
|
7 | 53 | "outputs": [],
|
8 | 54 | "source": []
|
| 55 | + }, |
| 56 | + { |
| 57 | + "cell_type": "markdown", |
| 58 | + "metadata": {}, |
| 59 | + "source": [ |
| 60 | + "## 4a. Use the controller to create an out of band connection invitation" |
| 61 | + ] |
| 62 | + }, |
| 63 | + { |
| 64 | + "cell_type": "code", |
| 65 | + "execution_count": null, |
| 66 | + "metadata": {}, |
| 67 | + "outputs": [], |
| 68 | + "source": [ |
| 69 | + "payload = {\n", |
| 70 | + " \"include_handshake\": True,\n", |
| 71 | + " \"use_public_did\": False\n", |
| 72 | + "}\n", |
| 73 | + "print(json.dumps(payload))\n", |
| 74 | + "\n", |
| 75 | + "# Create an out of band Invitation\n", |
| 76 | + "oob_invite = await agent_controller.oob.create_invitation(json.dumps(payload))\n", |
| 77 | + "print(json.dumps(oob_invite))" |
| 78 | + ] |
9 | 79 | }
|
10 | 80 | ],
|
11 | 81 | "metadata": {
|
|
0 commit comments