samcoadk 0.4.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.
Files changed (37) hide show
  1. samcoadk-0.4.0/LICENSE +21 -0
  2. samcoadk-0.4.0/PKG-INFO +266 -0
  3. samcoadk-0.4.0/README.md +217 -0
  4. samcoadk-0.4.0/pyproject.toml +70 -0
  5. samcoadk-0.4.0/samcoadk/__init__.py +143 -0
  6. samcoadk-0.4.0/samcoadk/a2a.py +375 -0
  7. samcoadk-0.4.0/samcoadk/agent.py +289 -0
  8. samcoadk-0.4.0/samcoadk/backends.py +250 -0
  9. samcoadk-0.4.0/samcoadk/callbacks.py +153 -0
  10. samcoadk-0.4.0/samcoadk/cli.py +133 -0
  11. samcoadk-0.4.0/samcoadk/database.py +214 -0
  12. samcoadk-0.4.0/samcoadk/llm.py +480 -0
  13. samcoadk-0.4.0/samcoadk/mcp.py +592 -0
  14. samcoadk-0.4.0/samcoadk/observability.py +136 -0
  15. samcoadk-0.4.0/samcoadk/prompts.py +47 -0
  16. samcoadk-0.4.0/samcoadk/runner.py +133 -0
  17. samcoadk-0.4.0/samcoadk/server.py +294 -0
  18. samcoadk-0.4.0/samcoadk/sessions.py +249 -0
  19. samcoadk-0.4.0/samcoadk/skills.py +64 -0
  20. samcoadk-0.4.0/samcoadk/tools.py +191 -0
  21. samcoadk-0.4.0/samcoadk.egg-info/PKG-INFO +266 -0
  22. samcoadk-0.4.0/samcoadk.egg-info/SOURCES.txt +35 -0
  23. samcoadk-0.4.0/samcoadk.egg-info/dependency_links.txt +1 -0
  24. samcoadk-0.4.0/samcoadk.egg-info/entry_points.txt +2 -0
  25. samcoadk-0.4.0/samcoadk.egg-info/requires.txt +35 -0
  26. samcoadk-0.4.0/samcoadk.egg-info/top_level.txt +1 -0
  27. samcoadk-0.4.0/setup.cfg +4 -0
  28. samcoadk-0.4.0/tests/test_a2a_and_server.py +314 -0
  29. samcoadk-0.4.0/tests/test_a2a_datapart.py +237 -0
  30. samcoadk-0.4.0/tests/test_callbacks.py +185 -0
  31. samcoadk-0.4.0/tests/test_cli.py +93 -0
  32. samcoadk-0.4.0/tests/test_core.py +364 -0
  33. samcoadk-0.4.0/tests/test_import_surface.py +54 -0
  34. samcoadk-0.4.0/tests/test_llm.py +148 -0
  35. samcoadk-0.4.0/tests/test_packaging.py +107 -0
  36. samcoadk-0.4.0/tests/test_sessions_backends.py +235 -0
  37. samcoadk-0.4.0/tests/test_sql_backend_shape.py +173 -0
