Skip to content

Commit aac6560

Browse files
committed
Updated to v2.0.1
1 parent 99bdbe5 commit aac6560

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ In order to use the scripts in this report, please use your API key. [Ref](https
5151

5252
## 2. Copy sample files
5353

54+
**If you want to use A2AApp as a library, please check [this]().**
55+
5456
Here, an A2A client and 4 A2A servers are used. Those files can be copied by the following simple Google Apps Script. Please copy and paste the following script to the script editor of Google Apps Script, and run `myFunction`. By this, the requirement files are copied to your Google Drive. The whole scripts can also be seen on [this repository](https://github.com/tanaikech/A2AApp).
5557

5658
When `dstFolder` is `root`, the files are copied to the root folder. If you want to copy them to the specific folder, please set your folder ID.
@@ -187,6 +189,7 @@ A2AApp has the following options.
187189
- In the case of `Execute as: Me` and `Who has access to the app: Anyone` for Web Apps, anyone can access. To enhance security, an access key can be used. When using the access key, please set it as follows: `return new A2AApp({accessKey: "sample"}).server(object);`. Additionally, please add it as a query parameter to the Web App URL as follows: `https://script.google.com/macros/s/###/exec?accessKey=sample` and `https://script.google.com/macros/s/###/dev?access_token=###&accessKey=sample`.
188190
- Also, in the case of the A2A client with Google Apps Script, it accesses the Web Apps of the A2A server with Google Apps Script using the access token. By this, even when "Who has access: Anyone with Google account" can be used as the setting. But, in that case, it is required to share the Google Apps Script projects. Please be careful about this.
189191
- A2AApp can also record a log. In this case, please set it as follows: `return new A2AApp({accessKey: "sample", log: true, spreadsheetId: "###"}).server(object);`. With this setting, the log is recorded in the Spreadsheet.
192+
- A2AApp server can also connect to other servers. For example, when an A2A server is connected to another server, please put the URLs of the servers in `agentCardUrls` of [A2A server 1_Google Sheets Manager Agent.js](https://github.com/tanaikech/A2AApp/blob/master/A2A%20server%201_Google%20Sheets%20Manager%20Agent.js). You can do this for the same for other servers. But, in the current stage, when Google Apps Script is used, I think that directly connecting an A2A client with multiple servers is better because of the process cost.
190193

191194
# Summary
192195

@@ -387,5 +390,9 @@ Once the above steps are completed, access `http://0.0.0.0:12000/` or `http://lo
387390
1. Updated A2A server.
388391
2. Added A2A client.
389392

393+
- v2.0.1 (May 29, 2025)
394+
395+
1. From v2.0.1, A2AApp can also be used as a library.
396+
390397
[TOP](#top)
391398

Use_A2AApp_as_library/README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Use A2AApp as a Library
2+
3+
To build an A2A network, you'll need to create several clients and servers. Using A2AApp as a library can significantly streamline this process. This section explains how to use A2AApp as a library.
4+
5+
---
6+
7+
### Library Project Key
8+
9+
```
10+
1OuHIiA5Ge0MG_SpKdv1JLz8ZS3ouqhvrF5J6gRRr6xFiFPHxkRsgjMI6
11+
```
12+
13+
---
14+
15+
## Usage
16+
17+
To use A2AApp as a library, follow these installation steps:
18+
19+
### 1. Create a GAS Project
20+
21+
You can use this library with both standalone and container-bound Google Apps Script (GAS) projects.
22+
23+
### 2. Install the Library
24+
25+
Follow the instructions [here to install this library](https://developers.google.com/apps-script/guides/libraries). The library's project key is **`1OuHIiA5Ge0MG_SpKdv1JLz8ZS3ouqhvrF5J6gRRr6xFiFPHxkRsgjMI6`**.
26+
27+
### 3. Prepare Your Script
28+
29+
When using A2AApp as a library, you'll need to modify your script as shown below. You don't need to copy and paste `A2AApp.gs` and `GeminiWithFiles.gs` because they are included in the library.
30+
31+
#### For Clients
32+
33+
Modify [A2AClient.js](https://github.com/tanaikech/A2AApp/blob/master/A2AClient.js) as follows:
34+
35+
**From:**
36+
37+
```javascript
38+
const obj = new A2AApp().client(object);
39+
```
40+
41+
**To:**
42+
43+
```javascript
44+
const obj = new A2AApp.a2aApp().setServices({ lock: LockService.getScriptLock() }).client(object);
45+
```
46+
47+
#### For Servers
48+
49+
Modify [A2A server 1_Google Sheets Manager Agent.js](https://github.com/tanaikech/A2AApp/blob/master/A2A%20server%201_Google%20Sheets%20Manager%20Agent.js) as follows. Apply the same change to other servers.
50+
51+
**From:**
52+
53+
```javascript
54+
const res = new A2AApp({ accessKey: "sample" }).server(object);
55+
```
56+
57+
**To:**
58+
59+
```javascript
60+
const res = new A2AApp.a2aApp({ accessKey: "sample" }).setServices({ lock: LockService.getScriptLock() }).server(object);
61+
```

0 commit comments

Comments
 (0)