agbr 0.2.0__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.
- agbr-0.2.0/LICENSE +22 -0
- agbr-0.2.0/PKG-INFO +511 -0
- agbr-0.2.0/README.md +486 -0
- agbr-0.2.0/pyproject.toml +32 -0
- agbr-0.2.0/setup.cfg +4 -0
- agbr-0.2.0/src/agbr.egg-info/PKG-INFO +511 -0
- agbr-0.2.0/src/agbr.egg-info/SOURCES.txt +22 -0
- agbr-0.2.0/src/agbr.egg-info/dependency_links.txt +1 -0
- agbr-0.2.0/src/agbr.egg-info/entry_points.txt +2 -0
- agbr-0.2.0/src/agbr.egg-info/requires.txt +10 -0
- agbr-0.2.0/src/agbr.egg-info/top_level.txt +1 -0
- agbr-0.2.0/src/agentbridge/__init__.py +17 -0
- agbr-0.2.0/src/agentbridge/__main__.py +5 -0
- agbr-0.2.0/src/agentbridge/agent.py +405 -0
- agbr-0.2.0/src/agentbridge/cli.py +145 -0
- agbr-0.2.0/src/agentbridge/discovery.py +349 -0
- agbr-0.2.0/src/agentbridge/generator.py +408 -0
- agbr-0.2.0/src/agentbridge/io.py +87 -0
- agbr-0.2.0/src/agentbridge/models.py +101 -0
- agbr-0.2.0/src/agentbridge/naming.py +94 -0
- agbr-0.2.0/src/agentbridge/policy.py +97 -0
- agbr-0.2.0/src/agentbridge/runtime.py +83 -0
- agbr-0.2.0/tests/test_discovery.py +32 -0
- agbr-0.2.0/tests/test_generator_runtime.py +59 -0
agbr-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AgentBridge contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
agbr-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,511 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agbr
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Generate Agent Integration Kits for existing systems with AI-powered dynamic generation via Claude Agent SDK.
|
|
5
|
+
Author: AgentBridge contributors
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Keywords: agents,mcp,tools,ai-assistant,openapi,graphql,claude,anthropic,claude-agent-sdk
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Requires-Python: >=3.10
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Provides-Extra: agent
|
|
18
|
+
Requires-Dist: claude-agent-sdk>=0.1.0; extra == "agent"
|
|
19
|
+
Provides-Extra: ai
|
|
20
|
+
Requires-Dist: anthropic>=0.30.0; extra == "ai"
|
|
21
|
+
Provides-Extra: all
|
|
22
|
+
Requires-Dist: claude-agent-sdk>=0.1.0; extra == "all"
|
|
23
|
+
Requires-Dist: anthropic>=0.30.0; extra == "all"
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
<div align="center">
|
|
27
|
+
|
|
28
|
+
# π AgentBridge
|
|
29
|
+
|
|
30
|
+
**Turn your existing system into an AI-agent-ready platform β in seconds.**
|
|
31
|
+
|
|
32
|
+
[](LICENSE)
|
|
33
|
+
[](https://www.python.org/)
|
|
34
|
+
[](CONTRIBUTING.md)
|
|
35
|
+
|
|
36
|
+
[English](README.md) Β· [δΈζ](README.zh-CN.md)
|
|
37
|
+
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
AgentBridge discovers capabilities from your API schemas, database schemas, and source routes, then generates a complete **Agent Integration Kit** that works with MCP, Claude, OpenAI, and Vercel AI SDK out of the box.
|
|
43
|
+
|
|
44
|
+
With built-in **Claude Agent SDK** support and **AI-powered dynamic generation**, AgentBridge goes beyond static templates β it uses AI to craft richer tool definitions, domain-specific skills, and intelligent prompts tailored to your system.
|
|
45
|
+
|
|
46
|
+
## π Table of Contents
|
|
47
|
+
|
|
48
|
+
- [β¨ Features](#-features)
|
|
49
|
+
- [π Quick Start](#-quick-start)
|
|
50
|
+
- [π CLI Reference](#-cli-reference)
|
|
51
|
+
- [π What AgentBridge Discovers](#-what-agentbridge-discovers)
|
|
52
|
+
- [π Generated Kit Layout](#-generated-kit-layout)
|
|
53
|
+
- [π€ AI-Powered Generation](#-ai-powered-generation)
|
|
54
|
+
- [π‘οΈ Safety Model](#-safety-model)
|
|
55
|
+
- [ποΈ Architecture](#-architecture)
|
|
56
|
+
- [π§© Extending AgentBridge](#-extending-agentbridge)
|
|
57
|
+
- [π¦ Publishing & Installation](#-publishing--installation)
|
|
58
|
+
- [π€ Contributing](#-contributing)
|
|
59
|
+
- [π License](#-license)
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## β¨ Features
|
|
64
|
+
|
|
65
|
+
<table>
|
|
66
|
+
<tr><td width="50%">
|
|
67
|
+
|
|
68
|
+
π **Auto-discovery**
|
|
69
|
+
Extracts capabilities from OpenAPI, GraphQL, SQL, and source code routes (Python/Flask/FastAPI, JS/Express, Java/Spring)
|
|
70
|
+
|
|
71
|
+
</td><td width="50%">
|
|
72
|
+
|
|
73
|
+
π§ **Multi-format Generation**
|
|
74
|
+
Outputs MCP, Claude, OpenAI, and Vercel AI SDK tool definitions simultaneously
|
|
75
|
+
|
|
76
|
+
</td></tr>
|
|
77
|
+
<tr><td>
|
|
78
|
+
|
|
79
|
+
π€ **AI-Powered Generation**
|
|
80
|
+
Uses Claude Agent SDK (primary) or Anthropic API (fallback) to dynamically generate tools, skills, and prompts
|
|
81
|
+
|
|
82
|
+
</td><td>
|
|
83
|
+
|
|
84
|
+
π§ **Agent as a Service**
|
|
85
|
+
Runs as an interactive agent for your existing project via Claude Agent SDK
|
|
86
|
+
|
|
87
|
+
</td></tr>
|
|
88
|
+
<tr><td>
|
|
89
|
+
|
|
90
|
+
π‘οΈ **Safety-first**
|
|
91
|
+
Classifies operations by risk level with human-in-the-loop confirmation for dangerous actions
|
|
92
|
+
|
|
93
|
+
</td><td>
|
|
94
|
+
|
|
95
|
+
π§ͺ **Dry-run Validation**
|
|
96
|
+
Test tool invocations against generated guardrails before executing
|
|
97
|
+
|
|
98
|
+
</td></tr>
|
|
99
|
+
<tr><td>
|
|
100
|
+
|
|
101
|
+
π **Custom LLM Providers**
|
|
102
|
+
Supports DeepSeek, OpenRouter, and any Anthropic-compatible endpoint
|
|
103
|
+
|
|
104
|
+
</td><td>
|
|
105
|
+
|
|
106
|
+
πͺΆ **Dependency-light Core**
|
|
107
|
+
Deterministic generator runs on Python standard library only; AI features are opt-in
|
|
108
|
+
|
|
109
|
+
</td></tr>
|
|
110
|
+
</table>
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## π Quick Start
|
|
115
|
+
|
|
116
|
+
### Installation
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
pip install agbr
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
<details>
|
|
123
|
+
<summary>π¦ Install with optional features</summary>
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
# AI-powered generation + agent sessions (recommended)
|
|
127
|
+
pip install "agbr[agent]"
|
|
128
|
+
|
|
129
|
+
# Lightweight AI generation (no Claude Agent SDK)
|
|
130
|
+
pip install "agbr[ai]"
|
|
131
|
+
|
|
132
|
+
# Everything
|
|
133
|
+
pip install "agbr[all]"
|
|
134
|
+
|
|
135
|
+
# Install from source (for development)
|
|
136
|
+
git clone https://github.com/your-username/AgentBridge.git
|
|
137
|
+
cd AgentBridge
|
|
138
|
+
pip install -e ".[all]"
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
</details>
|
|
142
|
+
|
|
143
|
+
### Configure LLM Provider
|
|
144
|
+
|
|
145
|
+
AgentBridge requires an LLM API key for AI features. By default it uses Anthropic's Claude, but you can configure any Anthropic-compatible provider:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
# Required
|
|
149
|
+
export ANTHROPIC_API_KEY="sk-ant-..."
|
|
150
|
+
|
|
151
|
+
# Optional: Custom API endpoint
|
|
152
|
+
export ANTHROPIC_BASE_URL="https://api.deepseek.com/anthropic" # DeepSeek
|
|
153
|
+
# export ANTHROPIC_BASE_URL="https://openrouter.ai/api/v1" # OpenRouter
|
|
154
|
+
|
|
155
|
+
# Optional: Custom model name
|
|
156
|
+
export ANTHROPIC_MODEL="deepseek-v4-flash"
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
<details>
|
|
160
|
+
<summary>π Or pass via CLI flags</summary>
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
agentbridge generate examples/writing_system --output build/kit --ai \
|
|
164
|
+
--api-key "sk-..." \
|
|
165
|
+
--base-url "https://api.deepseek.com/anthropic" \
|
|
166
|
+
--model "deepseek-v4-flash"
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
> **Note:** When `ANTHROPIC_BASE_URL` is set, AgentBridge automatically uses the `anthropic` SDK backend (not `claude-agent-sdk`) for generation, since custom endpoints are not supported by the agent SDK.
|
|
170
|
+
|
|
171
|
+
</details>
|
|
172
|
+
|
|
173
|
+
### Generate an Agent Integration Kit
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
# Deterministic generation (no API key needed)
|
|
177
|
+
agentbridge generate examples/writing_system --output .agentbridge/writing-kit
|
|
178
|
+
|
|
179
|
+
# AI-powered generation (requires API key)
|
|
180
|
+
agentbridge generate examples/writing_system --output .agentbridge/writing-kit --ai
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Run as an Agent
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
agentbridge chat .agentbridge/writing-kit
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Run Tests
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
PYTHONPATH=src python -m unittest discover -s tests
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## π CLI Reference
|
|
198
|
+
|
|
199
|
+
| Command | Description |
|
|
200
|
+
|---|---|
|
|
201
|
+
| `agentbridge discover <paths>` | Discover and print capabilities as JSON |
|
|
202
|
+
| `agentbridge generate <paths> -o <dir>` | Generate an Agent Integration Kit |
|
|
203
|
+
| `agentbridge dry-run <kit> <tool>` | Dry-run a tool invocation |
|
|
204
|
+
| `agentbridge chat <kit>` | Start an interactive AI agent session |
|
|
205
|
+
|
|
206
|
+
<details>
|
|
207
|
+
<summary>π Full command details</summary>
|
|
208
|
+
|
|
209
|
+
### `discover`
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
agentbridge discover examples/writing_system
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### `generate`
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
# Deterministic
|
|
219
|
+
agentbridge generate examples/writing_system --output build/agent-kit
|
|
220
|
+
|
|
221
|
+
# AI-powered
|
|
222
|
+
agentbridge generate examples/writing_system --output build/agent-kit --ai
|
|
223
|
+
|
|
224
|
+
# With custom name
|
|
225
|
+
agentbridge generate examples/writing_system --output build/agent-kit --name my-kit
|
|
226
|
+
|
|
227
|
+
# With custom LLM provider
|
|
228
|
+
agentbridge generate examples/writing_system --output build/agent-kit --ai \
|
|
229
|
+
--api-key "sk-..." --base-url "https://api.deepseek.com/anthropic" --model "deepseek-v4-flash"
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### `dry-run`
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
# Normal invocation
|
|
236
|
+
agentbridge dry-run build/agent-kit create_chapter --args '{"project_id":"p1","title":"Opening"}'
|
|
237
|
+
|
|
238
|
+
# High-risk operation (requires confirmation)
|
|
239
|
+
agentbridge dry-run build/agent-kit delete_character \
|
|
240
|
+
--args '{"project_id":"p1","character_id":"c1"}' --confirmed
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### `chat`
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
agentbridge chat build/agent-kit
|
|
247
|
+
# Or with custom LLM provider:
|
|
248
|
+
agentbridge chat build/agent-kit --api-key "sk-..." --base-url "https://api.deepseek.com/anthropic"
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
</details>
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## π What AgentBridge Discovers
|
|
256
|
+
|
|
257
|
+
| Source Type | Formats |
|
|
258
|
+
|---|---|
|
|
259
|
+
| π API Schemas | OpenAPI JSON/YAML, GraphQL schemas |
|
|
260
|
+
| ποΈ Database Schemas | SQL `CREATE TABLE` statements |
|
|
261
|
+
| π Python Routes | FastAPI `@router.get/post/...`, Flask `@app.route` |
|
|
262
|
+
| π JavaScript Routes | Express `app.get/post/...` |
|
|
263
|
+
| β Java Routes | Spring `@GetMapping/@PostMapping/...` |
|
|
264
|
+
|
|
265
|
+
All sources are normalized into a common capability model with:
|
|
266
|
+
|
|
267
|
+
| Field | Description |
|
|
268
|
+
|---|---|
|
|
269
|
+
| `domain` + `resource` | Logical grouping |
|
|
270
|
+
| `action` | What the capability does |
|
|
271
|
+
| `input_schema` | JSON Schema parameters |
|
|
272
|
+
| `risk` | `read` / `write` / `destructive` / `external_side_effect` |
|
|
273
|
+
| `confirm_required` | Whether human approval is needed |
|
|
274
|
+
| `source` | Full traceability back to the origin file |
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
## π Generated Kit Layout
|
|
279
|
+
|
|
280
|
+
```text
|
|
281
|
+
agent-kit/
|
|
282
|
+
βββ manifest.json # Kit metadata and summary
|
|
283
|
+
βββ capabilities.json # All discovered capabilities
|
|
284
|
+
βββ tools/
|
|
285
|
+
β βββ mcp_tools.json # MCP tool definitions
|
|
286
|
+
β βββ openai_tools.json # OpenAI function calling format
|
|
287
|
+
β βββ claude_tools.json # Claude tool use format
|
|
288
|
+
β βββ vercel_ai_tools.ts # Vercel AI SDK TypeScript tools
|
|
289
|
+
βββ skills/
|
|
290
|
+
β βββ writing.md # Domain-specific skill definitions
|
|
291
|
+
βββ prompts/
|
|
292
|
+
β βββ system.md # Agent system prompt
|
|
293
|
+
βββ resources/
|
|
294
|
+
β βββ schema.json # Resource schema summary
|
|
295
|
+
βββ guardrails/
|
|
296
|
+
β βββ permissions.json # Risk policy and confirmation rules
|
|
297
|
+
βββ tests/
|
|
298
|
+
β βββ tool_invocation_tests.json # Auto-generated invocation tests
|
|
299
|
+
β βββ test_generated_tools.py # Python unit tests for tool contracts
|
|
300
|
+
βββ dry_run_plan.json # Dry-run execution plan
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
## π€ AI-Powered Generation
|
|
306
|
+
|
|
307
|
+
When you use `--ai`, AgentBridge uses Claude to dynamically generate:
|
|
308
|
+
|
|
309
|
+
| What | Description |
|
|
310
|
+
|---|---|
|
|
311
|
+
| π **Enhanced tool descriptions** | Context-aware descriptions that capture business semantics |
|
|
312
|
+
| π― **Domain-specific skills** | Workflow prompts tailored to your domain with best practices |
|
|
313
|
+
| π§ **Intelligent system prompts** | Prompts that understand resource relationships and suggest safe sequences |
|
|
314
|
+
| π **Inferred additional tools** | Tools implied by your schema but not explicitly present |
|
|
315
|
+
| β οΈ **Improved risk assessments** | Context-aware risk classification beyond keyword matching |
|
|
316
|
+
|
|
317
|
+
### AI Backend
|
|
318
|
+
|
|
319
|
+
| Backend | Package | Use Case |
|
|
320
|
+
|---|---|---|
|
|
321
|
+
| **Claude Agent SDK** (primary) | `claude-agent-sdk` | Generation + interactive agent sessions |
|
|
322
|
+
| **Anthropic API** (fallback) | `anthropic` | Generation only, supports custom endpoints |
|
|
323
|
+
|
|
324
|
+
When `claude-agent-sdk` is installed and no custom `ANTHROPIC_BASE_URL` is set, it is used automatically. When a custom endpoint is configured or `claude-agent-sdk` is not installed, the `anthropic` SDK is used.
|
|
325
|
+
|
|
326
|
+
### Programmatic Usage
|
|
327
|
+
|
|
328
|
+
```python
|
|
329
|
+
from pathlib import Path
|
|
330
|
+
from agentbridge.generator import AgentKitGenerator
|
|
331
|
+
from agentbridge.agent import AIGenerator, AgentRunner
|
|
332
|
+
|
|
333
|
+
# Deterministic generation (no API key needed)
|
|
334
|
+
kit = AgentKitGenerator().generate(
|
|
335
|
+
[Path("examples/writing_system")],
|
|
336
|
+
Path("build/agent-kit"),
|
|
337
|
+
)
|
|
338
|
+
|
|
339
|
+
# AI-powered generation (API key required)
|
|
340
|
+
ai = AIGenerator(api_key="sk-ant-...")
|
|
341
|
+
kit = AgentKitGenerator(ai_generator=ai).generate(
|
|
342
|
+
[Path("examples/writing_system")],
|
|
343
|
+
Path("build/agent-kit"),
|
|
344
|
+
)
|
|
345
|
+
|
|
346
|
+
# Custom LLM provider (e.g., DeepSeek)
|
|
347
|
+
ai = AIGenerator(
|
|
348
|
+
api_key="sk-d831ecabc21842fdae6f30c24dd3b052",
|
|
349
|
+
base_url="https://api.deepseek.com/anthropic",
|
|
350
|
+
model="deepseek-v4-flash",
|
|
351
|
+
)
|
|
352
|
+
|
|
353
|
+
# Agent session
|
|
354
|
+
import asyncio
|
|
355
|
+
async def main():
|
|
356
|
+
runner = AgentRunner(kit_dir="build/agent-kit", api_key="sk-ant-...")
|
|
357
|
+
async for message in runner.query("List all chapters in project p1"):
|
|
358
|
+
print(message)
|
|
359
|
+
asyncio.run(main())
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
---
|
|
363
|
+
|
|
364
|
+
## π‘οΈ Safety Model
|
|
365
|
+
|
|
366
|
+
| Risk Level | Confirmation | Examples |
|
|
367
|
+
|---|---|---|
|
|
368
|
+
| π’ `read` | Not required | GET, list, search, find |
|
|
369
|
+
| π‘ `write` | Optional by policy | POST, create, update, rewrite |
|
|
370
|
+
| π΄ `destructive` | **Required** | DELETE, remove, destroy, drop, cancel |
|
|
371
|
+
| π `external_side_effect` | **Required** | publish, send, email, pay, deploy, export |
|
|
372
|
+
|
|
373
|
+
The safety model is applied consistently across both deterministic and AI-generated outputs. AI-generated tools are always validated against the same guardrails.
|
|
374
|
+
|
|
375
|
+
---
|
|
376
|
+
|
|
377
|
+
## ποΈ Architecture
|
|
378
|
+
|
|
379
|
+
```text
|
|
380
|
+
βββββββββββββββ ββββββββββββββββ βββββββββββββββββββ
|
|
381
|
+
β Discovery ββββββΆβ Generator ββββββΆβ Agent Kit β
|
|
382
|
+
β (schemas, β β (determin- β β (tools, skills,β
|
|
383
|
+
β routes, β β istic + AI)β β prompts, β
|
|
384
|
+
β SQL) β β β β guardrails) β
|
|
385
|
+
βββββββββββββββ ββββββββ¬ββββββββ ββββββββββ¬βββββββββ
|
|
386
|
+
β β
|
|
387
|
+
ββββββββΌββββββββ ββββββββΌβββββββββ
|
|
388
|
+
β AI Generatorβ β Agent Runner β
|
|
389
|
+
β (Claude SDK β β (Claude SDK β
|
|
390
|
+
β / Anthropicβ β Client + β
|
|
391
|
+
β API) β β MCP Tools) β
|
|
392
|
+
ββββββββββββββββ βββββββββββββββββ
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
---
|
|
396
|
+
|
|
397
|
+
## π§© Extending AgentBridge
|
|
398
|
+
|
|
399
|
+
| Extension | How |
|
|
400
|
+
|---|---|
|
|
401
|
+
| New schema parser | Implement a discoverer in `discovery.py` |
|
|
402
|
+
| New tool format | Add a builder function in `generator.py` |
|
|
403
|
+
| Custom AI prompts | Override prompts in `agent.py` |
|
|
404
|
+
| Custom risk policy | Modify `policy.py` |
|
|
405
|
+
| Custom agent tools | Extend `AgentRunner._build_kit_tools()` |
|
|
406
|
+
|
|
407
|
+
---
|
|
408
|
+
|
|
409
|
+
## π¦ Publishing & Installation
|
|
410
|
+
|
|
411
|
+
<details>
|
|
412
|
+
<summary>π§ How does `pip install "agbr"` work?</summary>
|
|
413
|
+
|
|
414
|
+
AgentBridge is packaged as a standard Python package using **`pyproject.toml`** + **setuptools**. Here's the mechanism:
|
|
415
|
+
|
|
416
|
+
### 1. Package Structure
|
|
417
|
+
|
|
418
|
+
```text
|
|
419
|
+
AgentBridge/
|
|
420
|
+
βββ pyproject.toml # Package metadata, dependencies, entry points
|
|
421
|
+
βββ src/
|
|
422
|
+
β βββ agentbridge/ # Actual Python package
|
|
423
|
+
β βββ __init__.py
|
|
424
|
+
β βββ cli.py # CLI entry point
|
|
425
|
+
β βββ agent.py
|
|
426
|
+
β βββ generator.py
|
|
427
|
+
β βββ ...
|
|
428
|
+
βββ tests/
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
### 2. `pyproject.toml` Key Sections
|
|
432
|
+
|
|
433
|
+
```toml
|
|
434
|
+
[project]
|
|
435
|
+
name = "agbr" # pip install agbr
|
|
436
|
+
version = "0.2.0"
|
|
437
|
+
|
|
438
|
+
[project.optional-dependencies] # pip install "agbr[agent]"
|
|
439
|
+
agent = ["claude-agent-sdk>=0.1.0"]
|
|
440
|
+
ai = ["anthropic>=0.30.0"]
|
|
441
|
+
|
|
442
|
+
[project.scripts]
|
|
443
|
+
agentbridge = "agentbridge.cli:main" # CLI entry point
|
|
444
|
+
|
|
445
|
+
[tool.setuptools.packages.find]
|
|
446
|
+
where = ["src"] # Code lives in src/
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
### 3. How `pip install` Works
|
|
450
|
+
|
|
451
|
+
1. **Build**: `pip` reads `pyproject.toml`, uses `setuptools` to build a wheel (`.whl`)
|
|
452
|
+
2. **Install**: The wheel is installed into your Python environment's `site-packages/`
|
|
453
|
+
3. **CLI**: The `[project.scripts]` section creates a `agentbridge` executable in your PATH that calls `agentbridge.cli:main`
|
|
454
|
+
|
|
455
|
+
### 4. Publishing to PyPI (so anyone can `pip install`)
|
|
456
|
+
|
|
457
|
+
```bash
|
|
458
|
+
# Build the package
|
|
459
|
+
pip install build
|
|
460
|
+
python -m build
|
|
461
|
+
|
|
462
|
+
# Upload to TestPyPI (for testing)
|
|
463
|
+
pip install twine
|
|
464
|
+
twine upload --repository testpypi dist/*
|
|
465
|
+
|
|
466
|
+
# Upload to PyPI (for real)
|
|
467
|
+
twine upload dist/*
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
After publishing, anyone can run `pip install "agbr"`.
|
|
471
|
+
|
|
472
|
+
### 5. Installing Without PyPI
|
|
473
|
+
|
|
474
|
+
Until the package is published on PyPI, users can install it in these ways:
|
|
475
|
+
|
|
476
|
+
```bash
|
|
477
|
+
# Install from local source (editable mode, for development)
|
|
478
|
+
pip install -e .
|
|
479
|
+
|
|
480
|
+
# Install from GitHub repository
|
|
481
|
+
pip install git+https://github.com/your-username/AgentBridge.git
|
|
482
|
+
|
|
483
|
+
# Install from a local wheel
|
|
484
|
+
pip install dist/agentbridge-0.2.0-py3-none-any.whl
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
</details>
|
|
488
|
+
|
|
489
|
+
---
|
|
490
|
+
|
|
491
|
+
## π€ Contributing
|
|
492
|
+
|
|
493
|
+
Contributions are welcome! Here's how you can help:
|
|
494
|
+
|
|
495
|
+
1. **Fork** the repository
|
|
496
|
+
2. **Create** a feature branch (`git checkout -b feature/amazing-feature`)
|
|
497
|
+
3. **Commit** your changes (`git commit -m 'Add amazing feature'`)
|
|
498
|
+
4. **Push** to the branch (`git push origin feature/amazing-feature`)
|
|
499
|
+
5. **Open** a Pull Request
|
|
500
|
+
|
|
501
|
+
Please make sure tests pass:
|
|
502
|
+
|
|
503
|
+
```bash
|
|
504
|
+
PYTHONPATH=src python -m unittest discover -s tests -v
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
---
|
|
508
|
+
|
|
509
|
+
## π License
|
|
510
|
+
|
|
511
|
+
This project is licensed under the MIT License β see the [LICENSE](LICENSE) file for details.
|