aigency 0.0.1rc15474277__tar.gz → 0.0.1rc163779164__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aigency-0.0.1rc163779164/PKG-INFO +267 -0
- aigency-0.0.1rc163779164/README.md +255 -0
- aigency-0.0.1rc163779164/aigency/agents/client.py +59 -0
- aigency-0.0.1rc163779164/aigency/agents/communicator.py +107 -0
- aigency-0.0.1rc163779164/aigency/agents/generator.py +134 -0
- aigency-0.0.1rc163779164/aigency/schemas/agent/agent.py +16 -0
- aigency-0.0.1rc163779164/aigency/schemas/agent/model.py +12 -0
- aigency-0.0.1rc163779164/aigency/schemas/agent/remote_agent.py +9 -0
- aigency-0.0.1rc163779164/aigency/schemas/agent/skills.py +10 -0
- {aigency-0.0.1rc15474277/aigency/models → aigency-0.0.1rc163779164/aigency/schemas/agent}/tools.py +19 -5
- aigency-0.0.1rc163779164/aigency/schemas/aigency_config.py +14 -0
- aigency-0.0.1rc163779164/aigency/schemas/metadata/metadata.py +8 -0
- aigency-0.0.1rc163779164/aigency/schemas/observability/observability.py +10 -0
- aigency-0.0.1rc163779164/aigency/schemas/observability/phoenix.py +6 -0
- aigency-0.0.1rc163779164/aigency/schemas/service/capabilities.py +5 -0
- aigency-0.0.1rc163779164/aigency/schemas/service/interface.py +7 -0
- aigency-0.0.1rc163779164/aigency/schemas/service/service.py +9 -0
- {aigency-0.0.1rc15474277 → aigency-0.0.1rc163779164}/aigency/tools/generator.py +3 -7
- {aigency-0.0.1rc15474277 → aigency-0.0.1rc163779164}/aigency/utils/config_service.py +38 -17
- {aigency-0.0.1rc15474277 → aigency-0.0.1rc163779164}/aigency/utils/utils.py +19 -1
- aigency-0.0.1rc163779164/aigency.egg-info/PKG-INFO +267 -0
- aigency-0.0.1rc163779164/aigency.egg-info/SOURCES.txt +29 -0
- {aigency-0.0.1rc15474277 → aigency-0.0.1rc163779164}/pyproject.toml +1 -1
- aigency-0.0.1rc15474277/PKG-INFO +0 -267
- aigency-0.0.1rc15474277/README.md +0 -255
- aigency-0.0.1rc15474277/aigency/agents/generator.py +0 -73
- aigency-0.0.1rc15474277/aigency/models/config.py +0 -69
- aigency-0.0.1rc15474277/aigency/models/core.py +0 -28
- aigency-0.0.1rc15474277/aigency.egg-info/PKG-INFO +0 -267
- aigency-0.0.1rc15474277/aigency.egg-info/SOURCES.txt +0 -18
- {aigency-0.0.1rc15474277 → aigency-0.0.1rc163779164}/aigency/__init__.py +0 -0
- {aigency-0.0.1rc15474277 → aigency-0.0.1rc163779164}/aigency/agents/executor.py +0 -0
- {aigency-0.0.1rc15474277 → aigency-0.0.1rc163779164}/aigency/utils/logger.py +0 -0
- {aigency-0.0.1rc15474277 → aigency-0.0.1rc163779164}/aigency/utils/singleton.py +0 -0
- {aigency-0.0.1rc15474277 → aigency-0.0.1rc163779164}/aigency.egg-info/dependency_links.txt +0 -0
- {aigency-0.0.1rc15474277 → aigency-0.0.1rc163779164}/aigency.egg-info/requires.txt +0 -0
- {aigency-0.0.1rc15474277 → aigency-0.0.1rc163779164}/aigency.egg-info/top_level.txt +0 -0
- {aigency-0.0.1rc15474277 → aigency-0.0.1rc163779164}/setup.cfg +0 -0
@@ -0,0 +1,267 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: aigency
|
3
|
+
Version: 0.0.1rc163779164
|
4
|
+
Summary: Add your description here
|
5
|
+
Requires-Python: >=3.12
|
6
|
+
Description-Content-Type: text/markdown
|
7
|
+
Requires-Dist: google-adk>=1.11.0
|
8
|
+
Requires-Dist: a2a-sdk==0.3.0
|
9
|
+
Requires-Dist: litellm<1.73.0,>=1.72.6
|
10
|
+
Requires-Dist: pyyaml==6.0.2
|
11
|
+
Requires-Dist: PyJWT==2.10.1
|
12
|
+
|
13
|
+
# aigency-lib
|
14
|
+
|
15
|
+
A library for creating and managing AI agents.
|
16
|
+
|
17
|
+
## Quick Start
|
18
|
+
|
19
|
+
To test a simple agent:
|
20
|
+
|
21
|
+
```bash
|
22
|
+
cd examples/simple_agents/hello_world_agent
|
23
|
+
docker compose up
|
24
|
+
```
|
25
|
+
|
26
|
+
## 🔧 Version Management
|
27
|
+
|
28
|
+
This project includes an automated system for managing versions in both development and production.
|
29
|
+
|
30
|
+
### Version Manager
|
31
|
+
|
32
|
+
The `scripts/version_manager.py` script helps you manage your package versions locally.
|
33
|
+
|
34
|
+
#### Available Commands
|
35
|
+
|
36
|
+
##### 1. View current information
|
37
|
+
```bash
|
38
|
+
python scripts/version_manager.py show
|
39
|
+
```
|
40
|
+
**What it does:**
|
41
|
+
- Shows the current version in `pyproject.toml`
|
42
|
+
- Shows the current git branch
|
43
|
+
- Shows the current commit
|
44
|
+
- If you're not on `main`, suggests a development version
|
45
|
+
|
46
|
+
**Example output:**
|
47
|
+
```
|
48
|
+
Current version: 0.0.1
|
49
|
+
Branch: feature/new-agent
|
50
|
+
Commit: a1b2c3d
|
51
|
+
Suggested dev version: 0.0.1.dev20250409143022+feature/new-agent.a1b2c3d
|
52
|
+
```
|
53
|
+
|
54
|
+
##### 2. Create development version
|
55
|
+
```bash
|
56
|
+
python scripts/version_manager.py dev
|
57
|
+
```
|
58
|
+
**What it does:**
|
59
|
+
- Takes the current version and creates a development version
|
60
|
+
- Format: `version.devYYYYMMDDHHMMSS+branch.commit`
|
61
|
+
- Automatically updates the `pyproject.toml`
|
62
|
+
|
63
|
+
**Example:**
|
64
|
+
```bash
|
65
|
+
# If you're on branch "feature/auth" with commit "abc123"
|
66
|
+
python scripts/version_manager.py dev
|
67
|
+
# Result: 0.0.1.dev20250409143022
|
68
|
+
```
|
69
|
+
|
70
|
+
##### 3. Set specific version
|
71
|
+
```bash
|
72
|
+
python scripts/version_manager.py set --version "0.1.0"
|
73
|
+
```
|
74
|
+
**What it does:**
|
75
|
+
- Changes the version to the one you specify
|
76
|
+
- Useful for releases or to fix versions
|
77
|
+
|
78
|
+
**Examples:**
|
79
|
+
```bash
|
80
|
+
# Release version
|
81
|
+
python scripts/version_manager.py set --version "1.0.0"
|
82
|
+
|
83
|
+
# Beta version
|
84
|
+
python scripts/version_manager.py set --version "1.0.0b1"
|
85
|
+
|
86
|
+
# Alpha version
|
87
|
+
python scripts/version_manager.py set --version "1.0.0a1"
|
88
|
+
```
|
89
|
+
|
90
|
+
##### 4. Create Release Candidate version
|
91
|
+
```bash
|
92
|
+
python scripts/version_manager.py rc --version "1.0.1"
|
93
|
+
```
|
94
|
+
**What it does:**
|
95
|
+
- Creates an RC version with the format `version-rc<commit>`
|
96
|
+
- Useful for preparing releases on `release/*` branches
|
97
|
+
|
98
|
+
##### 5. Validate current version
|
99
|
+
```bash
|
100
|
+
python scripts/version_manager.py validate
|
101
|
+
```
|
102
|
+
**What it does:**
|
103
|
+
- Validates that the current version is appropriate for the branch
|
104
|
+
- Verifies semantic format on `main` and `release/*` branches
|
105
|
+
|
106
|
+
##### 6. Create dev with custom base version
|
107
|
+
```bash
|
108
|
+
python scripts/version_manager.py dev --base-version "0.2.0"
|
109
|
+
```
|
110
|
+
**What it does:**
|
111
|
+
- Uses a different base version than the current one
|
112
|
+
- Useful when you want to prepare a dev version for the next release
|
113
|
+
|
114
|
+
### 🚀 Recommended Workflow
|
115
|
+
|
116
|
+
#### For daily development:
|
117
|
+
```bash
|
118
|
+
# 1. View current status
|
119
|
+
python scripts/version_manager.py show
|
120
|
+
|
121
|
+
# 2. If you're on a feature branch, create dev version
|
122
|
+
python scripts/version_manager.py dev
|
123
|
+
|
124
|
+
# 3. Make your changes and commits
|
125
|
+
git add .
|
126
|
+
git commit -m "feat: new functionality"
|
127
|
+
|
128
|
+
# 4. If you need to update the dev version (optional)
|
129
|
+
python scripts/version_manager.py dev
|
130
|
+
```
|
131
|
+
|
132
|
+
#### For releases:
|
133
|
+
```bash
|
134
|
+
# 1. On main branch, set release version
|
135
|
+
python scripts/version_manager.py set --version "1.0.0"
|
136
|
+
|
137
|
+
# 2. Commit the version
|
138
|
+
git add pyproject.toml
|
139
|
+
git commit -m "bump: version 1.0.0"
|
140
|
+
|
141
|
+
# 3. Use GitHub workflow to publish
|
142
|
+
```
|
143
|
+
|
144
|
+
#### For testing:
|
145
|
+
```bash
|
146
|
+
# Create specific test version
|
147
|
+
python scripts/version_manager.py set --version "1.0.0rc1"
|
148
|
+
```
|
149
|
+
|
150
|
+
### ⚠️ PyPI Limitations
|
151
|
+
|
152
|
+
PyPI doesn't allow "local versions" (versions with `+` and local identifiers). That's why we've adapted the format:
|
153
|
+
|
154
|
+
- ❌ Not allowed: `1.0.0.dev20250409+feature.abc123`
|
155
|
+
- ✅ Allowed: `1.0.0.dev20250409`
|
156
|
+
|
157
|
+
**Solution for Release Candidates:**
|
158
|
+
- We convert the commit hash (hexadecimal) to decimal
|
159
|
+
- Example: commit `abc123` → `11256099` → version `1.0.1rc11256099`
|
160
|
+
- This maintains commit uniqueness in a PyPI-compatible format
|
161
|
+
|
162
|
+
**Result:**
|
163
|
+
- Dev versions include unique timestamp
|
164
|
+
- RC versions include commit hash (in decimal)
|
165
|
+
- We maintain traceability without using local versions
|
166
|
+
|
167
|
+
### 📋 Practical Use Cases
|
168
|
+
|
169
|
+
**Scenario 1: Working on a feature**
|
170
|
+
```bash
|
171
|
+
git checkout -b feature/new-auth
|
172
|
+
python scripts/version_manager.py dev
|
173
|
+
# Now you have: 0.0.1.dev20250409143022
|
174
|
+
```
|
175
|
+
|
176
|
+
**Scenario 2: Preparing release**
|
177
|
+
```bash
|
178
|
+
git checkout main
|
179
|
+
python scripts/version_manager.py set --version "1.0.0"
|
180
|
+
git add pyproject.toml
|
181
|
+
git commit -m "release: v1.0.0"
|
182
|
+
```
|
183
|
+
|
184
|
+
**Scenario 3: Preparing Release Candidate**
|
185
|
+
```bash
|
186
|
+
git checkout -b release/1.0.1
|
187
|
+
python scripts/version_manager.py rc --version "1.0.1"
|
188
|
+
# Result: 1.0.1rc12345678 (where 12345678 is the commit hash in decimal)
|
189
|
+
```
|
190
|
+
|
191
|
+
**Scenario 4: Urgent hotfix**
|
192
|
+
```bash
|
193
|
+
git checkout -b hotfix/critical-bug
|
194
|
+
python scripts/version_manager.py dev --base-version "1.0.1"
|
195
|
+
# Result: 1.0.1.dev20250409143022
|
196
|
+
```
|
197
|
+
|
198
|
+
## 🔄 Intelligent CI/CD Workflow
|
199
|
+
|
200
|
+
The project includes a single intelligent workflow (`python-publish.yml`) that automatically handles different version types based on the branch:
|
201
|
+
|
202
|
+
### Automatic behavior by branch:
|
203
|
+
|
204
|
+
#### 🚀 `main` Branch - Production Versions
|
205
|
+
- **Trigger**: Push to `main` or manual execution
|
206
|
+
- **Version**: Uses exactly the version from `pyproject.toml`
|
207
|
+
- **Validations**:
|
208
|
+
- ✅ Verifies it's a valid semantic version (e.g.: `1.0.0`)
|
209
|
+
- ✅ Verifies it doesn't already exist on PyPI
|
210
|
+
- ❌ Fails if it contains development suffixes (`dev`, `rc`, `alpha`, `beta`)
|
211
|
+
- **Target**: PyPI production
|
212
|
+
|
213
|
+
#### 🎯 `release/*` Branches - Release Candidates
|
214
|
+
- **Trigger**: Push to `release/X.Y.Z` branch or manual execution
|
215
|
+
- **Version**: `X.Y.ZrcN` where N is the commit hash in decimal (e.g.: `1.0.1rc12345678`)
|
216
|
+
- **Validations**:
|
217
|
+
- ✅ Verifies that `X.Y.Z` is a valid semantic version
|
218
|
+
- ✅ Extracts version from branch name
|
219
|
+
- ✅ Uses commit hash as unique identifier
|
220
|
+
- ✅ PyPI-compatible format
|
221
|
+
- **Target**: PyPI production
|
222
|
+
- **Example**: Branch `release/1.0.1` + commit `abc123` → Version `1.0.1rc11256099`
|
223
|
+
|
224
|
+
#### 🔧 Other Branches - Development Versions
|
225
|
+
- **Trigger**: Push to any other branch or manual execution
|
226
|
+
- **Version**: `current.devYYYYMMDDHHMMSS` (e.g.: `0.0.1.dev20250409143022`)
|
227
|
+
- **Target**: PyPI production
|
228
|
+
- **Note**: No local versions for PyPI compatibility
|
229
|
+
|
230
|
+
### Recommended workflow:
|
231
|
+
|
232
|
+
```bash
|
233
|
+
# 1. Development on feature branch
|
234
|
+
git checkout -b feature/new-functionality
|
235
|
+
# Automatic version: 0.0.1.dev20250409143022+feature-new-functionality.abc123
|
236
|
+
|
237
|
+
# 2. Prepare release
|
238
|
+
git checkout -b release/1.0.0
|
239
|
+
git push origin release/1.0.0
|
240
|
+
# Automatic version: 1.0.0rc12345678
|
241
|
+
|
242
|
+
# 3. Final release
|
243
|
+
git checkout main
|
244
|
+
python scripts/version_manager.py set --version "1.0.0"
|
245
|
+
git add pyproject.toml
|
246
|
+
git commit -m "release: v1.0.0"
|
247
|
+
git push origin main
|
248
|
+
# Version: 1.0.0 (with validations)
|
249
|
+
```
|
250
|
+
|
251
|
+
## 📦 Installation
|
252
|
+
|
253
|
+
```bash
|
254
|
+
pip install aigency
|
255
|
+
```
|
256
|
+
|
257
|
+
## 🛠️ Development
|
258
|
+
|
259
|
+
1. Clone the repository
|
260
|
+
2. Install development dependencies
|
261
|
+
3. Use the version manager to manage versions during development
|
262
|
+
|
263
|
+
```bash
|
264
|
+
git clone <repo-url>
|
265
|
+
cd aigency-lib
|
266
|
+
pip install -e .
|
267
|
+
```
|
@@ -0,0 +1,255 @@
|
|
1
|
+
# aigency-lib
|
2
|
+
|
3
|
+
A library for creating and managing AI agents.
|
4
|
+
|
5
|
+
## Quick Start
|
6
|
+
|
7
|
+
To test a simple agent:
|
8
|
+
|
9
|
+
```bash
|
10
|
+
cd examples/simple_agents/hello_world_agent
|
11
|
+
docker compose up
|
12
|
+
```
|
13
|
+
|
14
|
+
## 🔧 Version Management
|
15
|
+
|
16
|
+
This project includes an automated system for managing versions in both development and production.
|
17
|
+
|
18
|
+
### Version Manager
|
19
|
+
|
20
|
+
The `scripts/version_manager.py` script helps you manage your package versions locally.
|
21
|
+
|
22
|
+
#### Available Commands
|
23
|
+
|
24
|
+
##### 1. View current information
|
25
|
+
```bash
|
26
|
+
python scripts/version_manager.py show
|
27
|
+
```
|
28
|
+
**What it does:**
|
29
|
+
- Shows the current version in `pyproject.toml`
|
30
|
+
- Shows the current git branch
|
31
|
+
- Shows the current commit
|
32
|
+
- If you're not on `main`, suggests a development version
|
33
|
+
|
34
|
+
**Example output:**
|
35
|
+
```
|
36
|
+
Current version: 0.0.1
|
37
|
+
Branch: feature/new-agent
|
38
|
+
Commit: a1b2c3d
|
39
|
+
Suggested dev version: 0.0.1.dev20250409143022+feature/new-agent.a1b2c3d
|
40
|
+
```
|
41
|
+
|
42
|
+
##### 2. Create development version
|
43
|
+
```bash
|
44
|
+
python scripts/version_manager.py dev
|
45
|
+
```
|
46
|
+
**What it does:**
|
47
|
+
- Takes the current version and creates a development version
|
48
|
+
- Format: `version.devYYYYMMDDHHMMSS+branch.commit`
|
49
|
+
- Automatically updates the `pyproject.toml`
|
50
|
+
|
51
|
+
**Example:**
|
52
|
+
```bash
|
53
|
+
# If you're on branch "feature/auth" with commit "abc123"
|
54
|
+
python scripts/version_manager.py dev
|
55
|
+
# Result: 0.0.1.dev20250409143022
|
56
|
+
```
|
57
|
+
|
58
|
+
##### 3. Set specific version
|
59
|
+
```bash
|
60
|
+
python scripts/version_manager.py set --version "0.1.0"
|
61
|
+
```
|
62
|
+
**What it does:**
|
63
|
+
- Changes the version to the one you specify
|
64
|
+
- Useful for releases or to fix versions
|
65
|
+
|
66
|
+
**Examples:**
|
67
|
+
```bash
|
68
|
+
# Release version
|
69
|
+
python scripts/version_manager.py set --version "1.0.0"
|
70
|
+
|
71
|
+
# Beta version
|
72
|
+
python scripts/version_manager.py set --version "1.0.0b1"
|
73
|
+
|
74
|
+
# Alpha version
|
75
|
+
python scripts/version_manager.py set --version "1.0.0a1"
|
76
|
+
```
|
77
|
+
|
78
|
+
##### 4. Create Release Candidate version
|
79
|
+
```bash
|
80
|
+
python scripts/version_manager.py rc --version "1.0.1"
|
81
|
+
```
|
82
|
+
**What it does:**
|
83
|
+
- Creates an RC version with the format `version-rc<commit>`
|
84
|
+
- Useful for preparing releases on `release/*` branches
|
85
|
+
|
86
|
+
##### 5. Validate current version
|
87
|
+
```bash
|
88
|
+
python scripts/version_manager.py validate
|
89
|
+
```
|
90
|
+
**What it does:**
|
91
|
+
- Validates that the current version is appropriate for the branch
|
92
|
+
- Verifies semantic format on `main` and `release/*` branches
|
93
|
+
|
94
|
+
##### 6. Create dev with custom base version
|
95
|
+
```bash
|
96
|
+
python scripts/version_manager.py dev --base-version "0.2.0"
|
97
|
+
```
|
98
|
+
**What it does:**
|
99
|
+
- Uses a different base version than the current one
|
100
|
+
- Useful when you want to prepare a dev version for the next release
|
101
|
+
|
102
|
+
### 🚀 Recommended Workflow
|
103
|
+
|
104
|
+
#### For daily development:
|
105
|
+
```bash
|
106
|
+
# 1. View current status
|
107
|
+
python scripts/version_manager.py show
|
108
|
+
|
109
|
+
# 2. If you're on a feature branch, create dev version
|
110
|
+
python scripts/version_manager.py dev
|
111
|
+
|
112
|
+
# 3. Make your changes and commits
|
113
|
+
git add .
|
114
|
+
git commit -m "feat: new functionality"
|
115
|
+
|
116
|
+
# 4. If you need to update the dev version (optional)
|
117
|
+
python scripts/version_manager.py dev
|
118
|
+
```
|
119
|
+
|
120
|
+
#### For releases:
|
121
|
+
```bash
|
122
|
+
# 1. On main branch, set release version
|
123
|
+
python scripts/version_manager.py set --version "1.0.0"
|
124
|
+
|
125
|
+
# 2. Commit the version
|
126
|
+
git add pyproject.toml
|
127
|
+
git commit -m "bump: version 1.0.0"
|
128
|
+
|
129
|
+
# 3. Use GitHub workflow to publish
|
130
|
+
```
|
131
|
+
|
132
|
+
#### For testing:
|
133
|
+
```bash
|
134
|
+
# Create specific test version
|
135
|
+
python scripts/version_manager.py set --version "1.0.0rc1"
|
136
|
+
```
|
137
|
+
|
138
|
+
### ⚠️ PyPI Limitations
|
139
|
+
|
140
|
+
PyPI doesn't allow "local versions" (versions with `+` and local identifiers). That's why we've adapted the format:
|
141
|
+
|
142
|
+
- ❌ Not allowed: `1.0.0.dev20250409+feature.abc123`
|
143
|
+
- ✅ Allowed: `1.0.0.dev20250409`
|
144
|
+
|
145
|
+
**Solution for Release Candidates:**
|
146
|
+
- We convert the commit hash (hexadecimal) to decimal
|
147
|
+
- Example: commit `abc123` → `11256099` → version `1.0.1rc11256099`
|
148
|
+
- This maintains commit uniqueness in a PyPI-compatible format
|
149
|
+
|
150
|
+
**Result:**
|
151
|
+
- Dev versions include unique timestamp
|
152
|
+
- RC versions include commit hash (in decimal)
|
153
|
+
- We maintain traceability without using local versions
|
154
|
+
|
155
|
+
### 📋 Practical Use Cases
|
156
|
+
|
157
|
+
**Scenario 1: Working on a feature**
|
158
|
+
```bash
|
159
|
+
git checkout -b feature/new-auth
|
160
|
+
python scripts/version_manager.py dev
|
161
|
+
# Now you have: 0.0.1.dev20250409143022
|
162
|
+
```
|
163
|
+
|
164
|
+
**Scenario 2: Preparing release**
|
165
|
+
```bash
|
166
|
+
git checkout main
|
167
|
+
python scripts/version_manager.py set --version "1.0.0"
|
168
|
+
git add pyproject.toml
|
169
|
+
git commit -m "release: v1.0.0"
|
170
|
+
```
|
171
|
+
|
172
|
+
**Scenario 3: Preparing Release Candidate**
|
173
|
+
```bash
|
174
|
+
git checkout -b release/1.0.1
|
175
|
+
python scripts/version_manager.py rc --version "1.0.1"
|
176
|
+
# Result: 1.0.1rc12345678 (where 12345678 is the commit hash in decimal)
|
177
|
+
```
|
178
|
+
|
179
|
+
**Scenario 4: Urgent hotfix**
|
180
|
+
```bash
|
181
|
+
git checkout -b hotfix/critical-bug
|
182
|
+
python scripts/version_manager.py dev --base-version "1.0.1"
|
183
|
+
# Result: 1.0.1.dev20250409143022
|
184
|
+
```
|
185
|
+
|
186
|
+
## 🔄 Intelligent CI/CD Workflow
|
187
|
+
|
188
|
+
The project includes a single intelligent workflow (`python-publish.yml`) that automatically handles different version types based on the branch:
|
189
|
+
|
190
|
+
### Automatic behavior by branch:
|
191
|
+
|
192
|
+
#### 🚀 `main` Branch - Production Versions
|
193
|
+
- **Trigger**: Push to `main` or manual execution
|
194
|
+
- **Version**: Uses exactly the version from `pyproject.toml`
|
195
|
+
- **Validations**:
|
196
|
+
- ✅ Verifies it's a valid semantic version (e.g.: `1.0.0`)
|
197
|
+
- ✅ Verifies it doesn't already exist on PyPI
|
198
|
+
- ❌ Fails if it contains development suffixes (`dev`, `rc`, `alpha`, `beta`)
|
199
|
+
- **Target**: PyPI production
|
200
|
+
|
201
|
+
#### 🎯 `release/*` Branches - Release Candidates
|
202
|
+
- **Trigger**: Push to `release/X.Y.Z` branch or manual execution
|
203
|
+
- **Version**: `X.Y.ZrcN` where N is the commit hash in decimal (e.g.: `1.0.1rc12345678`)
|
204
|
+
- **Validations**:
|
205
|
+
- ✅ Verifies that `X.Y.Z` is a valid semantic version
|
206
|
+
- ✅ Extracts version from branch name
|
207
|
+
- ✅ Uses commit hash as unique identifier
|
208
|
+
- ✅ PyPI-compatible format
|
209
|
+
- **Target**: PyPI production
|
210
|
+
- **Example**: Branch `release/1.0.1` + commit `abc123` → Version `1.0.1rc11256099`
|
211
|
+
|
212
|
+
#### 🔧 Other Branches - Development Versions
|
213
|
+
- **Trigger**: Push to any other branch or manual execution
|
214
|
+
- **Version**: `current.devYYYYMMDDHHMMSS` (e.g.: `0.0.1.dev20250409143022`)
|
215
|
+
- **Target**: PyPI production
|
216
|
+
- **Note**: No local versions for PyPI compatibility
|
217
|
+
|
218
|
+
### Recommended workflow:
|
219
|
+
|
220
|
+
```bash
|
221
|
+
# 1. Development on feature branch
|
222
|
+
git checkout -b feature/new-functionality
|
223
|
+
# Automatic version: 0.0.1.dev20250409143022+feature-new-functionality.abc123
|
224
|
+
|
225
|
+
# 2. Prepare release
|
226
|
+
git checkout -b release/1.0.0
|
227
|
+
git push origin release/1.0.0
|
228
|
+
# Automatic version: 1.0.0rc12345678
|
229
|
+
|
230
|
+
# 3. Final release
|
231
|
+
git checkout main
|
232
|
+
python scripts/version_manager.py set --version "1.0.0"
|
233
|
+
git add pyproject.toml
|
234
|
+
git commit -m "release: v1.0.0"
|
235
|
+
git push origin main
|
236
|
+
# Version: 1.0.0 (with validations)
|
237
|
+
```
|
238
|
+
|
239
|
+
## 📦 Installation
|
240
|
+
|
241
|
+
```bash
|
242
|
+
pip install aigency
|
243
|
+
```
|
244
|
+
|
245
|
+
## 🛠️ Development
|
246
|
+
|
247
|
+
1. Clone the repository
|
248
|
+
2. Install development dependencies
|
249
|
+
3. Use the version manager to manage versions during development
|
250
|
+
|
251
|
+
```bash
|
252
|
+
git clone <repo-url>
|
253
|
+
cd aigency-lib
|
254
|
+
pip install -e .
|
255
|
+
```
|
@@ -0,0 +1,59 @@
|
|
1
|
+
import httpx
|
2
|
+
|
3
|
+
from a2a.client.client import ClientConfig
|
4
|
+
from a2a.client.client_factory import ClientFactory
|
5
|
+
from a2a.types import AgentCard, Message, SendMessageResponse
|
6
|
+
#TODO: Enable when auth is implemented
|
7
|
+
#from a2a.client.auth.interceptor import AuthInterceptor
|
8
|
+
|
9
|
+
|
10
|
+
class AgentClient:
|
11
|
+
"""A class to hold the connections to the remote agents.
|
12
|
+
|
13
|
+
This class manages connections to remote agents using the A2A protocol.
|
14
|
+
It provides methods for retrieving agent information and sending messages
|
15
|
+
to remote agents.
|
16
|
+
|
17
|
+
Attributes:
|
18
|
+
_httpx_client (httpx.AsyncClient): The HTTP client used for asynchronous requests.
|
19
|
+
agent_card (AgentCard): The agent card containing metadata about the remote agent.
|
20
|
+
"""
|
21
|
+
|
22
|
+
def __init__(self, agent_card: AgentCard):
|
23
|
+
"""Initialize a connection to a remote agent.
|
24
|
+
|
25
|
+
Args:
|
26
|
+
agent_card (AgentCard): The agent card containing metadata about the remote agent.
|
27
|
+
|
28
|
+
Raises:
|
29
|
+
None
|
30
|
+
|
31
|
+
Returns:
|
32
|
+
None
|
33
|
+
"""
|
34
|
+
self._httpx_client = httpx.AsyncClient(timeout=60)
|
35
|
+
self.card = agent_card
|
36
|
+
|
37
|
+
config = ClientConfig(httpx_client=self._httpx_client)
|
38
|
+
factory = ClientFactory(config=config)
|
39
|
+
self.agent_client = factory.create(agent_card)
|
40
|
+
|
41
|
+
def get_agent(self) -> AgentCard:
|
42
|
+
"""Get the agent card for this remote agent connection.
|
43
|
+
|
44
|
+
Returns:
|
45
|
+
AgentCard: The agent card containing metadata about the remote agent.
|
46
|
+
"""
|
47
|
+
return self.card
|
48
|
+
|
49
|
+
async def send_message(self, message_request: Message) -> SendMessageResponse:
|
50
|
+
"""Send a message to the remote agent.
|
51
|
+
|
52
|
+
Args:
|
53
|
+
message_request (Message): The message request to send to the remote agent.
|
54
|
+
|
55
|
+
Returns:
|
56
|
+
SendMessageResponse: The response from the remote agent.
|
57
|
+
"""
|
58
|
+
async for response in self.agent_client.send_message(message_request):
|
59
|
+
yield response
|
@@ -0,0 +1,107 @@
|
|
1
|
+
import logging
|
2
|
+
import uuid
|
3
|
+
from typing import Any
|
4
|
+
from a2a.types import Message, Task
|
5
|
+
from google.adk.tools.tool_context import ToolContext
|
6
|
+
|
7
|
+
logging.basicConfig(level=logging.INFO)
|
8
|
+
logger = logging.getLogger(__name__)
|
9
|
+
|
10
|
+
|
11
|
+
class Communicator:
|
12
|
+
"""Base class for Agent-to-Agent communication."""
|
13
|
+
|
14
|
+
def __init__(self, remote_agent_connections=None):
|
15
|
+
self.remote_agent_connections = remote_agent_connections
|
16
|
+
|
17
|
+
async def send_message(self, agent_name: str, task: str, tool_context: ToolContext):
|
18
|
+
"""Delegate a task to a specified remote agent.
|
19
|
+
|
20
|
+
This method sends a message to a remote agent, requesting it to perform a task.
|
21
|
+
It handles the creation of the message payload and manages the communication
|
22
|
+
with the remote agent.
|
23
|
+
|
24
|
+
Args:
|
25
|
+
agent_name: Name of the remote agent to send the task to.
|
26
|
+
task: Detailed description of the task for the remote agent to perform.
|
27
|
+
tool_context: Context object containing state and other information.
|
28
|
+
|
29
|
+
Returns:
|
30
|
+
Task object if successful, None otherwise.
|
31
|
+
|
32
|
+
Raises:
|
33
|
+
ValueError: If the specified agent is not found in the available connections.
|
34
|
+
"""
|
35
|
+
logger.info(
|
36
|
+
f"`send_message` triggered with agent_name: {agent_name}, task: {task}"
|
37
|
+
)
|
38
|
+
if agent_name not in self.remote_agent_connections:
|
39
|
+
logger.error(
|
40
|
+
f"LLM tried to call '{agent_name}' but it was not found. "
|
41
|
+
f"Available agents: {list(self.remote_agent_connections.keys())}"
|
42
|
+
)
|
43
|
+
raise ValueError(f"Agent '{agent_name}' not found.")
|
44
|
+
|
45
|
+
state = tool_context.state
|
46
|
+
client = self.remote_agent_connections[agent_name]
|
47
|
+
|
48
|
+
if "remote_agent_contexts" not in state:
|
49
|
+
state["remote_agent_contexts"] = {}
|
50
|
+
|
51
|
+
if agent_name not in state["remote_agent_contexts"]:
|
52
|
+
logger.debug(f"Creating new context for agent: {agent_name}")
|
53
|
+
state["remote_agent_contexts"][agent_name] = {
|
54
|
+
"context_id": str(uuid.uuid4())
|
55
|
+
}
|
56
|
+
context_id = state["remote_agent_contexts"][agent_name]["context_id"]
|
57
|
+
task_id = state.get("task_id", None)
|
58
|
+
message_id = state.get("input_message_metadata", {}).get(
|
59
|
+
"message_id", str(uuid.uuid4())
|
60
|
+
)
|
61
|
+
|
62
|
+
payload = self.create_send_message_payload(task, task_id, context_id)
|
63
|
+
payload["message"]["message_id"] = message_id
|
64
|
+
logger.debug("`send_message` triggered with payload: %s", payload)
|
65
|
+
|
66
|
+
send_response = None
|
67
|
+
async for resp in client.send_message(
|
68
|
+
message_request=Message(**payload.get("message"))
|
69
|
+
):
|
70
|
+
send_response = resp
|
71
|
+
|
72
|
+
if isinstance(send_response, tuple):
|
73
|
+
send_response, _ = send_response
|
74
|
+
|
75
|
+
if not isinstance(send_response, Task):
|
76
|
+
return None
|
77
|
+
return send_response
|
78
|
+
|
79
|
+
@staticmethod
|
80
|
+
def create_send_message_payload(
|
81
|
+
text: str,
|
82
|
+
task_id: str | None = None,
|
83
|
+
context_id: str | None = None,
|
84
|
+
) -> dict[str, Any]:
|
85
|
+
"""Create a message payload for sending to a remote agent.
|
86
|
+
|
87
|
+
Args:
|
88
|
+
text: The text content of the message.
|
89
|
+
task_id: Optional task ID to associate with the message.
|
90
|
+
context_id: Optional context ID to associate with the message.
|
91
|
+
|
92
|
+
Returns:
|
93
|
+
dict: A dictionary containing the formatted message payload ready
|
94
|
+
to be sent to a remote agent.
|
95
|
+
"""
|
96
|
+
payload: dict[str, Any] = {
|
97
|
+
"message": {
|
98
|
+
"role": "user",
|
99
|
+
"parts": [{"type": "text", "text": text}],
|
100
|
+
"message_id": uuid.uuid4().hex,
|
101
|
+
},
|
102
|
+
}
|
103
|
+
if task_id:
|
104
|
+
payload["message"]["task_id"] = task_id
|
105
|
+
if context_id:
|
106
|
+
payload["message"]["context_id"] = context_id
|
107
|
+
return payload
|