agentbridge-sdk 0.1.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.
- agentbridge_sdk-0.1.0/PKG-INFO +7 -0
- agentbridge_sdk-0.1.0/README.md +126 -0
- agentbridge_sdk-0.1.0/agentbridge/__init__.py +3 -0
- agentbridge_sdk-0.1.0/agentbridge/client.py +48 -0
- agentbridge_sdk-0.1.0/agentbridge_sdk.egg-info/PKG-INFO +7 -0
- agentbridge_sdk-0.1.0/agentbridge_sdk.egg-info/SOURCES.txt +9 -0
- agentbridge_sdk-0.1.0/agentbridge_sdk.egg-info/dependency_links.txt +1 -0
- agentbridge_sdk-0.1.0/agentbridge_sdk.egg-info/requires.txt +1 -0
- agentbridge_sdk-0.1.0/agentbridge_sdk.egg-info/top_level.txt +1 -0
- agentbridge_sdk-0.1.0/setup.cfg +4 -0
- agentbridge_sdk-0.1.0/setup.py +9 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# AgentBridge Python SDK
|
|
2
|
+
|
|
3
|
+
Official Python SDK for the AgentBridge API. Execute tools across connected providers (GitHub, Slack, Notion, Gmail, Google Drive) with a single API key.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install agentbridge-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from agentbridge import AgentBridge
|
|
15
|
+
|
|
16
|
+
client = AgentBridge(
|
|
17
|
+
api_key="ab_your_api_key_here",
|
|
18
|
+
base_url="http://localhost:3000", # optional
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
result = client.execute(provider="github", tool="list_repos")
|
|
22
|
+
print(result["data"])
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Configuration
|
|
26
|
+
|
|
27
|
+
| Parameter | Type | Required | Default | Description |
|
|
28
|
+
| ---------- | ---- | -------- | ----------------------- | ---------------------- |
|
|
29
|
+
| `api_key` | str | Yes | — | Your AgentBridge API key |
|
|
30
|
+
| `base_url` | str | No | `http://localhost:3000` | API base URL |
|
|
31
|
+
|
|
32
|
+
## Methods
|
|
33
|
+
|
|
34
|
+
### `execute(provider, tool, params=None)`
|
|
35
|
+
|
|
36
|
+
Execute a tool on a connected provider.
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
result = client.execute(
|
|
40
|
+
provider="github",
|
|
41
|
+
tool="create_issue",
|
|
42
|
+
params={
|
|
43
|
+
"owner": "octocat",
|
|
44
|
+
"repo": "hello-world",
|
|
45
|
+
"title": "Bug report",
|
|
46
|
+
"body": "Something is broken",
|
|
47
|
+
},
|
|
48
|
+
)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**Parameters:**
|
|
52
|
+
|
|
53
|
+
| Argument | Type | Required | Description |
|
|
54
|
+
| ---------- | ------------- | -------- | ---------------------------- |
|
|
55
|
+
| `provider` | str | Yes | Provider slug (e.g. `github`, `slack`, `notion`) |
|
|
56
|
+
| `tool` | str | Yes | Tool name (e.g. `list_repos`, `create_issue`) |
|
|
57
|
+
| `params` | dict or None | No | Tool-specific parameters |
|
|
58
|
+
|
|
59
|
+
**Returns:** `{"status": "success", "data": ...}`
|
|
60
|
+
|
|
61
|
+
### `get_providers()`
|
|
62
|
+
|
|
63
|
+
List all active providers.
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
providers = client.get_providers()
|
|
67
|
+
# [{"id": "...", "name": "GitHub", "slug": "github", "active": True}, ...]
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### `get_provider_tools(slug)`
|
|
71
|
+
|
|
72
|
+
List available tools for a provider.
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
tools = client.get_provider_tools("github")
|
|
76
|
+
# [{"name": "list_repos", "description": "...", "parameters": {...}}, ...]
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Error Handling
|
|
80
|
+
|
|
81
|
+
The SDK raises `requests.exceptions.HTTPError` for failed requests:
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
from requests.exceptions import HTTPError
|
|
85
|
+
|
|
86
|
+
try:
|
|
87
|
+
result = client.execute(provider="github", tool="list_repos")
|
|
88
|
+
except HTTPError as e:
|
|
89
|
+
print(f"Request failed: {e.response.status_code} - {e.response.text}")
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Available Providers & Tools
|
|
93
|
+
|
|
94
|
+
### GitHub
|
|
95
|
+
|
|
96
|
+
| Tool | Description | Parameters |
|
|
97
|
+
| -------------- | ------------------------------------ | ------------------------------------------- |
|
|
98
|
+
| `list_repos` | List authenticated user repositories | — |
|
|
99
|
+
| `create_issue` | Create a GitHub issue | `owner`, `repo`, `title`, `body`(optional) |
|
|
100
|
+
| `create_pr` | Create a pull request | `owner`, `repo`, `title`, `head`, `base`, `body`(optional) |
|
|
101
|
+
| `get_file` | Get file contents from a repository | `owner`, `repo`, `path` |
|
|
102
|
+
|
|
103
|
+
### Slack
|
|
104
|
+
|
|
105
|
+
Use `get_provider_tools("slack")` to list available tools.
|
|
106
|
+
|
|
107
|
+
### Notion
|
|
108
|
+
|
|
109
|
+
Use `get_provider_tools("notion")` to list available tools.
|
|
110
|
+
|
|
111
|
+
### Gmail
|
|
112
|
+
|
|
113
|
+
Use `get_provider_tools("gmail")` to list available tools.
|
|
114
|
+
|
|
115
|
+
### Google Drive
|
|
116
|
+
|
|
117
|
+
Use `get_provider_tools("google-drive")` to list available tools.
|
|
118
|
+
|
|
119
|
+
## Requirements
|
|
120
|
+
|
|
121
|
+
- Python >= 3.9
|
|
122
|
+
- requests >= 2.20.0
|
|
123
|
+
|
|
124
|
+
## License
|
|
125
|
+
|
|
126
|
+
MIT
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any
|
|
4
|
+
from urllib.parse import quote
|
|
5
|
+
|
|
6
|
+
import requests
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class AgentBridge:
|
|
10
|
+
"""Python SDK for AgentBridge API."""
|
|
11
|
+
|
|
12
|
+
def __init__(self, api_key: str, base_url: str = "http://localhost:3000") -> None:
|
|
13
|
+
self.api_key = api_key
|
|
14
|
+
self.base_url = base_url.rstrip("/")
|
|
15
|
+
self._session = requests.Session()
|
|
16
|
+
self._session.headers.update(
|
|
17
|
+
{
|
|
18
|
+
"Authorization": f"Bearer {self.api_key}",
|
|
19
|
+
"Content-Type": "application/json",
|
|
20
|
+
}
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
def _request(self, method: str, path: str, json: dict | None = None) -> Any:
|
|
24
|
+
url = f"{self.base_url}/api/mcp{path}"
|
|
25
|
+
resp = self._session.request(method, url, json=json)
|
|
26
|
+
resp.raise_for_status()
|
|
27
|
+
return resp.json()
|
|
28
|
+
|
|
29
|
+
def execute(
|
|
30
|
+
self,
|
|
31
|
+
provider: str,
|
|
32
|
+
tool: str,
|
|
33
|
+
params: dict[str, Any] | None = None,
|
|
34
|
+
) -> dict[str, Any]:
|
|
35
|
+
"""Execute a tool on a provider."""
|
|
36
|
+
return self._request(
|
|
37
|
+
"POST",
|
|
38
|
+
"/execute",
|
|
39
|
+
json={"provider": provider, "tool": tool, "params": params or {}},
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
def get_providers(self) -> list[dict[str, Any]]:
|
|
43
|
+
"""List all active providers."""
|
|
44
|
+
return self._request("GET", "/providers")
|
|
45
|
+
|
|
46
|
+
def get_provider_tools(self, slug: str) -> list[dict[str, Any]]:
|
|
47
|
+
"""List tools for a provider."""
|
|
48
|
+
return self._request("GET", f"/providers/{quote(slug, safe='')}/tools")
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
setup.py
|
|
3
|
+
agentbridge/__init__.py
|
|
4
|
+
agentbridge/client.py
|
|
5
|
+
agentbridge_sdk.egg-info/PKG-INFO
|
|
6
|
+
agentbridge_sdk.egg-info/SOURCES.txt
|
|
7
|
+
agentbridge_sdk.egg-info/dependency_links.txt
|
|
8
|
+
agentbridge_sdk.egg-info/requires.txt
|
|
9
|
+
agentbridge_sdk.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
requests>=2.20.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
agentbridge
|