agentdraft 0.1.0__tar.gz → 0.1.1__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.
- {agentdraft-0.1.0 → agentdraft-0.1.1}/PKG-INFO +72 -29
- agentdraft-0.1.1/README.md +161 -0
- {agentdraft-0.1.0 → agentdraft-0.1.1}/agentdraft/__init__.py +2 -2
- {agentdraft-0.1.0 → agentdraft-0.1.1}/agentdraft/client.py +3 -1
- {agentdraft-0.1.0 → agentdraft-0.1.1}/agentdraft.egg-info/PKG-INFO +72 -29
- {agentdraft-0.1.0 → agentdraft-0.1.1}/pyproject.toml +20 -6
- agentdraft-0.1.0/README.md +0 -120
- {agentdraft-0.1.0 → agentdraft-0.1.1}/LICENSE +0 -0
- {agentdraft-0.1.0 → agentdraft-0.1.1}/agentdraft/errors.py +0 -0
- {agentdraft-0.1.0 → agentdraft-0.1.1}/agentdraft/models.py +0 -0
- {agentdraft-0.1.0 → agentdraft-0.1.1}/agentdraft/py.typed +0 -0
- {agentdraft-0.1.0 → agentdraft-0.1.1}/agentdraft.egg-info/SOURCES.txt +0 -0
- {agentdraft-0.1.0 → agentdraft-0.1.1}/agentdraft.egg-info/dependency_links.txt +0 -0
- {agentdraft-0.1.0 → agentdraft-0.1.1}/agentdraft.egg-info/requires.txt +0 -0
- {agentdraft-0.1.0 → agentdraft-0.1.1}/agentdraft.egg-info/top_level.txt +0 -0
- {agentdraft-0.1.0 → agentdraft-0.1.1}/setup.cfg +0 -0
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agentdraft
|
|
3
|
-
Version: 0.1.
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Coordination layer for AI scheduling agents — race-free multi-agent booking with priority ranking and an audit log.
|
|
5
5
|
Author-email: AgentDraft Labs <hello@agentdraft.io>
|
|
6
6
|
License: MIT
|
|
7
7
|
Project-URL: Homepage, https://agentdraft.io
|
|
8
8
|
Project-URL: Documentation, https://agentdraft.io/docs
|
|
9
|
-
Project-URL:
|
|
10
|
-
Project-URL:
|
|
11
|
-
|
|
12
|
-
Keywords: calendar,scheduling,ai-agents,agentdraft
|
|
9
|
+
Project-URL: Specification, https://agentdraft.io/spec
|
|
10
|
+
Project-URL: Changelog, https://agentdraft.io/changelog
|
|
11
|
+
Keywords: agentdraft,ai-agents,agents,calendar,scheduling,booking,coordination,langchain,crewai,autogen,mcp
|
|
13
12
|
Classifier: Development Status :: 4 - Beta
|
|
14
13
|
Classifier: Intended Audience :: Developers
|
|
15
14
|
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
16
|
Classifier: Programming Language :: Python :: 3
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.9
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.10
|
|
19
19
|
Classifier: Programming Language :: Python :: 3.11
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.12
|
|
21
21
|
Classifier: Topic :: Office/Business :: Scheduling
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Classifier: Typing :: Typed
|
|
22
24
|
Requires-Python: >=3.9
|
|
23
25
|
Description-Content-Type: text/markdown
|
|
24
26
|
License-File: LICENSE
|
|
@@ -29,17 +31,20 @@ Dynamic: license-file
|
|
|
29
31
|
|
|
30
32
|
[](https://pypi.org/project/agentdraft/)
|
|
31
33
|
[](https://pypi.org/project/agentdraft/)
|
|
32
|
-
[](
|
|
34
|
+
[](https://agentdraft.io/legal/license)
|
|
33
35
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
**AgentDraft is the coordination layer for AI scheduling agents.** When two
|
|
37
|
+
or more agents — your sales bot, a Cal.com handler, an internal recruiter,
|
|
38
|
+
a Claude/OpenAI assistant — write to the same calendar, AgentDraft is the
|
|
39
|
+
one API that decides who wins, atomically, with a tamper-evident audit row
|
|
40
|
+
for every commit.
|
|
36
41
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
booking; every commit goes through one deterministic engine; every
|
|
40
|
-
action is recorded in one tamper-evident audit log.
|
|
42
|
+
This is the official Python SDK. It gives an agent a typed, one-line
|
|
43
|
+
surface to participate.
|
|
41
44
|
|
|
42
|
-
|
|
45
|
+
- **Protocol spec:** <https://agentdraft.io/spec>
|
|
46
|
+
- **Why it exists:** <https://agentdraft.io/why>
|
|
47
|
+
- **Live API reference:** <https://agentdraft.io/docs>
|
|
43
48
|
|
|
44
49
|
## Install
|
|
45
50
|
|
|
@@ -76,6 +81,41 @@ knows who won, by what priority, and where the audit row lives, so
|
|
|
76
81
|
fallback behavior (propose an alternate, escalate, defer) is a clean
|
|
77
82
|
`except` clause away.
|
|
78
83
|
|
|
84
|
+
## Why a separate API?
|
|
85
|
+
|
|
86
|
+
Coordinator frameworks (LangChain, LangGraph, CrewAI, AutoGen, Composio,
|
|
87
|
+
the OpenAI Agents SDK) coordinate *work between agents* — sequential,
|
|
88
|
+
parallel, or graph orchestration of LLM calls and tools. None of them
|
|
89
|
+
solve **write contention on the calendar itself**: two agents firing
|
|
90
|
+
`POST /events` against Google Calendar at the same moment will both
|
|
91
|
+
succeed, and you have a double-booking.
|
|
92
|
+
|
|
93
|
+
AgentDraft solves only that problem, and solves it once. Every agent
|
|
94
|
+
the calendar owner runs calls `bookings.commit(...)` against AgentDraft
|
|
95
|
+
before touching the real calendar. The conflict engine uses
|
|
96
|
+
time-bucketed conditional writes in DynamoDB inside a single
|
|
97
|
+
`TransactWriteItems` — atomic, race-free, no locks. The user ranks
|
|
98
|
+
their agents in the dashboard; ties go to the higher-rank agent;
|
|
99
|
+
recent commits can be evicted by higher-priority agents inside a
|
|
100
|
+
configurable bump window.
|
|
101
|
+
|
|
102
|
+
## See the race
|
|
103
|
+
|
|
104
|
+
The repo ships a multi-agent race demo. With the local stack up:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
git clone https://github.com/GipsyChef/agentdraft && cd agentdraft
|
|
108
|
+
docker compose up -d dynamodb
|
|
109
|
+
pip install -e ".[dev]" -e sdks/python
|
|
110
|
+
uvicorn app.main:app --port 8080 &
|
|
111
|
+
python scripts/demo_race.py # 5 agents, ranked priorities, one slot
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Five agents fire concurrently at the same target slot. The highest-rank
|
|
115
|
+
agent wins; the rest get `409 outranked` with the winner's identity for
|
|
116
|
+
graceful fallback. The demo prints per-agent latency, the winning
|
|
117
|
+
booking id, and a link to the audit trail of the whole race.
|
|
118
|
+
|
|
79
119
|
## Authentication
|
|
80
120
|
|
|
81
121
|
API keys are issued from the AgentDraft dashboard and start with
|
|
@@ -108,10 +148,12 @@ All blocking I/O. An async client is on the roadmap; for now wrap with
|
|
|
108
148
|
|
|
109
149
|
Every failure is a typed exception so callers can branch precisely:
|
|
110
150
|
|
|
111
|
-
- `Conflict` — your write was outranked. Carries `
|
|
112
|
-
`winning_agent_priority`, `
|
|
113
|
-
|
|
114
|
-
|
|
151
|
+
- `Conflict` — your write was outranked. Carries `winning_booking_id`,
|
|
152
|
+
`winning_agent_id`, `winning_agent_priority`, `your_priority`, and
|
|
153
|
+
`reason`. The winning booking's `audit_event_id` is available on the
|
|
154
|
+
returned `Booking` model for the agent that *did* win.
|
|
155
|
+
- `AuthError` — bad / missing / expired API key.
|
|
156
|
+
- `RateLimited` — token bucket exhausted. Has `retry_after` (seconds).
|
|
115
157
|
- `RuleViolation` — request was syntactically valid but violated a
|
|
116
158
|
rule (focus block, daily cap, business hours).
|
|
117
159
|
- `AgentDraftError` — base class; catch this if you only need a
|
|
@@ -123,25 +165,26 @@ Pass `idempotency_key=` to `bookings.commit(...)`. The server caches the
|
|
|
123
165
|
result by `(agent_id, key)` for 24 hours, so a retry over a flaky network
|
|
124
166
|
returns the original booking, not a duplicate.
|
|
125
167
|
|
|
168
|
+
## Use with LangChain / CrewAI / AutoGen
|
|
169
|
+
|
|
170
|
+
The SDK is framework-agnostic — wrap any method in a `Tool` and pass it
|
|
171
|
+
to your agent. A first-party `agentdraft-langchain` package with ready
|
|
172
|
+
`BookingTool` / `AvailabilityTool` / `ConflictAwareBookingTool`
|
|
173
|
+
wrappers is on the roadmap.
|
|
174
|
+
|
|
126
175
|
## Links
|
|
127
176
|
|
|
128
177
|
- Protocol spec: <https://agentdraft.io/spec>
|
|
129
178
|
- API docs: <https://agentdraft.io/docs>
|
|
130
|
-
- Changelog:
|
|
131
|
-
-
|
|
179
|
+
- Changelog: <https://agentdraft.io/changelog>
|
|
180
|
+
- Source & issues: <https://github.com/GipsyChef/agentdraft>
|
|
132
181
|
- TypeScript SDK: [`@agentdraft/sdk`](https://www.npmjs.com/package/@agentdraft/sdk)
|
|
133
182
|
|
|
134
183
|
## Security
|
|
135
184
|
|
|
136
|
-
Found a vulnerability?
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
## Contributing
|
|
140
|
-
|
|
141
|
-
See [CONTRIBUTING.md](CONTRIBUTING.md). This SDK lives inside the
|
|
142
|
-
[`GipsyChef/agentdraft`](https://github.com/GipsyChef/agentdraft)
|
|
143
|
-
monorepo under `sdks/python/`.
|
|
185
|
+
Found a vulnerability? See <https://agentdraft.io/security> — **do not**
|
|
186
|
+
open a public issue for a security report.
|
|
144
187
|
|
|
145
188
|
## License
|
|
146
189
|
|
|
147
|
-
MIT — see
|
|
190
|
+
MIT — see <https://agentdraft.io/legal/license>.
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# agentdraft — Python SDK
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/agentdraft/)
|
|
4
|
+
[](https://pypi.org/project/agentdraft/)
|
|
5
|
+
[](https://agentdraft.io/legal/license)
|
|
6
|
+
|
|
7
|
+
**AgentDraft is the coordination layer for AI scheduling agents.** When two
|
|
8
|
+
or more agents — your sales bot, a Cal.com handler, an internal recruiter,
|
|
9
|
+
a Claude/OpenAI assistant — write to the same calendar, AgentDraft is the
|
|
10
|
+
one API that decides who wins, atomically, with a tamper-evident audit row
|
|
11
|
+
for every commit.
|
|
12
|
+
|
|
13
|
+
This is the official Python SDK. It gives an agent a typed, one-line
|
|
14
|
+
surface to participate.
|
|
15
|
+
|
|
16
|
+
- **Protocol spec:** <https://agentdraft.io/spec>
|
|
17
|
+
- **Why it exists:** <https://agentdraft.io/why>
|
|
18
|
+
- **Live API reference:** <https://agentdraft.io/docs>
|
|
19
|
+
|
|
20
|
+
## Install
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install agentdraft
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Requires Python 3.9+.
|
|
27
|
+
|
|
28
|
+
## Quickstart
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
from datetime import datetime, timedelta, timezone
|
|
32
|
+
from agentdraft import Client, Conflict
|
|
33
|
+
|
|
34
|
+
client = Client(api_key="avs_live_...") # or set AGENTDRAFT_API_KEY
|
|
35
|
+
|
|
36
|
+
start = datetime.now(timezone.utc) + timedelta(hours=4)
|
|
37
|
+
end = start + timedelta(minutes=30)
|
|
38
|
+
|
|
39
|
+
try:
|
|
40
|
+
booking = client.bookings.commit(
|
|
41
|
+
start=start, end=end,
|
|
42
|
+
idempotency_key="ik_call_42",
|
|
43
|
+
metadata={"title": "Discovery call"},
|
|
44
|
+
)
|
|
45
|
+
print("booked:", booking.booking_id)
|
|
46
|
+
except Conflict as e:
|
|
47
|
+
print(f"outranked by {e.winning_agent_id} (rank {e.winning_agent_priority})")
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
A losing agent gets a typed `Conflict` exception, not a timeout — it
|
|
51
|
+
knows who won, by what priority, and where the audit row lives, so
|
|
52
|
+
fallback behavior (propose an alternate, escalate, defer) is a clean
|
|
53
|
+
`except` clause away.
|
|
54
|
+
|
|
55
|
+
## Why a separate API?
|
|
56
|
+
|
|
57
|
+
Coordinator frameworks (LangChain, LangGraph, CrewAI, AutoGen, Composio,
|
|
58
|
+
the OpenAI Agents SDK) coordinate *work between agents* — sequential,
|
|
59
|
+
parallel, or graph orchestration of LLM calls and tools. None of them
|
|
60
|
+
solve **write contention on the calendar itself**: two agents firing
|
|
61
|
+
`POST /events` against Google Calendar at the same moment will both
|
|
62
|
+
succeed, and you have a double-booking.
|
|
63
|
+
|
|
64
|
+
AgentDraft solves only that problem, and solves it once. Every agent
|
|
65
|
+
the calendar owner runs calls `bookings.commit(...)` against AgentDraft
|
|
66
|
+
before touching the real calendar. The conflict engine uses
|
|
67
|
+
time-bucketed conditional writes in DynamoDB inside a single
|
|
68
|
+
`TransactWriteItems` — atomic, race-free, no locks. The user ranks
|
|
69
|
+
their agents in the dashboard; ties go to the higher-rank agent;
|
|
70
|
+
recent commits can be evicted by higher-priority agents inside a
|
|
71
|
+
configurable bump window.
|
|
72
|
+
|
|
73
|
+
## See the race
|
|
74
|
+
|
|
75
|
+
The repo ships a multi-agent race demo. With the local stack up:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
git clone https://github.com/GipsyChef/agentdraft && cd agentdraft
|
|
79
|
+
docker compose up -d dynamodb
|
|
80
|
+
pip install -e ".[dev]" -e sdks/python
|
|
81
|
+
uvicorn app.main:app --port 8080 &
|
|
82
|
+
python scripts/demo_race.py # 5 agents, ranked priorities, one slot
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Five agents fire concurrently at the same target slot. The highest-rank
|
|
86
|
+
agent wins; the rest get `409 outranked` with the winner's identity for
|
|
87
|
+
graceful fallback. The demo prints per-agent latency, the winning
|
|
88
|
+
booking id, and a link to the audit trail of the whole race.
|
|
89
|
+
|
|
90
|
+
## Authentication
|
|
91
|
+
|
|
92
|
+
API keys are issued from the AgentDraft dashboard and start with
|
|
93
|
+
`avs_live_`. Pass it explicitly or let the client read it from the
|
|
94
|
+
environment:
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
Client(api_key="avs_live_...")
|
|
98
|
+
# or
|
|
99
|
+
import os; os.environ["AGENTDRAFT_API_KEY"] = "avs_live_..."
|
|
100
|
+
Client()
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
For local development against a dev backend, point at it via
|
|
104
|
+
`AGENTDRAFT_BASE_URL` or the `base_url=` kwarg.
|
|
105
|
+
|
|
106
|
+
## Surface
|
|
107
|
+
|
|
108
|
+
| Attribute | Purpose |
|
|
109
|
+
|---|---|
|
|
110
|
+
| `client.availability` | Read merged availability across all agents writing to the calendar |
|
|
111
|
+
| `client.bookings` | `hold`, `release`, `commit`, `cancel` — the four state transitions |
|
|
112
|
+
| `client.agents` | `me()` — confirm key + current priority + scopes |
|
|
113
|
+
| `client.mailbox` | Inbound/outbound mail surface for agents that book via email |
|
|
114
|
+
|
|
115
|
+
All blocking I/O. An async client is on the roadmap; for now wrap with
|
|
116
|
+
`asyncio.to_thread` if you need concurrency.
|
|
117
|
+
|
|
118
|
+
## Error types
|
|
119
|
+
|
|
120
|
+
Every failure is a typed exception so callers can branch precisely:
|
|
121
|
+
|
|
122
|
+
- `Conflict` — your write was outranked. Carries `winning_booking_id`,
|
|
123
|
+
`winning_agent_id`, `winning_agent_priority`, `your_priority`, and
|
|
124
|
+
`reason`. The winning booking's `audit_event_id` is available on the
|
|
125
|
+
returned `Booking` model for the agent that *did* win.
|
|
126
|
+
- `AuthError` — bad / missing / expired API key.
|
|
127
|
+
- `RateLimited` — token bucket exhausted. Has `retry_after` (seconds).
|
|
128
|
+
- `RuleViolation` — request was syntactically valid but violated a
|
|
129
|
+
rule (focus block, daily cap, business hours).
|
|
130
|
+
- `AgentDraftError` — base class; catch this if you only need a
|
|
131
|
+
catch-all.
|
|
132
|
+
|
|
133
|
+
## Idempotency
|
|
134
|
+
|
|
135
|
+
Pass `idempotency_key=` to `bookings.commit(...)`. The server caches the
|
|
136
|
+
result by `(agent_id, key)` for 24 hours, so a retry over a flaky network
|
|
137
|
+
returns the original booking, not a duplicate.
|
|
138
|
+
|
|
139
|
+
## Use with LangChain / CrewAI / AutoGen
|
|
140
|
+
|
|
141
|
+
The SDK is framework-agnostic — wrap any method in a `Tool` and pass it
|
|
142
|
+
to your agent. A first-party `agentdraft-langchain` package with ready
|
|
143
|
+
`BookingTool` / `AvailabilityTool` / `ConflictAwareBookingTool`
|
|
144
|
+
wrappers is on the roadmap.
|
|
145
|
+
|
|
146
|
+
## Links
|
|
147
|
+
|
|
148
|
+
- Protocol spec: <https://agentdraft.io/spec>
|
|
149
|
+
- API docs: <https://agentdraft.io/docs>
|
|
150
|
+
- Changelog: <https://agentdraft.io/changelog>
|
|
151
|
+
- Source & issues: <https://github.com/GipsyChef/agentdraft>
|
|
152
|
+
- TypeScript SDK: [`@agentdraft/sdk`](https://www.npmjs.com/package/@agentdraft/sdk)
|
|
153
|
+
|
|
154
|
+
## Security
|
|
155
|
+
|
|
156
|
+
Found a vulnerability? See <https://agentdraft.io/security> — **do not**
|
|
157
|
+
open a public issue for a security report.
|
|
158
|
+
|
|
159
|
+
## License
|
|
160
|
+
|
|
161
|
+
MIT — see <https://agentdraft.io/legal/license>.
|
|
@@ -23,6 +23,8 @@ Quickstart::
|
|
|
23
23
|
print(f"outranked by {e.winning_agent_id} (rank {e.winning_agent_priority})")
|
|
24
24
|
"""
|
|
25
25
|
|
|
26
|
+
__version__ = "0.1.1"
|
|
27
|
+
|
|
26
28
|
from .client import Client
|
|
27
29
|
from .errors import AgentDraftError, AuthError, Conflict, RateLimited, RuleViolation
|
|
28
30
|
from .models import Booking, Hold, Slot
|
|
@@ -38,5 +40,3 @@ __all__ = [
|
|
|
38
40
|
"Hold",
|
|
39
41
|
"Slot",
|
|
40
42
|
]
|
|
41
|
-
|
|
42
|
-
__version__ = "0.1.0"
|
|
@@ -8,10 +8,12 @@ from typing import Any, Optional
|
|
|
8
8
|
|
|
9
9
|
import httpx
|
|
10
10
|
|
|
11
|
+
from . import __version__
|
|
11
12
|
from .errors import AgentDraftError, AuthError, Conflict, RateLimited, RuleViolation
|
|
12
13
|
from .models import AgentIdentity, Booking, Slot
|
|
13
14
|
|
|
14
15
|
DEFAULT_BASE_URL = "https://api.agentdraft.io"
|
|
16
|
+
DEFAULT_USER_AGENT = f"agentdraft-python/{__version__}"
|
|
15
17
|
|
|
16
18
|
|
|
17
19
|
class Client:
|
|
@@ -37,7 +39,7 @@ class Client:
|
|
|
37
39
|
*,
|
|
38
40
|
base_url: Optional[str] = None,
|
|
39
41
|
timeout: float = 10.0,
|
|
40
|
-
user_agent: str =
|
|
42
|
+
user_agent: str = DEFAULT_USER_AGENT,
|
|
41
43
|
):
|
|
42
44
|
api_key = api_key or os.environ.get("AGENTDRAFT_API_KEY")
|
|
43
45
|
if not api_key:
|
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agentdraft
|
|
3
|
-
Version: 0.1.
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Coordination layer for AI scheduling agents — race-free multi-agent booking with priority ranking and an audit log.
|
|
5
5
|
Author-email: AgentDraft Labs <hello@agentdraft.io>
|
|
6
6
|
License: MIT
|
|
7
7
|
Project-URL: Homepage, https://agentdraft.io
|
|
8
8
|
Project-URL: Documentation, https://agentdraft.io/docs
|
|
9
|
-
Project-URL:
|
|
10
|
-
Project-URL:
|
|
11
|
-
|
|
12
|
-
Keywords: calendar,scheduling,ai-agents,agentdraft
|
|
9
|
+
Project-URL: Specification, https://agentdraft.io/spec
|
|
10
|
+
Project-URL: Changelog, https://agentdraft.io/changelog
|
|
11
|
+
Keywords: agentdraft,ai-agents,agents,calendar,scheduling,booking,coordination,langchain,crewai,autogen,mcp
|
|
13
12
|
Classifier: Development Status :: 4 - Beta
|
|
14
13
|
Classifier: Intended Audience :: Developers
|
|
15
14
|
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
16
|
Classifier: Programming Language :: Python :: 3
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.9
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.10
|
|
19
19
|
Classifier: Programming Language :: Python :: 3.11
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.12
|
|
21
21
|
Classifier: Topic :: Office/Business :: Scheduling
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Classifier: Typing :: Typed
|
|
22
24
|
Requires-Python: >=3.9
|
|
23
25
|
Description-Content-Type: text/markdown
|
|
24
26
|
License-File: LICENSE
|
|
@@ -29,17 +31,20 @@ Dynamic: license-file
|
|
|
29
31
|
|
|
30
32
|
[](https://pypi.org/project/agentdraft/)
|
|
31
33
|
[](https://pypi.org/project/agentdraft/)
|
|
32
|
-
[](
|
|
34
|
+
[](https://agentdraft.io/legal/license)
|
|
33
35
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
**AgentDraft is the coordination layer for AI scheduling agents.** When two
|
|
37
|
+
or more agents — your sales bot, a Cal.com handler, an internal recruiter,
|
|
38
|
+
a Claude/OpenAI assistant — write to the same calendar, AgentDraft is the
|
|
39
|
+
one API that decides who wins, atomically, with a tamper-evident audit row
|
|
40
|
+
for every commit.
|
|
36
41
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
booking; every commit goes through one deterministic engine; every
|
|
40
|
-
action is recorded in one tamper-evident audit log.
|
|
42
|
+
This is the official Python SDK. It gives an agent a typed, one-line
|
|
43
|
+
surface to participate.
|
|
41
44
|
|
|
42
|
-
|
|
45
|
+
- **Protocol spec:** <https://agentdraft.io/spec>
|
|
46
|
+
- **Why it exists:** <https://agentdraft.io/why>
|
|
47
|
+
- **Live API reference:** <https://agentdraft.io/docs>
|
|
43
48
|
|
|
44
49
|
## Install
|
|
45
50
|
|
|
@@ -76,6 +81,41 @@ knows who won, by what priority, and where the audit row lives, so
|
|
|
76
81
|
fallback behavior (propose an alternate, escalate, defer) is a clean
|
|
77
82
|
`except` clause away.
|
|
78
83
|
|
|
84
|
+
## Why a separate API?
|
|
85
|
+
|
|
86
|
+
Coordinator frameworks (LangChain, LangGraph, CrewAI, AutoGen, Composio,
|
|
87
|
+
the OpenAI Agents SDK) coordinate *work between agents* — sequential,
|
|
88
|
+
parallel, or graph orchestration of LLM calls and tools. None of them
|
|
89
|
+
solve **write contention on the calendar itself**: two agents firing
|
|
90
|
+
`POST /events` against Google Calendar at the same moment will both
|
|
91
|
+
succeed, and you have a double-booking.
|
|
92
|
+
|
|
93
|
+
AgentDraft solves only that problem, and solves it once. Every agent
|
|
94
|
+
the calendar owner runs calls `bookings.commit(...)` against AgentDraft
|
|
95
|
+
before touching the real calendar. The conflict engine uses
|
|
96
|
+
time-bucketed conditional writes in DynamoDB inside a single
|
|
97
|
+
`TransactWriteItems` — atomic, race-free, no locks. The user ranks
|
|
98
|
+
their agents in the dashboard; ties go to the higher-rank agent;
|
|
99
|
+
recent commits can be evicted by higher-priority agents inside a
|
|
100
|
+
configurable bump window.
|
|
101
|
+
|
|
102
|
+
## See the race
|
|
103
|
+
|
|
104
|
+
The repo ships a multi-agent race demo. With the local stack up:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
git clone https://github.com/GipsyChef/agentdraft && cd agentdraft
|
|
108
|
+
docker compose up -d dynamodb
|
|
109
|
+
pip install -e ".[dev]" -e sdks/python
|
|
110
|
+
uvicorn app.main:app --port 8080 &
|
|
111
|
+
python scripts/demo_race.py # 5 agents, ranked priorities, one slot
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Five agents fire concurrently at the same target slot. The highest-rank
|
|
115
|
+
agent wins; the rest get `409 outranked` with the winner's identity for
|
|
116
|
+
graceful fallback. The demo prints per-agent latency, the winning
|
|
117
|
+
booking id, and a link to the audit trail of the whole race.
|
|
118
|
+
|
|
79
119
|
## Authentication
|
|
80
120
|
|
|
81
121
|
API keys are issued from the AgentDraft dashboard and start with
|
|
@@ -108,10 +148,12 @@ All blocking I/O. An async client is on the roadmap; for now wrap with
|
|
|
108
148
|
|
|
109
149
|
Every failure is a typed exception so callers can branch precisely:
|
|
110
150
|
|
|
111
|
-
- `Conflict` — your write was outranked. Carries `
|
|
112
|
-
`winning_agent_priority`, `
|
|
113
|
-
|
|
114
|
-
|
|
151
|
+
- `Conflict` — your write was outranked. Carries `winning_booking_id`,
|
|
152
|
+
`winning_agent_id`, `winning_agent_priority`, `your_priority`, and
|
|
153
|
+
`reason`. The winning booking's `audit_event_id` is available on the
|
|
154
|
+
returned `Booking` model for the agent that *did* win.
|
|
155
|
+
- `AuthError` — bad / missing / expired API key.
|
|
156
|
+
- `RateLimited` — token bucket exhausted. Has `retry_after` (seconds).
|
|
115
157
|
- `RuleViolation` — request was syntactically valid but violated a
|
|
116
158
|
rule (focus block, daily cap, business hours).
|
|
117
159
|
- `AgentDraftError` — base class; catch this if you only need a
|
|
@@ -123,25 +165,26 @@ Pass `idempotency_key=` to `bookings.commit(...)`. The server caches the
|
|
|
123
165
|
result by `(agent_id, key)` for 24 hours, so a retry over a flaky network
|
|
124
166
|
returns the original booking, not a duplicate.
|
|
125
167
|
|
|
168
|
+
## Use with LangChain / CrewAI / AutoGen
|
|
169
|
+
|
|
170
|
+
The SDK is framework-agnostic — wrap any method in a `Tool` and pass it
|
|
171
|
+
to your agent. A first-party `agentdraft-langchain` package with ready
|
|
172
|
+
`BookingTool` / `AvailabilityTool` / `ConflictAwareBookingTool`
|
|
173
|
+
wrappers is on the roadmap.
|
|
174
|
+
|
|
126
175
|
## Links
|
|
127
176
|
|
|
128
177
|
- Protocol spec: <https://agentdraft.io/spec>
|
|
129
178
|
- API docs: <https://agentdraft.io/docs>
|
|
130
|
-
- Changelog:
|
|
131
|
-
-
|
|
179
|
+
- Changelog: <https://agentdraft.io/changelog>
|
|
180
|
+
- Source & issues: <https://github.com/GipsyChef/agentdraft>
|
|
132
181
|
- TypeScript SDK: [`@agentdraft/sdk`](https://www.npmjs.com/package/@agentdraft/sdk)
|
|
133
182
|
|
|
134
183
|
## Security
|
|
135
184
|
|
|
136
|
-
Found a vulnerability?
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
## Contributing
|
|
140
|
-
|
|
141
|
-
See [CONTRIBUTING.md](CONTRIBUTING.md). This SDK lives inside the
|
|
142
|
-
[`GipsyChef/agentdraft`](https://github.com/GipsyChef/agentdraft)
|
|
143
|
-
monorepo under `sdks/python/`.
|
|
185
|
+
Found a vulnerability? See <https://agentdraft.io/security> — **do not**
|
|
186
|
+
open a public issue for a security report.
|
|
144
187
|
|
|
145
188
|
## License
|
|
146
189
|
|
|
147
|
-
MIT — see
|
|
190
|
+
MIT — see <https://agentdraft.io/legal/license>.
|
|
@@ -1,31 +1,45 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "agentdraft"
|
|
3
|
-
version = "0.1.
|
|
4
|
-
description = "
|
|
3
|
+
version = "0.1.1"
|
|
4
|
+
description = "Coordination layer for AI scheduling agents — race-free multi-agent booking with priority ranking and an audit log."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.9"
|
|
7
7
|
license = { text = "MIT" }
|
|
8
8
|
authors = [{ name = "AgentDraft Labs", email = "hello@agentdraft.io" }]
|
|
9
|
-
keywords = [
|
|
9
|
+
keywords = [
|
|
10
|
+
"agentdraft",
|
|
11
|
+
"ai-agents",
|
|
12
|
+
"agents",
|
|
13
|
+
"calendar",
|
|
14
|
+
"scheduling",
|
|
15
|
+
"booking",
|
|
16
|
+
"coordination",
|
|
17
|
+
"langchain",
|
|
18
|
+
"crewai",
|
|
19
|
+
"autogen",
|
|
20
|
+
"mcp",
|
|
21
|
+
]
|
|
10
22
|
classifiers = [
|
|
11
23
|
"Development Status :: 4 - Beta",
|
|
12
24
|
"Intended Audience :: Developers",
|
|
13
25
|
"License :: OSI Approved :: MIT License",
|
|
26
|
+
"Operating System :: OS Independent",
|
|
14
27
|
"Programming Language :: Python :: 3",
|
|
15
28
|
"Programming Language :: Python :: 3.9",
|
|
16
29
|
"Programming Language :: Python :: 3.10",
|
|
17
30
|
"Programming Language :: Python :: 3.11",
|
|
18
31
|
"Programming Language :: Python :: 3.12",
|
|
19
32
|
"Topic :: Office/Business :: Scheduling",
|
|
33
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
34
|
+
"Typing :: Typed",
|
|
20
35
|
]
|
|
21
36
|
dependencies = ["httpx>=0.27.0"]
|
|
22
37
|
|
|
23
38
|
[project.urls]
|
|
24
39
|
Homepage = "https://agentdraft.io"
|
|
25
40
|
Documentation = "https://agentdraft.io/docs"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
Changelog = "https://github.com/GipsyChef/agentdraft/blob/main/sdks/python/CHANGELOG.md"
|
|
41
|
+
Specification = "https://agentdraft.io/spec"
|
|
42
|
+
Changelog = "https://agentdraft.io/changelog"
|
|
29
43
|
|
|
30
44
|
[build-system]
|
|
31
45
|
requires = ["setuptools>=68"]
|
agentdraft-0.1.0/README.md
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
# agentdraft — Python SDK
|
|
2
|
-
|
|
3
|
-
[](https://pypi.org/project/agentdraft/)
|
|
4
|
-
[](https://pypi.org/project/agentdraft/)
|
|
5
|
-
[](LICENSE)
|
|
6
|
-
|
|
7
|
-
The official Python SDK for [AgentDraft](https://agentdraft.io) — the
|
|
8
|
-
scheduling source of truth for AI agents.
|
|
9
|
-
|
|
10
|
-
AgentDraft is the coordination layer that prevents AI scheduling agents
|
|
11
|
-
from colliding on the same calendar. Every agent calls one API before
|
|
12
|
-
booking; every commit goes through one deterministic engine; every
|
|
13
|
-
action is recorded in one tamper-evident audit log.
|
|
14
|
-
|
|
15
|
-
This SDK gives Python agents a typed, one-line surface to participate.
|
|
16
|
-
|
|
17
|
-
## Install
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
pip install agentdraft
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
Requires Python 3.9+.
|
|
24
|
-
|
|
25
|
-
## Quickstart
|
|
26
|
-
|
|
27
|
-
```python
|
|
28
|
-
from datetime import datetime, timedelta, timezone
|
|
29
|
-
from agentdraft import Client, Conflict
|
|
30
|
-
|
|
31
|
-
client = Client(api_key="avs_live_...") # or set AGENTDRAFT_API_KEY
|
|
32
|
-
|
|
33
|
-
start = datetime.now(timezone.utc) + timedelta(hours=4)
|
|
34
|
-
end = start + timedelta(minutes=30)
|
|
35
|
-
|
|
36
|
-
try:
|
|
37
|
-
booking = client.bookings.commit(
|
|
38
|
-
start=start, end=end,
|
|
39
|
-
idempotency_key="ik_call_42",
|
|
40
|
-
metadata={"title": "Discovery call"},
|
|
41
|
-
)
|
|
42
|
-
print("booked:", booking.booking_id)
|
|
43
|
-
except Conflict as e:
|
|
44
|
-
print(f"outranked by {e.winning_agent_id} (rank {e.winning_agent_priority})")
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
A losing agent gets a typed `Conflict` exception, not a timeout — it
|
|
48
|
-
knows who won, by what priority, and where the audit row lives, so
|
|
49
|
-
fallback behavior (propose an alternate, escalate, defer) is a clean
|
|
50
|
-
`except` clause away.
|
|
51
|
-
|
|
52
|
-
## Authentication
|
|
53
|
-
|
|
54
|
-
API keys are issued from the AgentDraft dashboard and start with
|
|
55
|
-
`avs_live_`. Pass it explicitly or let the client read it from the
|
|
56
|
-
environment:
|
|
57
|
-
|
|
58
|
-
```python
|
|
59
|
-
Client(api_key="avs_live_...")
|
|
60
|
-
# or
|
|
61
|
-
import os; os.environ["AGENTDRAFT_API_KEY"] = "avs_live_..."
|
|
62
|
-
Client()
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
For local development against a dev backend, point at it via
|
|
66
|
-
`AGENTDRAFT_BASE_URL` or the `base_url=` kwarg.
|
|
67
|
-
|
|
68
|
-
## Surface
|
|
69
|
-
|
|
70
|
-
| Attribute | Purpose |
|
|
71
|
-
|---|---|
|
|
72
|
-
| `client.availability` | Read merged availability across all agents writing to the calendar |
|
|
73
|
-
| `client.bookings` | `hold`, `release`, `commit`, `cancel` — the four state transitions |
|
|
74
|
-
| `client.agents` | `me()` — confirm key + current priority + scopes |
|
|
75
|
-
| `client.mailbox` | Inbound/outbound mail surface for agents that book via email |
|
|
76
|
-
|
|
77
|
-
All blocking I/O. An async client is on the roadmap; for now wrap with
|
|
78
|
-
`asyncio.to_thread` if you need concurrency.
|
|
79
|
-
|
|
80
|
-
## Error types
|
|
81
|
-
|
|
82
|
-
Every failure is a typed exception so callers can branch precisely:
|
|
83
|
-
|
|
84
|
-
- `Conflict` — your write was outranked. Carries `winning_agent_id`,
|
|
85
|
-
`winning_agent_priority`, `winning_booking_id`, `audit_event_id`.
|
|
86
|
-
- `AuthError` — bad/missing/expired API key.
|
|
87
|
-
- `RateLimited` — token bucket exhausted. Has `retry_after_seconds`.
|
|
88
|
-
- `RuleViolation` — request was syntactically valid but violated a
|
|
89
|
-
rule (focus block, daily cap, business hours).
|
|
90
|
-
- `AgentDraftError` — base class; catch this if you only need a
|
|
91
|
-
catch-all.
|
|
92
|
-
|
|
93
|
-
## Idempotency
|
|
94
|
-
|
|
95
|
-
Pass `idempotency_key=` to `bookings.commit(...)`. The server caches the
|
|
96
|
-
result by `(agent_id, key)` for 24 hours, so a retry over a flaky network
|
|
97
|
-
returns the original booking, not a duplicate.
|
|
98
|
-
|
|
99
|
-
## Links
|
|
100
|
-
|
|
101
|
-
- Protocol spec: <https://agentdraft.io/spec>
|
|
102
|
-
- API docs: <https://agentdraft.io/docs>
|
|
103
|
-
- Changelog: [CHANGELOG.md](CHANGELOG.md)
|
|
104
|
-
- Issues / source: <https://github.com/GipsyChef/agentdraft>
|
|
105
|
-
- TypeScript SDK: [`@agentdraft/sdk`](https://www.npmjs.com/package/@agentdraft/sdk)
|
|
106
|
-
|
|
107
|
-
## Security
|
|
108
|
-
|
|
109
|
-
Found a vulnerability? Please follow [SECURITY.md](SECURITY.md) — **do
|
|
110
|
-
not** open a public issue for a security report.
|
|
111
|
-
|
|
112
|
-
## Contributing
|
|
113
|
-
|
|
114
|
-
See [CONTRIBUTING.md](CONTRIBUTING.md). This SDK lives inside the
|
|
115
|
-
[`GipsyChef/agentdraft`](https://github.com/GipsyChef/agentdraft)
|
|
116
|
-
monorepo under `sdks/python/`.
|
|
117
|
-
|
|
118
|
-
## License
|
|
119
|
-
|
|
120
|
-
MIT — see [LICENSE](LICENSE).
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|