agentgatesh 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.
- agentgatesh-0.1.0/.env.example +16 -0
- agentgatesh-0.1.0/.github/workflows/ci.yml +32 -0
- agentgatesh-0.1.0/.github/workflows/publish.yml +29 -0
- agentgatesh-0.1.0/.gitignore +38 -0
- agentgatesh-0.1.0/Dockerfile +24 -0
- agentgatesh-0.1.0/PKG-INFO +182 -0
- agentgatesh-0.1.0/README.md +152 -0
- agentgatesh-0.1.0/alembic.ini +149 -0
- agentgatesh-0.1.0/docker-compose.yml +45 -0
- agentgatesh-0.1.0/entrypoint.sh +4 -0
- agentgatesh-0.1.0/examples/calc-agent/Dockerfile +6 -0
- agentgatesh-0.1.0/examples/calc-agent/agent.py +61 -0
- agentgatesh-0.1.0/examples/calc-agent/agentgate.yaml +8 -0
- agentgatesh-0.1.0/examples/echo-agent/Dockerfile +11 -0
- agentgatesh-0.1.0/examples/echo-agent/README.md +24 -0
- agentgatesh-0.1.0/examples/echo-agent/agent.py +31 -0
- agentgatesh-0.1.0/examples/echo-agent/agentgate.yaml +8 -0
- agentgatesh-0.1.0/examples/my-agent/agentgate.yaml +8 -0
- agentgatesh-0.1.0/pyproject.toml +59 -0
- agentgatesh-0.1.0/src/agentgate/__init__.py +3 -0
- agentgatesh-0.1.0/src/agentgate/cli/__init__.py +0 -0
- agentgatesh-0.1.0/src/agentgate/cli/main.py +201 -0
- agentgatesh-0.1.0/src/agentgate/core/__init__.py +0 -0
- agentgatesh-0.1.0/src/agentgate/core/config.py +15 -0
- agentgatesh-0.1.0/src/agentgate/db/__init__.py +0 -0
- agentgatesh-0.1.0/src/agentgate/db/base.py +5 -0
- agentgatesh-0.1.0/src/agentgate/db/engine.py +6 -0
- agentgatesh-0.1.0/src/agentgate/db/migrations/README +1 -0
- agentgatesh-0.1.0/src/agentgate/db/migrations/__init__.py +0 -0
- agentgatesh-0.1.0/src/agentgate/db/migrations/env.py +57 -0
- agentgatesh-0.1.0/src/agentgate/db/migrations/script.py.mako +28 -0
- agentgatesh-0.1.0/src/agentgate/db/migrations/versions/8c8195387159_create_agents_table.py +48 -0
- agentgatesh-0.1.0/src/agentgate/db/models.py +29 -0
- agentgatesh-0.1.0/src/agentgate/sdk/__init__.py +3 -0
- agentgatesh-0.1.0/src/agentgate/sdk/client.py +153 -0
- agentgatesh-0.1.0/src/agentgate/server/__init__.py +0 -0
- agentgatesh-0.1.0/src/agentgate/server/app.py +62 -0
- agentgatesh-0.1.0/src/agentgate/server/metrics.py +84 -0
- agentgatesh-0.1.0/src/agentgate/server/ratelimit.py +35 -0
- agentgatesh-0.1.0/src/agentgate/server/routes.py +156 -0
- agentgatesh-0.1.0/src/agentgate/server/schemas.py +46 -0
- agentgatesh-0.1.0/src/agentgate/server/static/index.html +532 -0
- agentgatesh-0.1.0/tests/__init__.py +0 -0
- agentgatesh-0.1.0/tests/test_health.py +532 -0
- agentgatesh-0.1.0/tests/test_sdk.py +124 -0
- agentgatesh-0.1.0/uv.lock +984 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# AgentGate Configuration
|
|
2
|
+
# Copy this to .env and fill in your values
|
|
3
|
+
|
|
4
|
+
# Database
|
|
5
|
+
DATABASE_URL=postgresql+asyncpg://agentgate:changeme@localhost:5432/agentgate
|
|
6
|
+
|
|
7
|
+
# Server
|
|
8
|
+
HOST=0.0.0.0
|
|
9
|
+
PORT=8000
|
|
10
|
+
DEBUG=true
|
|
11
|
+
|
|
12
|
+
# Security (generate with: python -c "import secrets; print(secrets.token_hex(32))")
|
|
13
|
+
SECRET_KEY=changeme
|
|
14
|
+
|
|
15
|
+
# API key for deploy authentication (generate with: python -c "import secrets; print(secrets.token_hex(32))")
|
|
16
|
+
API_KEY=
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Install uv
|
|
20
|
+
uses: astral-sh/setup-uv@v4
|
|
21
|
+
|
|
22
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
23
|
+
run: uv python install ${{ matrix.python-version }}
|
|
24
|
+
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: uv sync --extra dev
|
|
27
|
+
|
|
28
|
+
- name: Lint
|
|
29
|
+
run: uv run --extra dev ruff check src/ tests/
|
|
30
|
+
|
|
31
|
+
- name: Test
|
|
32
|
+
run: uv run --extra dev pytest -v
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- uses: astral-sh/setup-uv@v4
|
|
14
|
+
- run: uv python install 3.12
|
|
15
|
+
- run: uv sync --extra dev
|
|
16
|
+
- run: uv run --extra dev ruff check src/ tests/
|
|
17
|
+
- run: uv run --extra dev pytest -v
|
|
18
|
+
|
|
19
|
+
publish:
|
|
20
|
+
needs: test
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
environment: pypi
|
|
23
|
+
permissions:
|
|
24
|
+
id-token: write
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@v4
|
|
27
|
+
- uses: astral-sh/setup-uv@v4
|
|
28
|
+
- run: uv build
|
|
29
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.egg-info/
|
|
5
|
+
dist/
|
|
6
|
+
build/
|
|
7
|
+
.venv/
|
|
8
|
+
*.egg
|
|
9
|
+
|
|
10
|
+
# Environment
|
|
11
|
+
.env
|
|
12
|
+
.env.local
|
|
13
|
+
.env.production
|
|
14
|
+
|
|
15
|
+
# IDE
|
|
16
|
+
.vscode/
|
|
17
|
+
.idea/
|
|
18
|
+
*.swp
|
|
19
|
+
*.swo
|
|
20
|
+
|
|
21
|
+
# OS
|
|
22
|
+
.DS_Store
|
|
23
|
+
Thumbs.db
|
|
24
|
+
|
|
25
|
+
# Docker
|
|
26
|
+
docker-compose.override.yml
|
|
27
|
+
|
|
28
|
+
# Testing
|
|
29
|
+
.coverage
|
|
30
|
+
htmlcov/
|
|
31
|
+
.pytest_cache/
|
|
32
|
+
|
|
33
|
+
# Alembic
|
|
34
|
+
*.db
|
|
35
|
+
|
|
36
|
+
# Memory files (project-specific, not for public repo)
|
|
37
|
+
memory/
|
|
38
|
+
CLAUDE.md
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
FROM python:3.12-slim
|
|
2
|
+
|
|
3
|
+
WORKDIR /app
|
|
4
|
+
|
|
5
|
+
# Install uv
|
|
6
|
+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
|
|
7
|
+
|
|
8
|
+
# Copy dependency files first (better caching)
|
|
9
|
+
COPY pyproject.toml uv.lock ./
|
|
10
|
+
|
|
11
|
+
# Install dependencies
|
|
12
|
+
RUN uv sync --frozen --no-dev --no-install-project
|
|
13
|
+
|
|
14
|
+
# Copy source code and README (required by hatchling build)
|
|
15
|
+
COPY README.md ./
|
|
16
|
+
COPY src/ src/
|
|
17
|
+
COPY alembic.ini entrypoint.sh ./
|
|
18
|
+
|
|
19
|
+
# Install the project itself
|
|
20
|
+
RUN uv sync --frozen --no-dev
|
|
21
|
+
|
|
22
|
+
EXPOSE 8000
|
|
23
|
+
|
|
24
|
+
CMD ["./entrypoint.sh"]
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agentgatesh
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: The unified gateway to deploy, connect, and monetize AI agents via MCP + A2A + UCP.
|
|
5
|
+
Author-email: AgentGate <info@agentgate.sh>
|
|
6
|
+
License-Expression: AGPL-3.0-or-later
|
|
7
|
+
Keywords: a2a,agents,ai,deploy,gateway,mcp
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
14
|
+
Requires-Python: >=3.11
|
|
15
|
+
Requires-Dist: alembic>=1.14.0
|
|
16
|
+
Requires-Dist: asyncpg>=0.30.0
|
|
17
|
+
Requires-Dist: click>=8.1.0
|
|
18
|
+
Requires-Dist: fastapi>=0.115.0
|
|
19
|
+
Requires-Dist: httpx>=0.28.0
|
|
20
|
+
Requires-Dist: pydantic-settings>=2.0.0
|
|
21
|
+
Requires-Dist: pydantic>=2.0.0
|
|
22
|
+
Requires-Dist: pyyaml>=6.0.0
|
|
23
|
+
Requires-Dist: sqlalchemy[asyncio]>=2.0.0
|
|
24
|
+
Requires-Dist: uvicorn[standard]>=0.34.0
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pytest-asyncio>=0.24.0; extra == 'dev'
|
|
27
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
28
|
+
Requires-Dist: ruff>=0.8.0; extra == 'dev'
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
|
|
31
|
+
# AgentGate
|
|
32
|
+
|
|
33
|
+
The unified gateway to deploy, connect, and monetize AI agents via MCP + A2A + UCP.
|
|
34
|
+
|
|
35
|
+
[](https://github.com/agentgatesh/agentgate/actions/workflows/ci.yml)
|
|
36
|
+
[](https://pypi.org/project/agentgatesh/)
|
|
37
|
+
[](https://www.python.org/)
|
|
38
|
+
[](LICENSE)
|
|
39
|
+
|
|
40
|
+
## What is AgentGate?
|
|
41
|
+
|
|
42
|
+
AgentGate is an open-source gateway that makes it easy to deploy, discover, and connect AI agents using standard protocols (MCP, A2A, UCP). Think of it as **Vercel + npm + Stripe, but for AI agents**.
|
|
43
|
+
|
|
44
|
+
- **Deploy in 5 minutes** — One command, your agent is live with an A2A-compliant Agent Card
|
|
45
|
+
- **Registry & Discovery** — Find agents by capability via `.well-known/agent.json`
|
|
46
|
+
- **Built-in Monetization** — Your agent can charge for its services (coming soon)
|
|
47
|
+
|
|
48
|
+
## Quick Start
|
|
49
|
+
|
|
50
|
+
### 1. Install
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pip install agentgatesh
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### 2. Create your agent config
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
mkdir my-agent && cd my-agent
|
|
60
|
+
cat > agentgate.yaml << 'EOF'
|
|
61
|
+
name: my-agent
|
|
62
|
+
description: A helpful AI agent
|
|
63
|
+
url: https://my-agent.example.com
|
|
64
|
+
version: 1.0.0
|
|
65
|
+
skills:
|
|
66
|
+
- id: chat
|
|
67
|
+
name: Chat
|
|
68
|
+
description: General conversation
|
|
69
|
+
EOF
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 3. Deploy
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
export AGENTGATE_API_KEY=your-api-key
|
|
76
|
+
agentgate deploy ./my-agent
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Your agent is now live with an A2A-compliant Agent Card.
|
|
80
|
+
|
|
81
|
+
### 4. Verify
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
agentgate list
|
|
85
|
+
agentgate status
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## CLI Reference
|
|
89
|
+
|
|
90
|
+
| Command | Description |
|
|
91
|
+
|---------|-------------|
|
|
92
|
+
| `agentgate status` | Show server status |
|
|
93
|
+
| `agentgate list` | List all deployed agents |
|
|
94
|
+
| `agentgate deploy ./path` | Deploy an agent from a directory |
|
|
95
|
+
| `agentgate update <agent-id>` | Update an agent (--name, --version, etc.) |
|
|
96
|
+
| `agentgate delete <agent-id>` | Delete a deployed agent |
|
|
97
|
+
|
|
98
|
+
All commands that modify data require `--api-key` or the `AGENTGATE_API_KEY` environment variable.
|
|
99
|
+
|
|
100
|
+
## Python SDK
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
from agentgate.sdk import AgentGateClient
|
|
104
|
+
|
|
105
|
+
# Connect to AgentGate
|
|
106
|
+
client = AgentGateClient("https://agentgate.sh", api_key="your-key")
|
|
107
|
+
|
|
108
|
+
# List agents
|
|
109
|
+
agents = client.list_agents()
|
|
110
|
+
|
|
111
|
+
# Register a new agent
|
|
112
|
+
agent = client.register_agent(
|
|
113
|
+
name="my-agent",
|
|
114
|
+
url="https://my-agent.example.com",
|
|
115
|
+
description="A helpful agent",
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
# Send a task to an agent (A2A routing via AgentGate)
|
|
119
|
+
result = client.send_task(agent["id"], "Hello, agent!")
|
|
120
|
+
print(result["artifacts"][0]["parts"][0]["text"])
|
|
121
|
+
|
|
122
|
+
# Update an agent
|
|
123
|
+
client.update_agent(agent["id"], version="2.0.0")
|
|
124
|
+
|
|
125
|
+
# Delete an agent
|
|
126
|
+
client.delete_agent(agent["id"])
|
|
127
|
+
|
|
128
|
+
# Context manager for automatic cleanup
|
|
129
|
+
with AgentGateClient("https://agentgate.sh") as c:
|
|
130
|
+
print(c.health())
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## API Endpoints
|
|
134
|
+
|
|
135
|
+
| Method | Path | Auth | Description |
|
|
136
|
+
|--------|------|------|-------------|
|
|
137
|
+
| `GET` | `/health` | No | Server health check |
|
|
138
|
+
| `GET` | `/` | No | Landing page |
|
|
139
|
+
| `GET` | `/.well-known/agent.json` | No | A2A discovery endpoint |
|
|
140
|
+
| `GET` | `/agents/` | No | List all agents |
|
|
141
|
+
| `GET` | `/agents/{id}` | No | Get agent details |
|
|
142
|
+
| `GET` | `/agents/{id}/card` | No | Get A2A Agent Card |
|
|
143
|
+
| `POST` | `/agents/` | Yes | Register a new agent |
|
|
144
|
+
| `PUT` | `/agents/{id}` | Yes | Update an agent |
|
|
145
|
+
| `DELETE` | `/agents/{id}` | Yes | Delete an agent |
|
|
146
|
+
| `POST` | `/agents/{id}/task` | No | Route A2A task to agent (rate limited) |
|
|
147
|
+
| `GET` | `/metrics` | No | Task routing metrics |
|
|
148
|
+
|
|
149
|
+
## Development
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
# Clone the repo
|
|
153
|
+
git clone https://github.com/agentgatesh/agentgate.git
|
|
154
|
+
cd agentgate
|
|
155
|
+
|
|
156
|
+
# Install dependencies (requires uv)
|
|
157
|
+
uv sync --dev
|
|
158
|
+
|
|
159
|
+
# Run tests
|
|
160
|
+
uv run pytest -v
|
|
161
|
+
|
|
162
|
+
# Lint
|
|
163
|
+
uv run ruff check src/ tests/
|
|
164
|
+
|
|
165
|
+
# Start services locally
|
|
166
|
+
docker compose up -d
|
|
167
|
+
|
|
168
|
+
# Check status
|
|
169
|
+
uv run agentgate status --server http://localhost:8000
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Architecture
|
|
173
|
+
|
|
174
|
+
- **Framework**: FastAPI + Uvicorn
|
|
175
|
+
- **Database**: PostgreSQL 16 + SQLAlchemy async + Alembic
|
|
176
|
+
- **CLI**: Click
|
|
177
|
+
- **Packaging**: uv + hatchling
|
|
178
|
+
- **Deploy**: Docker Compose + Caddy reverse proxy
|
|
179
|
+
|
|
180
|
+
## License
|
|
181
|
+
|
|
182
|
+
AGPL-3.0 — see [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# AgentGate
|
|
2
|
+
|
|
3
|
+
The unified gateway to deploy, connect, and monetize AI agents via MCP + A2A + UCP.
|
|
4
|
+
|
|
5
|
+
[](https://github.com/agentgatesh/agentgate/actions/workflows/ci.yml)
|
|
6
|
+
[](https://pypi.org/project/agentgatesh/)
|
|
7
|
+
[](https://www.python.org/)
|
|
8
|
+
[](LICENSE)
|
|
9
|
+
|
|
10
|
+
## What is AgentGate?
|
|
11
|
+
|
|
12
|
+
AgentGate is an open-source gateway that makes it easy to deploy, discover, and connect AI agents using standard protocols (MCP, A2A, UCP). Think of it as **Vercel + npm + Stripe, but for AI agents**.
|
|
13
|
+
|
|
14
|
+
- **Deploy in 5 minutes** — One command, your agent is live with an A2A-compliant Agent Card
|
|
15
|
+
- **Registry & Discovery** — Find agents by capability via `.well-known/agent.json`
|
|
16
|
+
- **Built-in Monetization** — Your agent can charge for its services (coming soon)
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
### 1. Install
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install agentgatesh
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### 2. Create your agent config
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
mkdir my-agent && cd my-agent
|
|
30
|
+
cat > agentgate.yaml << 'EOF'
|
|
31
|
+
name: my-agent
|
|
32
|
+
description: A helpful AI agent
|
|
33
|
+
url: https://my-agent.example.com
|
|
34
|
+
version: 1.0.0
|
|
35
|
+
skills:
|
|
36
|
+
- id: chat
|
|
37
|
+
name: Chat
|
|
38
|
+
description: General conversation
|
|
39
|
+
EOF
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 3. Deploy
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
export AGENTGATE_API_KEY=your-api-key
|
|
46
|
+
agentgate deploy ./my-agent
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Your agent is now live with an A2A-compliant Agent Card.
|
|
50
|
+
|
|
51
|
+
### 4. Verify
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
agentgate list
|
|
55
|
+
agentgate status
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## CLI Reference
|
|
59
|
+
|
|
60
|
+
| Command | Description |
|
|
61
|
+
|---------|-------------|
|
|
62
|
+
| `agentgate status` | Show server status |
|
|
63
|
+
| `agentgate list` | List all deployed agents |
|
|
64
|
+
| `agentgate deploy ./path` | Deploy an agent from a directory |
|
|
65
|
+
| `agentgate update <agent-id>` | Update an agent (--name, --version, etc.) |
|
|
66
|
+
| `agentgate delete <agent-id>` | Delete a deployed agent |
|
|
67
|
+
|
|
68
|
+
All commands that modify data require `--api-key` or the `AGENTGATE_API_KEY` environment variable.
|
|
69
|
+
|
|
70
|
+
## Python SDK
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
from agentgate.sdk import AgentGateClient
|
|
74
|
+
|
|
75
|
+
# Connect to AgentGate
|
|
76
|
+
client = AgentGateClient("https://agentgate.sh", api_key="your-key")
|
|
77
|
+
|
|
78
|
+
# List agents
|
|
79
|
+
agents = client.list_agents()
|
|
80
|
+
|
|
81
|
+
# Register a new agent
|
|
82
|
+
agent = client.register_agent(
|
|
83
|
+
name="my-agent",
|
|
84
|
+
url="https://my-agent.example.com",
|
|
85
|
+
description="A helpful agent",
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
# Send a task to an agent (A2A routing via AgentGate)
|
|
89
|
+
result = client.send_task(agent["id"], "Hello, agent!")
|
|
90
|
+
print(result["artifacts"][0]["parts"][0]["text"])
|
|
91
|
+
|
|
92
|
+
# Update an agent
|
|
93
|
+
client.update_agent(agent["id"], version="2.0.0")
|
|
94
|
+
|
|
95
|
+
# Delete an agent
|
|
96
|
+
client.delete_agent(agent["id"])
|
|
97
|
+
|
|
98
|
+
# Context manager for automatic cleanup
|
|
99
|
+
with AgentGateClient("https://agentgate.sh") as c:
|
|
100
|
+
print(c.health())
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## API Endpoints
|
|
104
|
+
|
|
105
|
+
| Method | Path | Auth | Description |
|
|
106
|
+
|--------|------|------|-------------|
|
|
107
|
+
| `GET` | `/health` | No | Server health check |
|
|
108
|
+
| `GET` | `/` | No | Landing page |
|
|
109
|
+
| `GET` | `/.well-known/agent.json` | No | A2A discovery endpoint |
|
|
110
|
+
| `GET` | `/agents/` | No | List all agents |
|
|
111
|
+
| `GET` | `/agents/{id}` | No | Get agent details |
|
|
112
|
+
| `GET` | `/agents/{id}/card` | No | Get A2A Agent Card |
|
|
113
|
+
| `POST` | `/agents/` | Yes | Register a new agent |
|
|
114
|
+
| `PUT` | `/agents/{id}` | Yes | Update an agent |
|
|
115
|
+
| `DELETE` | `/agents/{id}` | Yes | Delete an agent |
|
|
116
|
+
| `POST` | `/agents/{id}/task` | No | Route A2A task to agent (rate limited) |
|
|
117
|
+
| `GET` | `/metrics` | No | Task routing metrics |
|
|
118
|
+
|
|
119
|
+
## Development
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# Clone the repo
|
|
123
|
+
git clone https://github.com/agentgatesh/agentgate.git
|
|
124
|
+
cd agentgate
|
|
125
|
+
|
|
126
|
+
# Install dependencies (requires uv)
|
|
127
|
+
uv sync --dev
|
|
128
|
+
|
|
129
|
+
# Run tests
|
|
130
|
+
uv run pytest -v
|
|
131
|
+
|
|
132
|
+
# Lint
|
|
133
|
+
uv run ruff check src/ tests/
|
|
134
|
+
|
|
135
|
+
# Start services locally
|
|
136
|
+
docker compose up -d
|
|
137
|
+
|
|
138
|
+
# Check status
|
|
139
|
+
uv run agentgate status --server http://localhost:8000
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Architecture
|
|
143
|
+
|
|
144
|
+
- **Framework**: FastAPI + Uvicorn
|
|
145
|
+
- **Database**: PostgreSQL 16 + SQLAlchemy async + Alembic
|
|
146
|
+
- **CLI**: Click
|
|
147
|
+
- **Packaging**: uv + hatchling
|
|
148
|
+
- **Deploy**: Docker Compose + Caddy reverse proxy
|
|
149
|
+
|
|
150
|
+
## License
|
|
151
|
+
|
|
152
|
+
AGPL-3.0 — see [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# A generic, single database configuration.
|
|
2
|
+
|
|
3
|
+
[alembic]
|
|
4
|
+
# path to migration scripts.
|
|
5
|
+
# this is typically a path given in POSIX (e.g. forward slashes)
|
|
6
|
+
# format, relative to the token %(here)s which refers to the location of this
|
|
7
|
+
# ini file
|
|
8
|
+
script_location = %(here)s/src/agentgate/db/migrations
|
|
9
|
+
|
|
10
|
+
# template used to generate migration file names; The default value is %%(rev)s_%%(slug)s
|
|
11
|
+
# Uncomment the line below if you want the files to be prepended with date and time
|
|
12
|
+
# see https://alembic.sqlalchemy.org/en/latest/tutorial.html#editing-the-ini-file
|
|
13
|
+
# for all available tokens
|
|
14
|
+
# file_template = %%(year)d_%%(month).2d_%%(day).2d_%%(hour).2d%%(minute).2d-%%(rev)s_%%(slug)s
|
|
15
|
+
# Or organize into date-based subdirectories (requires recursive_version_locations = true)
|
|
16
|
+
# file_template = %%(year)d/%%(month).2d/%%(day).2d_%%(hour).2d%%(minute).2d_%%(second).2d_%%(rev)s_%%(slug)s
|
|
17
|
+
|
|
18
|
+
# sys.path path, will be prepended to sys.path if present.
|
|
19
|
+
# defaults to the current working directory. for multiple paths, the path separator
|
|
20
|
+
# is defined by "path_separator" below.
|
|
21
|
+
prepend_sys_path = . src
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
# timezone to use when rendering the date within the migration file
|
|
25
|
+
# as well as the filename.
|
|
26
|
+
# If specified, requires the tzdata library which can be installed by adding
|
|
27
|
+
# `alembic[tz]` to the pip requirements.
|
|
28
|
+
# string value is passed to ZoneInfo()
|
|
29
|
+
# leave blank for localtime
|
|
30
|
+
# timezone =
|
|
31
|
+
|
|
32
|
+
# max length of characters to apply to the "slug" field
|
|
33
|
+
# truncate_slug_length = 40
|
|
34
|
+
|
|
35
|
+
# set to 'true' to run the environment during
|
|
36
|
+
# the 'revision' command, regardless of autogenerate
|
|
37
|
+
# revision_environment = false
|
|
38
|
+
|
|
39
|
+
# set to 'true' to allow .pyc and .pyo files without
|
|
40
|
+
# a source .py file to be detected as revisions in the
|
|
41
|
+
# versions/ directory
|
|
42
|
+
# sourceless = false
|
|
43
|
+
|
|
44
|
+
# version location specification; This defaults
|
|
45
|
+
# to <script_location>/versions. When using multiple version
|
|
46
|
+
# directories, initial revisions must be specified with --version-path.
|
|
47
|
+
# The path separator used here should be the separator specified by "path_separator"
|
|
48
|
+
# below.
|
|
49
|
+
# version_locations = %(here)s/bar:%(here)s/bat:%(here)s/alembic/versions
|
|
50
|
+
|
|
51
|
+
# path_separator; This indicates what character is used to split lists of file
|
|
52
|
+
# paths, including version_locations and prepend_sys_path within configparser
|
|
53
|
+
# files such as alembic.ini.
|
|
54
|
+
# The default rendered in new alembic.ini files is "os", which uses os.pathsep
|
|
55
|
+
# to provide os-dependent path splitting.
|
|
56
|
+
#
|
|
57
|
+
# Note that in order to support legacy alembic.ini files, this default does NOT
|
|
58
|
+
# take place if path_separator is not present in alembic.ini. If this
|
|
59
|
+
# option is omitted entirely, fallback logic is as follows:
|
|
60
|
+
#
|
|
61
|
+
# 1. Parsing of the version_locations option falls back to using the legacy
|
|
62
|
+
# "version_path_separator" key, which if absent then falls back to the legacy
|
|
63
|
+
# behavior of splitting on spaces and/or commas.
|
|
64
|
+
# 2. Parsing of the prepend_sys_path option falls back to the legacy
|
|
65
|
+
# behavior of splitting on spaces, commas, or colons.
|
|
66
|
+
#
|
|
67
|
+
# Valid values for path_separator are:
|
|
68
|
+
#
|
|
69
|
+
# path_separator = :
|
|
70
|
+
# path_separator = ;
|
|
71
|
+
# path_separator = space
|
|
72
|
+
# path_separator = newline
|
|
73
|
+
#
|
|
74
|
+
# Use os.pathsep. Default configuration used for new projects.
|
|
75
|
+
path_separator = os
|
|
76
|
+
|
|
77
|
+
# set to 'true' to search source files recursively
|
|
78
|
+
# in each "version_locations" directory
|
|
79
|
+
# new in Alembic version 1.10
|
|
80
|
+
# recursive_version_locations = false
|
|
81
|
+
|
|
82
|
+
# the output encoding used when revision files
|
|
83
|
+
# are written from script.py.mako
|
|
84
|
+
# output_encoding = utf-8
|
|
85
|
+
|
|
86
|
+
# database URL. This is consumed by the user-maintained env.py script only.
|
|
87
|
+
# other means of configuring database URLs may be customized within the env.py
|
|
88
|
+
# file.
|
|
89
|
+
sqlalchemy.url = driver://user:pass@localhost/dbname
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
[post_write_hooks]
|
|
93
|
+
# post_write_hooks defines scripts or Python functions that are run
|
|
94
|
+
# on newly generated revision scripts. See the documentation for further
|
|
95
|
+
# detail and examples
|
|
96
|
+
|
|
97
|
+
# format using "black" - use the console_scripts runner, against the "black" entrypoint
|
|
98
|
+
# hooks = black
|
|
99
|
+
# black.type = console_scripts
|
|
100
|
+
# black.entrypoint = black
|
|
101
|
+
# black.options = -l 79 REVISION_SCRIPT_FILENAME
|
|
102
|
+
|
|
103
|
+
# lint with attempts to fix using "ruff" - use the module runner, against the "ruff" module
|
|
104
|
+
# hooks = ruff
|
|
105
|
+
# ruff.type = module
|
|
106
|
+
# ruff.module = ruff
|
|
107
|
+
# ruff.options = check --fix REVISION_SCRIPT_FILENAME
|
|
108
|
+
|
|
109
|
+
# Alternatively, use the exec runner to execute a binary found on your PATH
|
|
110
|
+
# hooks = ruff
|
|
111
|
+
# ruff.type = exec
|
|
112
|
+
# ruff.executable = ruff
|
|
113
|
+
# ruff.options = check --fix REVISION_SCRIPT_FILENAME
|
|
114
|
+
|
|
115
|
+
# Logging configuration. This is also consumed by the user-maintained
|
|
116
|
+
# env.py script only.
|
|
117
|
+
[loggers]
|
|
118
|
+
keys = root,sqlalchemy,alembic
|
|
119
|
+
|
|
120
|
+
[handlers]
|
|
121
|
+
keys = console
|
|
122
|
+
|
|
123
|
+
[formatters]
|
|
124
|
+
keys = generic
|
|
125
|
+
|
|
126
|
+
[logger_root]
|
|
127
|
+
level = WARNING
|
|
128
|
+
handlers = console
|
|
129
|
+
qualname =
|
|
130
|
+
|
|
131
|
+
[logger_sqlalchemy]
|
|
132
|
+
level = WARNING
|
|
133
|
+
handlers =
|
|
134
|
+
qualname = sqlalchemy.engine
|
|
135
|
+
|
|
136
|
+
[logger_alembic]
|
|
137
|
+
level = INFO
|
|
138
|
+
handlers =
|
|
139
|
+
qualname = alembic
|
|
140
|
+
|
|
141
|
+
[handler_console]
|
|
142
|
+
class = StreamHandler
|
|
143
|
+
args = (sys.stderr,)
|
|
144
|
+
level = NOTSET
|
|
145
|
+
formatter = generic
|
|
146
|
+
|
|
147
|
+
[formatter_generic]
|
|
148
|
+
format = %(levelname)-5.5s [%(name)s] %(message)s
|
|
149
|
+
datefmt = %H:%M:%S
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
services:
|
|
2
|
+
db:
|
|
3
|
+
image: postgres:16-alpine
|
|
4
|
+
restart: unless-stopped
|
|
5
|
+
environment:
|
|
6
|
+
POSTGRES_USER: agentgate
|
|
7
|
+
POSTGRES_PASSWORD: ${DB_PASSWORD:-changeme}
|
|
8
|
+
POSTGRES_DB: agentgate
|
|
9
|
+
volumes:
|
|
10
|
+
- pgdata:/var/lib/postgresql/data
|
|
11
|
+
ports:
|
|
12
|
+
- "127.0.0.1:5432:5432"
|
|
13
|
+
healthcheck:
|
|
14
|
+
test: ["CMD-SHELL", "pg_isready -U agentgate"]
|
|
15
|
+
interval: 5s
|
|
16
|
+
timeout: 5s
|
|
17
|
+
retries: 5
|
|
18
|
+
|
|
19
|
+
api:
|
|
20
|
+
build: .
|
|
21
|
+
restart: unless-stopped
|
|
22
|
+
depends_on:
|
|
23
|
+
db:
|
|
24
|
+
condition: service_healthy
|
|
25
|
+
environment:
|
|
26
|
+
DATABASE_URL: postgresql+asyncpg://agentgate:${DB_PASSWORD:-changeme}@db:5432/agentgate
|
|
27
|
+
SECRET_KEY: ${SECRET_KEY:-changeme}
|
|
28
|
+
API_KEY: ${API_KEY}
|
|
29
|
+
ports:
|
|
30
|
+
- "127.0.0.1:8000:8000"
|
|
31
|
+
|
|
32
|
+
echo-agent:
|
|
33
|
+
build: examples/echo-agent
|
|
34
|
+
restart: unless-stopped
|
|
35
|
+
ports:
|
|
36
|
+
- "127.0.0.1:9000:9000"
|
|
37
|
+
|
|
38
|
+
calc-agent:
|
|
39
|
+
build: examples/calc-agent
|
|
40
|
+
restart: unless-stopped
|
|
41
|
+
ports:
|
|
42
|
+
- "127.0.0.1:9001:9001"
|
|
43
|
+
|
|
44
|
+
volumes:
|
|
45
|
+
pgdata:
|