samcoadk-0.4.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Samco Securities Limited
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.
@@ -0,0 +1,266 @@
1
+ Metadata-Version: 2.4
2
+ Name: samcoadk
3
+ Version: 0.4.0
4
+ Summary: A small Agent Development Kit — Agent, Runner, SessionService, tools, callbacks and A2A.
5
+ Author: samcoadk contributors
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://bitbucket.org/samco-team/samco-adk
8
+ Project-URL: Repository, https://bitbucket.org/samco-team/samco-adk
9
+ Project-URL: Issues, https://bitbucket.org/samco-team/samco-adk/issues
10
+ Keywords: agents,llm,adk,mcp,a2a,sessions,tools
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
+ Classifier: Typing :: Typed
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Provides-Extra: mongo
24
+ Requires-Dist: pymongo>=4.6; extra == "mongo"
25
+ Provides-Extra: mysql
26
+ Requires-Dist: PyMySQL>=1.1; extra == "mysql"
27
+ Provides-Extra: postgres
28
+ Requires-Dist: psycopg[binary]>=3.1; extra == "postgres"
29
+ Provides-Extra: server
30
+ Requires-Dist: fastapi>=0.110; extra == "server"
31
+ Requires-Dist: uvicorn[standard]>=0.27; extra == "server"
32
+ Requires-Dist: pydantic>=2; extra == "server"
33
+ Provides-Extra: anthropic
34
+ Requires-Dist: anthropic>=0.40; extra == "anthropic"
35
+ Provides-Extra: openai
36
+ Requires-Dist: openai>=1.40; extra == "openai"
37
+ Provides-Extra: gemini
38
+ Requires-Dist: google-genai>=0.3; extra == "gemini"
39
+ Provides-Extra: all
40
+ Requires-Dist: samcoadk[mongo,mysql,server]; extra == "all"
41
+ Provides-Extra: test
42
+ Requires-Dist: samcoadk[all]; extra == "test"
43
+ Requires-Dist: pytest>=8; extra == "test"
44
+ Provides-Extra: dev
45
+ Requires-Dist: samcoadk[test]; extra == "dev"
46
+ Requires-Dist: build>=1.0; extra == "dev"
47
+ Requires-Dist: twine>=5.0; extra == "dev"
48
+ Dynamic: license-file
49
+
50
+ # samcoadk
51
+
52
+ A small Agent Development Kit. Four ideas, and nothing underneath them.
53
+
54
+ | | |
55
+ |---|---|
56
+ | **Agent** | one turn: build the prompt, call the model, run the tools it asks for, return the reply |
57
+ | **Runner** | one turn *for a user in a session*: load the history, call the agent, commit the result |
58
+ | **SessionService** | where conversations live — in memory, or in Mongo or MySQL |
59
+ | **A2A** | one agent calling another, in-process or over HTTP |
60
+
61
+ The core is stdlib only. `import samcoadk` pulls no third-party module, and there
62
+ is a test that says so.
63
+
64
+ ## Quickstart
65
+
66
+ ```python
67
+ from samcoadk import Agent, Runner
68
+
69
+ def order_status(order_id: str) -> str:
70
+ """Look up the status of a customer order."""
71
+ return f"Order {order_id} shipped on Tuesday."
72
+
73
+ agent = Agent(
74
+ name="support",
75
+ model="gateway/openai/gpt-4.1", # or "echo" to run with no API key
76
+ instruction="You are a support agent. Answer in one or two sentences.",
77
+ tools=[order_status],
78
+ )
79
+
80
+ runner = Runner(agent)
81
+ print(runner.run(user_id="u1", session_id="s1", message="where is order A9?"))
82
+ ```
83
+
84
+ Durable conversations are one line:
85
+
86
+ ```python
87
+ from samcoadk import DatabaseSessionService
88
+
89
+ runner = Runner(agent, session_service=DatabaseSessionService("mongodb://localhost:27017"))
90
+ runner = Runner(agent, session_service=DatabaseSessionService("mysql://user:pw@host/db"))
91
+ ```
92
+
93
+ Behind HTTP:
94
+
95
+ ```bash
96
+ pip install "samcoadk[server]"
97
+ samcoadk serve examples.support # /run, /run_sse, /sessions, /a2a, agent card
98
+ samcoadk chat examples.support # the same Runner, in your terminal
99
+ ```
100
+
101
+ ## Install
102
+
103
+ ```bash
104
+ pip install samcoadk # the agent, in memory
105
+ pip install "samcoadk[mongo]" # + Mongo sessions
106
+ pip install "samcoadk[mysql]" # + MySQL sessions
107
+ pip install "samcoadk[server]" # + the HTTP surface
108
+ pip install "samcoadk[all]"
109
+ ```
110
+
111
+ MCP needs nothing installed — `samcoadk.mcp` speaks stdio and streamable HTTP over
112
+ stdlib `urllib`.
113
+
114
+ ## The one rule
115
+
116
+ **An Agent holds no conversation.** Build one and share it across every request.
117
+ The transcript lives in a `Session`, and `Runner` is what binds the two — so two
118
+ callers cannot leak into each other's history, because there is no shared
119
+ history to leak through.
120
+
121
+ ```python
122
+ runner.run(user_id="alice", session_id="s", message="my card is 4111…")
123
+ runner.run(user_id="bob", session_id="s", message="what did I say?") # sees nothing of alice
124
+ ```
125
+
126
+ ## Sessions
127
+
128
+ A session holds **events** (what happened, in order) and **state** (what is true
129
+ now — a phase, a draft, a counter; whatever your agent needs).
130
+
131
+ They are written together, once per turn:
132
+
133
+ ```python
134
+ runner.run(user_id="u1", session_id="s1", message="...", state_delta={"phase": "PLAN"})
135
+ ```
136
+
137
+ One atomic checkpoint per turn means a crash cannot leave a transcript that says
138
+ a question was asked next to a state that says it was not.
139
+
140
+ ### Another database
141
+
142
+ Implement five methods — `ensure_schema`, `read`, `write`, `list`, `delete` —
143
+ and pass it in. All the session rules stay in `DatabaseSessionService`:
144
+
145
+ ```python
146
+ runner = Runner(agent, session_service=DatabaseSessionService(backend=MyRedisBackend()))
147
+ ```
148
+
149
+ ## Guardrails
150
+
151
+ samcoadk ships none, deliberately: what counts as an unacceptable request is your
152
+ agent's policy, not the kit's. The seam is `callbacks.py`.
153
+
154
+ ```python
155
+ from samcoadk import CallbackDecision
156
+
157
+ class NoSelfApproval:
158
+ def after_agent(self, ctx, reply):
159
+ if '"approved"' in reply:
160
+ return CallbackDecision.block("approval is the caller's to give",
161
+ replacement_result="Rejected: cannot self-approve.")
162
+
163
+ agent = Agent(name="planner", model=..., callbacks=[NoSelfApproval()])
164
+ ```
165
+
166
+ `before_agent` is the input rail, `after_agent` the output rail, and
167
+ `before_tool` / `after_tool` police individual tool calls. A hook may pass a
168
+ value through, replace it, or block. Callbacks fail **closed** by default — set
169
+ `fail_open = True` on one that is pure observability.
170
+
171
+ ## Agents calling agents
172
+
173
+ A remote agent and a local one satisfy the same interface — `.name` and
174
+ `.run(text) -> str`:
175
+
176
+ ```python
177
+ from samcoadk import RemoteAgent
178
+
179
+ billing = RemoteAgent.discover("http://billing:8000")
180
+ reply = billing.run("what is invoice 42?")
181
+ ```
182
+
183
+ Moving an agent out to its own service is invisible to its caller.
184
+
185
+ A handler that cannot continue raises `Clarify`, which the server reports as the
186
+ A2A `input-required` state rather than a failure — the difference between "this
187
+ agent is broken" and "this agent is waiting for you".
188
+
189
+ ### Two dialects, one method
190
+
191
+ `message/send` carries parts, and a part is either prose or a JSON object:
192
+
193
+ ```python
194
+ client.send("what is invoice 42?") # TextPart — a conversation
195
+ client.send(data={"op": "screen", "index": "NIFTY"}) # DataPart — a contract
196
+ ```
197
+
198
+ Text is what you want when the answer is for a person and the caller cannot know
199
+ the question in advance. **Data is what you want between two programs that have
200
+ agreed on fields:** it needs no model to interpret it, so a peer can answer
201
+ deterministically and prove it did.
202
+
203
+ ```python
204
+ from samcoadk.a2a import data_of, status_data, text_of
205
+
206
+ task = client.send(data={"op": "screen", "index": "NIFTY 50"})
207
+ result = data_of(task) # the completed task's artifact DataPart
208
+ ```
209
+
210
+ `data_of` is strict where `text_of` is forgiving, and deliberately: a thin text
211
+ reply is a thin answer, but a caller that cannot tell *"the screener is down"*
212
+ from *"the screen matched nothing"* will present an unresolved universe as a
213
+ resolved one. So every way it can be wrong raises, and the exception says which.
214
+ A paused task carries its payload on the status message instead — read it with
215
+ `status_data`.
216
+
217
+ On the server, a DataPart goes through its own door:
218
+
219
+ ```python
220
+ def handle(payload: dict) -> dict:
221
+ return {"matched": screen(payload["index"])}
222
+
223
+ app = create_app(runner, data_handler=handle)
224
+ ```
225
+
226
+ The model still answers text. It never sees the DataPart — feeding a wire
227
+ contract to a model asks it to re-derive what the payload already states, and
228
+ makes a deterministic call cost a token budget and a round of nondeterminism.
229
+ Without a `data_handler` configured, a DataPart is **refused** rather than
230
+ silently stringified into a prompt.
231
+
232
+ ## Tests
233
+
234
+ ```bash
235
+ pip install -e ".[test]"
236
+ pytest -q
237
+ ```
238
+
239
+ Database tests **skip silently** without a server, so a bare green run does not
240
+ mean they executed:
241
+
242
+ ```bash
243
+ SAMCOADK_TEST_MONGO=mongodb://localhost:27017 \
244
+ SAMCOADK_TEST_MYSQL='mysql://user:pw@localhost/samcoadk_test' pytest -q
245
+ ```
246
+
247
+ ## Coming from 0.2.0
248
+
249
+ | 0.2.0 | 0.3.0 |
250
+ |---|---|
251
+ | `agent.run(text, history=session.history)` | `runner.run(user_id=…, session_id=…, message=…)` |
252
+ | `Agent(...).history` | gone — the transcript is `Session.events` |
253
+ | `ConversationHistory` | `Session.events` + `session.as_messages()` |
254
+ | `samcoadk.sessions.InMemorySessionStore` | `InMemorySessionService` |
255
+ | `samcoadk.mongo.MongoSessionStore` | `DatabaseSessionService("mongodb://…")` |
256
+ | `samcoadk.Guardrails`, `keyword_blocklist`, … | your own callbacks (see above) |
257
+ | `samcoadk.runtime.*` (capabilities, contracts, boot) | gone — build the agent in Python |
258
+ | `boot.load(__file__, policy=…, models=…)` | `Agent(...)` and `Runner(...)` |
259
+ | `samcoadk.a2a.registry.AgentRegistry` | `RemoteAgent.discover(url)` |
260
+ | `samcoadk.console.create_app` | `samcoadk.server.create_app(runner)` |
261
+ | `Agent(model="openai/gpt-4.1")` + gateway env | `Agent(model="gateway/openai/gpt-4.1")` — explicit |
262
+ | `samcoadk.ops.*` (progress, prometheus, budget) | gone — `Metrics`/`Tracer` remain in `observability` |
263
+
264
+ The gateway is no longer selected by an environment variable being set. Say
265
+ `gateway/` and pass the URL, or the same model string means different things in
266
+ different shells.
@@ -0,0 +1,217 @@
1
+ # samcoadk
2
+
3
+ A small Agent Development Kit. Four ideas, and nothing underneath them.
4
+
5
+ | | |
6
+ |---|---|
7
+ | **Agent** | one turn: build the prompt, call the model, run the tools it asks for, return the reply |
8
+ | **Runner** | one turn *for a user in a session*: load the history, call the agent, commit the result |
9
+ | **SessionService** | where conversations live — in memory, or in Mongo or MySQL |
10
+ | **A2A** | one agent calling another, in-process or over HTTP |
11
+
12
+ The core is stdlib only. `import samcoadk` pulls no third-party module, and there
13
+ is a test that says so.
14
+
15
+ ## Quickstart
16
+
17
+ ```python
18
+ from samcoadk import Agent, Runner
19
+
20
+ def order_status(order_id: str) -> str:
21
+ """Look up the status of a customer order."""
22
+ return f"Order {order_id} shipped on Tuesday."
23
+
24
+ agent = Agent(
25
+ name="support",
26
+ model="gateway/openai/gpt-4.1", # or "echo" to run with no API key
27
+ instruction="You are a support agent. Answer in one or two sentences.",
28
+ tools=[order_status],
29
+ )
30
+
31
+ runner = Runner(agent)
32
+ print(runner.run(user_id="u1", session_id="s1", message="where is order A9?"))
33
+ ```
34
+
35
+ Durable conversations are one line:
36
+
37
+ ```python
38
+ from samcoadk import DatabaseSessionService
39
+
40
+ runner = Runner(agent, session_service=DatabaseSessionService("mongodb://localhost:27017"))
41
+ runner = Runner(agent, session_service=DatabaseSessionService("mysql://user:pw@host/db"))
42
+ ```
43
+
44
+ Behind HTTP:
45
+
46
+ ```bash
47
+ pip install "samcoadk[server]"
48
+ samcoadk serve examples.support # /run, /run_sse, /sessions, /a2a, agent card
49
+ samcoadk chat examples.support # the same Runner, in your terminal
50
+ ```
51
+
52
+ ## Install
53
+
54
+ ```bash
55
+ pip install samcoadk # the agent, in memory
56
+ pip install "samcoadk[mongo]" # + Mongo sessions
57
+ pip install "samcoadk[mysql]" # + MySQL sessions
58
+ pip install "samcoadk[server]" # + the HTTP surface
59
+ pip install "samcoadk[all]"
60
+ ```
61
+
62
+ MCP needs nothing installed — `samcoadk.mcp` speaks stdio and streamable HTTP over
63
+ stdlib `urllib`.
64
+
65
+ ## The one rule
66
+
67
+ **An Agent holds no conversation.** Build one and share it across every request.
68
+ The transcript lives in a `Session`, and `Runner` is what binds the two — so two
69
+ callers cannot leak into each other's history, because there is no shared
70
+ history to leak through.
71
+
72
+ ```python
73
+ runner.run(user_id="alice", session_id="s", message="my card is 4111…")
74
+ runner.run(user_id="bob", session_id="s", message="what did I say?") # sees nothing of alice
75
+ ```
76
+
77
+ ## Sessions
78
+
79
+ A session holds **events** (what happened, in order) and **state** (what is true
80
+ now — a phase, a draft, a counter; whatever your agent needs).
81
+
82
+ They are written together, once per turn:
83
+
84
+ ```python
85
+ runner.run(user_id="u1", session_id="s1", message="...", state_delta={"phase": "PLAN"})
86
+ ```
87
+
88
+ One atomic checkpoint per turn means a crash cannot leave a transcript that says
89
+ a question was asked next to a state that says it was not.
90
+
91
+ ### Another database
92
+
93
+ Implement five methods — `ensure_schema`, `read`, `write`, `list`, `delete` —
94
+ and pass it in. All the session rules stay in `DatabaseSessionService`:
95
+
96
+ ```python
97
+ runner = Runner(agent, session_service=DatabaseSessionService(backend=MyRedisBackend()))
98
+ ```
99
+
100
+ ## Guardrails
101
+
102
+ samcoadk ships none, deliberately: what counts as an unacceptable request is your
103
+ agent's policy, not the kit's. The seam is `callbacks.py`.
104
+
105
+ ```python
106
+ from samcoadk import CallbackDecision
107
+
108
+ class NoSelfApproval:
109
+ def after_agent(self, ctx, reply):
110
+ if '"approved"' in reply:
111
+ return CallbackDecision.block("approval is the caller's to give",
112
+ replacement_result="Rejected: cannot self-approve.")
113
+
114
+ agent = Agent(name="planner", model=..., callbacks=[NoSelfApproval()])
115
+ ```
116
+
117
+ `before_agent` is the input rail, `after_agent` the output rail, and
118
+ `before_tool` / `after_tool` police individual tool calls. A hook may pass a
119
+ value through, replace it, or block. Callbacks fail **closed** by default — set
120
+ `fail_open = True` on one that is pure observability.
121
+
122
+ ## Agents calling agents
123
+
124
+ A remote agent and a local one satisfy the same interface — `.name` and
125
+ `.run(text) -> str`:
126
+
127
+ ```python
128
+ from samcoadk import RemoteAgent
129
+
130
+ billing = RemoteAgent.discover("http://billing:8000")
131
+ reply = billing.run("what is invoice 42?")
132
+ ```
133
+
134
+ Moving an agent out to its own service is invisible to its caller.
135
+
136
+ A handler that cannot continue raises `Clarify`, which the server reports as the
137
+ A2A `input-required` state rather than a failure — the difference between "this
138
+ agent is broken" and "this agent is waiting for you".
139
+
140
+ ### Two dialects, one method
141
+
142
+ `message/send` carries parts, and a part is either prose or a JSON object:
143
+
144
+ ```python
145
+ client.send("what is invoice 42?") # TextPart — a conversation
146
+ client.send(data={"op": "screen", "index": "NIFTY"}) # DataPart — a contract
147
+ ```
148
+
149
+ Text is what you want when the answer is for a person and the caller cannot know
150
+ the question in advance. **Data is what you want between two programs that have
151
+ agreed on fields:** it needs no model to interpret it, so a peer can answer
152
+ deterministically and prove it did.
153
+
154
+ ```python
155
+ from samcoadk.a2a import data_of, status_data, text_of
156
+
157
+ task = client.send(data={"op": "screen", "index": "NIFTY 50"})
158
+ result = data_of(task) # the completed task's artifact DataPart
159
+ ```
160
+
161
+ `data_of` is strict where `text_of` is forgiving, and deliberately: a thin text
162
+ reply is a thin answer, but a caller that cannot tell *"the screener is down"*
163
+ from *"the screen matched nothing"* will present an unresolved universe as a
164
+ resolved one. So every way it can be wrong raises, and the exception says which.
165
+ A paused task carries its payload on the status message instead — read it with
166
+ `status_data`.
167
+
168
+ On the server, a DataPart goes through its own door:
169
+
170
+ ```python
171
+ def handle(payload: dict) -> dict:
172
+ return {"matched": screen(payload["index"])}
173
+
174
+ app = create_app(runner, data_handler=handle)
175
+ ```
176
+
177
+ The model still answers text. It never sees the DataPart — feeding a wire
178
+ contract to a model asks it to re-derive what the payload already states, and
179
+ makes a deterministic call cost a token budget and a round of nondeterminism.
180
+ Without a `data_handler` configured, a DataPart is **refused** rather than
181
+ silently stringified into a prompt.
182
+
183
+ ## Tests
184
+
185
+ ```bash
186
+ pip install -e ".[test]"
187
+ pytest -q
188
+ ```
189
+
190
+ Database tests **skip silently** without a server, so a bare green run does not
191
+ mean they executed:
192
+
193
+ ```bash
194
+ SAMCOADK_TEST_MONGO=mongodb://localhost:27017 \
195
+ SAMCOADK_TEST_MYSQL='mysql://user:pw@localhost/samcoadk_test' pytest -q
196
+ ```
197
+
198
+ ## Coming from 0.2.0
199
+
200
+ | 0.2.0 | 0.3.0 |
201
+ |---|---|
202
+ | `agent.run(text, history=session.history)` | `runner.run(user_id=…, session_id=…, message=…)` |
203
+ | `Agent(...).history` | gone — the transcript is `Session.events` |
204
+ | `ConversationHistory` | `Session.events` + `session.as_messages()` |
205
+ | `samcoadk.sessions.InMemorySessionStore` | `InMemorySessionService` |
206
+ | `samcoadk.mongo.MongoSessionStore` | `DatabaseSessionService("mongodb://…")` |
207
+ | `samcoadk.Guardrails`, `keyword_blocklist`, … | your own callbacks (see above) |
208
+ | `samcoadk.runtime.*` (capabilities, contracts, boot) | gone — build the agent in Python |
209
+ | `boot.load(__file__, policy=…, models=…)` | `Agent(...)` and `Runner(...)` |
210
+ | `samcoadk.a2a.registry.AgentRegistry` | `RemoteAgent.discover(url)` |
211
+ | `samcoadk.console.create_app` | `samcoadk.server.create_app(runner)` |
212
+ | `Agent(model="openai/gpt-4.1")` + gateway env | `Agent(model="gateway/openai/gpt-4.1")` — explicit |
213
+ | `samcoadk.ops.*` (progress, prometheus, budget) | gone — `Metrics`/`Tracer` remain in `observability` |
214
+
215
+ The gateway is no longer selected by an environment variable being set. Say
216
+ `gateway/` and pass the URL, or the same model string means different things in
217
+ different shells.
@@ -0,0 +1,70 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "samcoadk"
7
+ version = "0.4.0"
8
+ description = "A small Agent Development Kit — Agent, Runner, SessionService, tools, callbacks and A2A."
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ # The licence TEXT ships too, not just the SPDX id. A wheel that declares MIT
12
+ # and carries no licence file leaves a consumer no terms to rely on.
13
+ license-files = ["LICENSE"]
14
+ requires-python = ">=3.10"
15
+ authors = [
16
+ { name = "samcoadk contributors" },
17
+ ]
18
+ keywords = ["agents", "llm", "adk", "mcp", "a2a", "sessions", "tools"]
19
+ classifiers = [
20
+ "Development Status :: 4 - Beta",
21
+ "Intended Audience :: Developers",
22
+ "Programming Language :: Python :: 3",
23
+ "Programming Language :: Python :: 3.10",
24
+ "Programming Language :: Python :: 3.11",
25
+ "Programming Language :: Python :: 3.12",
26
+ "Programming Language :: Python :: 3.13",
27
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
28
+ "Typing :: Typed",
29
+ ]
30
+ # The core is stdlib only, and that is a promise the test suite keeps:
31
+ # `import samcoadk` must not pull a single third-party module.
32
+ dependencies = []
33
+
34
+ # The sidebar links on the PyPI page. Without them the project page is a dead
35
+ # end — no source, no issue tracker.
36
+ [project.urls]
37
+ Homepage = "https://bitbucket.org/samco-team/samco-adk"
38
+ Repository = "https://bitbucket.org/samco-team/samco-adk"
39
+ Issues = "https://bitbucket.org/samco-team/samco-adk/issues"
40
+
41
+ [project.optional-dependencies]
42
+ # Durable sessions. Each backend is one class over the SessionBackend protocol,
43
+ # so a deployment installs only the driver it actually connects with.
44
+ mongo = ["pymongo>=4.6"]
45
+ mysql = ["PyMySQL>=1.1"]
46
+ postgres = ["psycopg[binary]>=3.1"]
47
+ # The HTTP surface: chat, streaming, sessions, agent card and the A2A endpoint.
48
+ server = ["fastapi>=0.110", "uvicorn[standard]>=0.27", "pydantic>=2"]
49
+ # NOTE: there is deliberately no `mcp` extra. samcoadk.mcp speaks both stdio and
50
+ # streamable HTTP over stdlib urllib, so it needs nothing installed — declaring
51
+ # an empty extra would only invite someone to add a dependency to it later.
52
+ # Provider SDKs are optional — the OpenAI-compatible path uses stdlib urllib.
53
+ anthropic = ["anthropic>=0.40"]
54
+ openai = ["openai>=1.40"]
55
+ gemini = ["google-genai>=0.3"]
56
+
57
+ all = ["samcoadk[mongo,mysql,server]"]
58
+ test = ["samcoadk[all]", "pytest>=8"]
59
+ dev = ["samcoadk[test]", "build>=1.0", "twine>=5.0"]
60
+
61
+ [project.scripts]
62
+ samcoadk = "samcoadk.cli:main"
63
+
64
+ # An explicit `packages = ["samcoadk"]` list cannot express subpackages: the wheel
65
+ # would build and install fine, then fail at import. `find` is the safe form.
66
+ [tool.setuptools.packages.find]
67
+ include = ["samcoadk*"]
68
+
69
+ [tool.pytest.ini_options]
70
+ testpaths = ["tests"]