Axon¶
Axon resource class for asynchronous operations.
- class runloop_api_client.sdk.async_axon.AsyncAxonSqlOps(client, axon_id)[source]¶
[Beta] Async SQL operations for an axon’s SQLite database.
Access via
axon.sql.Example
>>> axon = await runloop.axon.create() >>> await axon.sql.query(sql="CREATE TABLE tasks (id INTEGER PRIMARY KEY, name TEXT)") >>> result = await axon.sql.query(sql="SELECT * FROM tasks WHERE id = ?", params=[1])
- async query(**params)[source]¶
[Beta] Execute a single parameterized SQL statement against this axon’s SQLite database.
- Return type:
- class runloop_api_client.sdk.async_axon.AsyncAxon(client, axon_id)[source]¶
[Beta] Wrapper around asynchronous axon operations.
Axons are event communication channels that support publishing events, subscribing to event streams via server-sent events (SSE), and executing SQL queries against an embedded SQLite database. Obtain instances via
runloop.axon.create()orrunloop.axon.from_id().Example
>>> runloop = AsyncRunloopSDK() >>> axon = await runloop.axon.create() >>> await axon.publish(event_type="task_done", origin="AGENT_EVENT", payload="{}", source="my-agent") >>> async with await axon.subscribe_sse() as stream: ... async for event in stream: ... print(event.event_type, event.payload) >>> await axon.sql.query(sql="CREATE TABLE tasks (id INTEGER PRIMARY KEY, name TEXT)")
- async subscribe_sse(**options)[source]¶
[Beta] Subscribe to this axon’s event stream via SSE.
- Return type:
AsyncStream[AxonEventView]
Axon resource class for synchronous operations.
- class runloop_api_client.sdk.axon.AxonSqlOps(client, axon_id)[source]¶
[Beta] SQL operations for an axon’s SQLite database.
Access via
axon.sql.Example
>>> axon = runloop.axon.create() >>> axon.sql.query(sql="CREATE TABLE tasks (id INTEGER PRIMARY KEY, name TEXT)") >>> result = axon.sql.query(sql="SELECT * FROM tasks WHERE id = ?", params=[1])
- query(**params)[source]¶
[Beta] Execute a single parameterized SQL statement against this axon’s SQLite database.
- Return type:
- class runloop_api_client.sdk.axon.Axon(client, axon_id)[source]¶
[Beta] Wrapper around synchronous axon operations.
Axons are event communication channels that support publishing events, subscribing to event streams via server-sent events (SSE), and executing SQL queries against an embedded SQLite database. Obtain instances via
runloop.axon.create()orrunloop.axon.from_id().Example
>>> runloop = RunloopSDK() >>> axon = runloop.axon.create() >>> axon.publish(event_type="task_done", origin="AGENT_EVENT", payload="{}", source="my-agent") >>> with axon.subscribe_sse() as stream: ... for event in stream: ... print(event.event_type, event.payload) >>> axon.sql.query(sql="CREATE TABLE tasks (id INTEGER PRIMARY KEY, name TEXT)")
- subscribe_sse(**options)[source]¶
[Beta] Subscribe to this axon’s event stream via SSE.
- Return type:
Stream[AxonEventView]