|
14 | 14 | BaseRequestOptions, |
15 | 15 | LongRequestOptions, |
16 | 16 | SDKAgentListParams, |
| 17 | + SDKAxonCreateParams, |
17 | 18 | SDKDevboxListParams, |
18 | 19 | SDKObjectListParams, |
19 | 20 | SDKScorerListParams, |
|
38 | 39 | from .._types import Timeout, NotGiven, not_given |
39 | 40 | from .._client import DEFAULT_MAX_RETRIES, AsyncRunloop |
40 | 41 | from ._helpers import detect_content_type |
| 42 | +from .async_axon import AsyncAxon |
41 | 43 | from .async_agent import AsyncAgent |
42 | 44 | from .async_devbox import AsyncDevbox |
43 | 45 | from .async_scorer import AsyncScorer |
@@ -521,6 +523,33 @@ async def upload_from_bytes( |
521 | 523 | return obj |
522 | 524 |
|
523 | 525 |
|
| 526 | +class AsyncAxonOps: |
| 527 | + """[Beta] Create and manage axons (async). Access via ``runloop.axon``. |
| 528 | +
|
| 529 | + Example: |
| 530 | + >>> runloop = AsyncRunloopSDK() |
| 531 | + >>> axon = await runloop.axon.create() |
| 532 | + >>> await axon.publish(event_type="test", origin="USER_EVENT", payload="{}", source="sdk") |
| 533 | + """ |
| 534 | + |
| 535 | + def __init__(self, client: AsyncRunloop) -> None: |
| 536 | + self._client = client |
| 537 | + |
| 538 | + async def create(self, **params: Unpack[SDKAxonCreateParams]) -> AsyncAxon: |
| 539 | + """[Beta] Create a new axon.""" |
| 540 | + response = await self._client.axons.create(**params) |
| 541 | + return AsyncAxon(self._client, response.id) |
| 542 | + |
| 543 | + def from_id(self, axon_id: str) -> AsyncAxon: |
| 544 | + """Get an AsyncAxon instance for an existing axon ID.""" |
| 545 | + return AsyncAxon(self._client, axon_id) |
| 546 | + |
| 547 | + async def list(self, **options: Unpack[BaseRequestOptions]) -> list[AsyncAxon]: |
| 548 | + """[Beta] List all active axons.""" |
| 549 | + result = await self._client.axons.list(**options) |
| 550 | + return [AsyncAxon(self._client, axon.id) for axon in result.axons] |
| 551 | + |
| 552 | + |
524 | 553 | class AsyncScorerOps: |
525 | 554 | """Create and manage custom scorers (async). Access via ``runloop.scorer``. |
526 | 555 |
|
@@ -1205,6 +1234,8 @@ class AsyncRunloopSDK: |
1205 | 1234 | :vartype api: AsyncRunloop |
1206 | 1235 | :ivar agent: High-level async interface for agent management. |
1207 | 1236 | :vartype agent: AsyncAgentOps |
| 1237 | + :ivar axon: [Beta] High-level async interface for axon management |
| 1238 | + :vartype axon: AsyncAxonOps |
1208 | 1239 | :ivar benchmark: High-level async interface for benchmark management |
1209 | 1240 | :vartype benchmark: AsyncBenchmarkOps |
1210 | 1241 | :ivar devbox: High-level async interface for devbox management |
@@ -1238,6 +1269,7 @@ class AsyncRunloopSDK: |
1238 | 1269 |
|
1239 | 1270 | api: AsyncRunloop |
1240 | 1271 | agent: AsyncAgentOps |
| 1272 | + axon: AsyncAxonOps |
1241 | 1273 | benchmark: AsyncBenchmarkOps |
1242 | 1274 | devbox: AsyncDevboxOps |
1243 | 1275 | blueprint: AsyncBlueprintOps |
@@ -1289,6 +1321,7 @@ def __init__( |
1289 | 1321 | ) |
1290 | 1322 |
|
1291 | 1323 | self.agent = AsyncAgentOps(self.api) |
| 1324 | + self.axon = AsyncAxonOps(self.api) |
1292 | 1325 | self.benchmark = AsyncBenchmarkOps(self.api) |
1293 | 1326 | self.devbox = AsyncDevboxOps(self.api) |
1294 | 1327 | self.blueprint = AsyncBlueprintOps(self.api) |
|
0 commit comments