agent-runtime-kit 0.1.0__py3-none-any.whl
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.
- agent_runtime_kit/__init__.py +72 -0
- agent_runtime_kit/_errors.py +34 -0
- agent_runtime_kit/_runtime.py +139 -0
- agent_runtime_kit/_types.py +251 -0
- agent_runtime_kit/adapters/__init__.py +26 -0
- agent_runtime_kit/adapters/_common.py +123 -0
- agent_runtime_kit/adapters/antigravity.py +379 -0
- agent_runtime_kit/adapters/claude.py +302 -0
- agent_runtime_kit/adapters/codex.py +298 -0
- agent_runtime_kit/adapters/diagnostics.py +18 -0
- agent_runtime_kit/events.py +224 -0
- agent_runtime_kit/py.typed +1 -0
- agent_runtime_kit/registry.py +83 -0
- agent_runtime_kit/testing/__init__.py +15 -0
- agent_runtime_kit/testing/fakes.py +164 -0
- agent_runtime_kit-0.1.0.dist-info/METADATA +118 -0
- agent_runtime_kit-0.1.0.dist-info/RECORD +19 -0
- agent_runtime_kit-0.1.0.dist-info/WHEEL +4 -0
- agent_runtime_kit-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"""Fake SDK fixtures for runtime adapter contract tests."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from collections.abc import Mapping
|
|
6
|
+
from dataclasses import dataclass, field
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
from agent_runtime_kit._errors import AgentRuntimeUnavailableError, UnsupportedTaskInputError
|
|
10
|
+
from agent_runtime_kit._types import (
|
|
11
|
+
AgentCapabilities,
|
|
12
|
+
AgentResult,
|
|
13
|
+
AgentRuntimeKind,
|
|
14
|
+
AgentTask,
|
|
15
|
+
AvailabilityReason,
|
|
16
|
+
RuntimeAvailability,
|
|
17
|
+
ToolCallAudit,
|
|
18
|
+
)
|
|
19
|
+
from agent_runtime_kit.events import (
|
|
20
|
+
output_delta_event,
|
|
21
|
+
safe_emit,
|
|
22
|
+
task_completed_event,
|
|
23
|
+
task_failed_event,
|
|
24
|
+
task_started_event,
|
|
25
|
+
tool_completed_event,
|
|
26
|
+
tool_requested_event,
|
|
27
|
+
vendor_turn_event,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@dataclass(frozen=True)
|
|
32
|
+
class FakeSDKScenario:
|
|
33
|
+
"""Scripted fake SDK behavior used by adapter tests."""
|
|
34
|
+
|
|
35
|
+
output: str = "fake sdk output"
|
|
36
|
+
error: str | None = None
|
|
37
|
+
missing_dependency: bool = False
|
|
38
|
+
unsupported_fields: tuple[str, ...] = ()
|
|
39
|
+
timeout: bool = False
|
|
40
|
+
session_id: str | None = "fake-session"
|
|
41
|
+
structured_output: Any | None = None
|
|
42
|
+
tool_events: tuple[ToolCallAudit, ...] = ()
|
|
43
|
+
metadata: Mapping[str, Any] = field(default_factory=dict)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class FakeSDKHarness:
|
|
47
|
+
"""Credential-free fake SDK surface with scripted outcomes."""
|
|
48
|
+
|
|
49
|
+
def __init__(
|
|
50
|
+
self,
|
|
51
|
+
scenario: FakeSDKScenario | None = None,
|
|
52
|
+
*,
|
|
53
|
+
kind: AgentRuntimeKind = AgentRuntimeKind.FAKE,
|
|
54
|
+
) -> None:
|
|
55
|
+
self.scenario = scenario or FakeSDKScenario()
|
|
56
|
+
self.kind = kind
|
|
57
|
+
self.calls: list[AgentTask] = []
|
|
58
|
+
|
|
59
|
+
async def invoke(self, task: AgentTask) -> AgentResult:
|
|
60
|
+
"""Simulate one SDK invocation."""
|
|
61
|
+
|
|
62
|
+
self.calls.append(task)
|
|
63
|
+
scenario = self.scenario
|
|
64
|
+
if scenario.missing_dependency:
|
|
65
|
+
raise AgentRuntimeUnavailableError(self.kind, "fake SDK package is missing")
|
|
66
|
+
if scenario.timeout:
|
|
67
|
+
raise TimeoutError("fake SDK timeout")
|
|
68
|
+
if scenario.unsupported_fields:
|
|
69
|
+
field_name = scenario.unsupported_fields[0]
|
|
70
|
+
raise UnsupportedTaskInputError(self.kind, field_name, "scripted unsupported input")
|
|
71
|
+
if scenario.error is not None:
|
|
72
|
+
return AgentResult(
|
|
73
|
+
output="",
|
|
74
|
+
finish_reason="failed",
|
|
75
|
+
error=scenario.error,
|
|
76
|
+
session_id=scenario.session_id,
|
|
77
|
+
metadata=dict(scenario.metadata),
|
|
78
|
+
)
|
|
79
|
+
return AgentResult(
|
|
80
|
+
output=scenario.output,
|
|
81
|
+
parsed_output=scenario.structured_output,
|
|
82
|
+
tool_calls=scenario.tool_events,
|
|
83
|
+
session_id=scenario.session_id,
|
|
84
|
+
rounds=1,
|
|
85
|
+
metadata=dict(scenario.metadata),
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
class FakeSDKRuntime:
|
|
90
|
+
"""Runtime wrapper around ``FakeSDKHarness`` for contract tests."""
|
|
91
|
+
|
|
92
|
+
kind = AgentRuntimeKind.FAKE
|
|
93
|
+
capabilities = AgentCapabilities(
|
|
94
|
+
mcp_support=True,
|
|
95
|
+
working_directory=True,
|
|
96
|
+
session_resume=True,
|
|
97
|
+
structured_output=True,
|
|
98
|
+
streaming=True,
|
|
99
|
+
tool_audit=True,
|
|
100
|
+
cancellation=True,
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
def __init__(self, harness: FakeSDKHarness | None = None) -> None:
|
|
104
|
+
self.harness = harness or FakeSDKHarness()
|
|
105
|
+
|
|
106
|
+
def availability(self) -> RuntimeAvailability:
|
|
107
|
+
"""Return fake availability based on the scripted scenario."""
|
|
108
|
+
|
|
109
|
+
if self.harness.scenario.missing_dependency:
|
|
110
|
+
return RuntimeAvailability.unavailable(
|
|
111
|
+
self.kind,
|
|
112
|
+
reason=AvailabilityReason.MISSING_PACKAGE,
|
|
113
|
+
message="fake SDK package is missing",
|
|
114
|
+
package="fake-sdk",
|
|
115
|
+
)
|
|
116
|
+
return RuntimeAvailability.ok(self.kind, package="fake-sdk", version="0.0.0")
|
|
117
|
+
|
|
118
|
+
async def run(self, task: AgentTask) -> AgentResult:
|
|
119
|
+
"""Invoke the fake SDK and emit normalized events."""
|
|
120
|
+
|
|
121
|
+
await safe_emit(task, task_started_event(task, self.kind))
|
|
122
|
+
try:
|
|
123
|
+
result = await self.harness.invoke(task)
|
|
124
|
+
except Exception as exc:
|
|
125
|
+
await safe_emit(task, task_failed_event(task, self.kind, error=str(exc)))
|
|
126
|
+
raise
|
|
127
|
+
if result.error:
|
|
128
|
+
await safe_emit(task, task_failed_event(task, self.kind, error=result.error))
|
|
129
|
+
return result
|
|
130
|
+
await safe_emit(task, output_delta_event(task, self.kind, text=result.output))
|
|
131
|
+
for audit in result.tool_calls:
|
|
132
|
+
await safe_emit(
|
|
133
|
+
task,
|
|
134
|
+
tool_requested_event(
|
|
135
|
+
task,
|
|
136
|
+
self.kind,
|
|
137
|
+
tool_name=audit.tool_name,
|
|
138
|
+
arguments=audit.arguments,
|
|
139
|
+
),
|
|
140
|
+
)
|
|
141
|
+
await safe_emit(task, tool_completed_event(task, self.kind, audit))
|
|
142
|
+
await safe_emit(
|
|
143
|
+
task,
|
|
144
|
+
vendor_turn_event(task, self.kind, payload={"scenario": "fake"}, turn_index=1),
|
|
145
|
+
)
|
|
146
|
+
await safe_emit(task, task_completed_event(task, self.kind, result))
|
|
147
|
+
return result
|
|
148
|
+
|
|
149
|
+
async def cancel(self, task_id: str) -> None:
|
|
150
|
+
"""Fake cancellation is a no-op."""
|
|
151
|
+
|
|
152
|
+
del task_id
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
class RecordingEventSink:
|
|
156
|
+
"""In-memory event sink for tests."""
|
|
157
|
+
|
|
158
|
+
def __init__(self) -> None:
|
|
159
|
+
self.events: list[Mapping[str, Any]] = []
|
|
160
|
+
|
|
161
|
+
async def emit(self, event: Mapping[str, Any]) -> None:
|
|
162
|
+
"""Record one event."""
|
|
163
|
+
|
|
164
|
+
self.events.append(event)
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agent-runtime-kit
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: One typed runtime API for Claude, Codex, and Antigravity agent SDKs.
|
|
5
|
+
Project-URL: Homepage, https://github.com/ebarti/agent-runtime-kit
|
|
6
|
+
Project-URL: Repository, https://github.com/ebarti/agent-runtime-kit
|
|
7
|
+
Project-URL: Issues, https://github.com/ebarti/agent-runtime-kit/issues
|
|
8
|
+
Author: Eloi Barti
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: agents,antigravity,claude,codex,sdk
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Typing :: Typed
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Provides-Extra: all
|
|
23
|
+
Requires-Dist: claude-agent-sdk>=0.2.87; extra == 'all'
|
|
24
|
+
Requires-Dist: google-antigravity>=0.1.2; extra == 'all'
|
|
25
|
+
Requires-Dist: openai-codex>=0.1.0b2; extra == 'all'
|
|
26
|
+
Provides-Extra: antigravity
|
|
27
|
+
Requires-Dist: google-antigravity>=0.1.2; extra == 'antigravity'
|
|
28
|
+
Provides-Extra: claude
|
|
29
|
+
Requires-Dist: claude-agent-sdk>=0.2.87; extra == 'claude'
|
|
30
|
+
Provides-Extra: codex
|
|
31
|
+
Requires-Dist: openai-codex>=0.1.0b2; extra == 'codex'
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# agent-runtime-kit
|
|
35
|
+
|
|
36
|
+
`agent-runtime-kit` is a small Python runtime layer for agent SDKs. It gives
|
|
37
|
+
applications one typed async API for dispatching an agentic task through Claude
|
|
38
|
+
Agent SDK, OpenAI Codex SDK, or Google Antigravity SDK while keeping provider
|
|
39
|
+
capabilities visible.
|
|
40
|
+
|
|
41
|
+
The package is intentionally not a router, benchmark harness, queue, hosted
|
|
42
|
+
service, or full agent framework. It is the reusable layer underneath those
|
|
43
|
+
systems: task models, runtime capabilities, event sinks, availability
|
|
44
|
+
diagnostics, and adapters.
|
|
45
|
+
|
|
46
|
+
## Install
|
|
47
|
+
|
|
48
|
+
Core only:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pip install agent-runtime-kit
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Provider extras:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install "agent-runtime-kit[claude]"
|
|
58
|
+
pip install "agent-runtime-kit[codex]"
|
|
59
|
+
pip install "agent-runtime-kit[antigravity]"
|
|
60
|
+
pip install "agent-runtime-kit[all]"
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
import asyncio
|
|
65
|
+
|
|
66
|
+
from agent_runtime_kit import AgentTask, FakeAgentRuntime
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
async def main() -> None:
|
|
70
|
+
runtime = FakeAgentRuntime(output="done")
|
|
71
|
+
result = await runtime.run(AgentTask(goal="Summarize this repository"))
|
|
72
|
+
print(result.output)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
asyncio.run(main())
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
The core package has no Claude, Codex, or Antigravity dependency. Vendor SDKs
|
|
79
|
+
are added through optional extras.
|
|
80
|
+
|
|
81
|
+
## Real Providers
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
import asyncio
|
|
85
|
+
|
|
86
|
+
from agent_runtime_kit import AgentTask
|
|
87
|
+
from agent_runtime_kit.adapters import ClaudeAgentRuntime
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
async def main() -> None:
|
|
91
|
+
runtime = ClaudeAgentRuntime(default_model="claude-sonnet-4-6")
|
|
92
|
+
diagnostic = runtime.availability()
|
|
93
|
+
if not diagnostic.available:
|
|
94
|
+
raise RuntimeError(diagnostic.message)
|
|
95
|
+
result = await runtime.run(AgentTask(goal="Summarize this repository"))
|
|
96
|
+
print(result.output)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
asyncio.run(main())
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Runtime Fields
|
|
103
|
+
|
|
104
|
+
`AgentTask` supports goal, system prompt, working directory, permission profile,
|
|
105
|
+
MCP stdio servers, session/resume handles, output schema, budget, metadata, and
|
|
106
|
+
an async event sink.
|
|
107
|
+
|
|
108
|
+
`AgentResult` returns output, finish reason, parsed structured output, usage,
|
|
109
|
+
cost, session id, artifacts, tool-call audits, and provider metadata.
|
|
110
|
+
|
|
111
|
+
## Docs
|
|
112
|
+
|
|
113
|
+
- [Quickstart](docs/quickstart.md)
|
|
114
|
+
- [Provider diagnostics](docs/providers.md)
|
|
115
|
+
- [Capability matrix](docs/capability-matrix.md)
|
|
116
|
+
- [Live smoke tests](docs/live-smoke.md)
|
|
117
|
+
- [Mestre migration notes](docs/mestre-migration.md)
|
|
118
|
+
- [Publish checklist](docs/publish-checklist.md)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
agent_runtime_kit/__init__.py,sha256=S17yV13a9TAzBd6cLUZt-YkbTGdMXZD7qUxdR0jBreg,1694
|
|
2
|
+
agent_runtime_kit/_errors.py,sha256=cLGB_zY0Wg_mupF4kSZW3G2gGXcGFHie0G6dLJ5wLzA,1247
|
|
3
|
+
agent_runtime_kit/_runtime.py,sha256=cmNstQcVm1IuvV5DW747MRNh0enRiRyGeSdUS1YZBnU,4672
|
|
4
|
+
agent_runtime_kit/_types.py,sha256=bUGsaQkVaxIfEVw-1-PxoPQyaQ8KACcTRs0NfjPoF44,6880
|
|
5
|
+
agent_runtime_kit/events.py,sha256=Bn1s-l8kmkDeNuaBUj-ku8jGhIspqRnY73vzXnthPPo,6632
|
|
6
|
+
agent_runtime_kit/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
7
|
+
agent_runtime_kit/registry.py,sha256=97eXOqzeooFalZ0lJe_OmHo5k4zuhbdZT8n_SbTQnXs,2653
|
|
8
|
+
agent_runtime_kit/adapters/__init__.py,sha256=ZCp8S4qosJtpdP9VRdpWnQfXKhrOALS9TA7wtGAkx4Q,944
|
|
9
|
+
agent_runtime_kit/adapters/_common.py,sha256=StdnoQgdn9X1o5kbtO37lUpBqcPNp1YSWtnfiOMC7lg,3607
|
|
10
|
+
agent_runtime_kit/adapters/antigravity.py,sha256=U8GxjfwrAL5EInFW6JrgnvQPPZ6yAZL0xgdqkBgSZ9U,13279
|
|
11
|
+
agent_runtime_kit/adapters/claude.py,sha256=85zQL__Bw8Lrv4gGrmdfU9hDYHDMg7AKZCaXlDV5yvY,11421
|
|
12
|
+
agent_runtime_kit/adapters/codex.py,sha256=urjBwnHJy-OkJO6Qi-GdubkiyFhjgyLaWGdGOiH8ilw,10092
|
|
13
|
+
agent_runtime_kit/adapters/diagnostics.py,sha256=23efPAPiriJQxDLktvzOmfcTzkgYFrAbGUfkPvdgcq4,640
|
|
14
|
+
agent_runtime_kit/testing/__init__.py,sha256=xOBG9GW017qdFe6ZtpE38t5Ei_M5JZzhpEhlRchS7II,292
|
|
15
|
+
agent_runtime_kit/testing/fakes.py,sha256=PlaRNzpHLbhemVIYpWk8CNRin1yxosA4oc_5FHtdErc,5355
|
|
16
|
+
agent_runtime_kit-0.1.0.dist-info/METADATA,sha256=zcBRBmDaqdB3kjrBB5903QHqqIXfG2Kjk6HI-BslLp8,3686
|
|
17
|
+
agent_runtime_kit-0.1.0.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
|
|
18
|
+
agent_runtime_kit-0.1.0.dist-info/licenses/LICENSE,sha256=HjqifLdd1ShCS_acCnCVQCXLrklPAdTzqXoLbUj3W_E,1067
|
|
19
|
+
agent_runtime_kit-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Eloi Barti
|
|
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.
|