Appearance
SDK Guide
Aionis provides official SDKs for TypeScript and Python.
What this page gives you
- The fastest path to a working SDK integration.
- The minimum error-handling and logging baseline for production.
- A clear mapping from SDK calls to the underlying API flow.
Packages
- TypeScript:
@aionis/sdk - Python:
aionis-sdk
Install
bash
npm i @aionis/sdk
pip install aionis-sdkTypical SDK sequence
- Initialize the client with
base_urland one auth mode. - Write memory after a meaningful execution step.
- Recall context before planning or tool selection.
- Pass
run_idanddecision_idthrough policy-loop calls. - Persist
request_idandcommit_urifrom responses.
TypeScript example
ts
import { AionisClient } from '@aionis/sdk'
const client = new AionisClient({
base_url: 'http://localhost:3001',
api_key: process.env.API_KEY,
timeout_ms: 10000
})
const writeOut = await client.write({
scope: 'default',
input_text: 'sdk write',
nodes: [{ type: 'event', text_summary: 'sdk write', memory_lane: 'shared' }]
})
const recallOut = await client.recallText({
scope: 'default',
query_text: 'sdk write',
limit: 5
})
console.log(writeOut.request_id, recallOut.request_id)Python example
python
from aionis_sdk import AionisClient
client = AionisClient(
base_url='http://localhost:3001',
api_key='your_api_key',
timeout_s=10.0,
)
write_out = client.write({
'scope': 'default',
'input_text': 'python sdk write',
'nodes': [{'type': 'event', 'text_summary': 'python sdk write', 'memory_lane': 'shared'}]
})
recall_out = client.recall_text({
'scope': 'default',
'query_text': 'python sdk write',
'limit': 5,
})
print(write_out.get('request_id'), recall_out.get('request_id'))Method coverage (high level)
- Memory and context APIs.
- Policy-loop APIs.
- Replay and sandbox APIs.
- Admin/control APIs (admin auth required).
SDK to API mapping
client.write(...)maps toPOST /v1/memory/writeclient.recallText(...)maps toPOST /v1/memory/recall_textclient.contextAssemble(...)maps toPOST /v1/memory/context/assembleclient.rulesEvaluate(...)maps toPOST /v1/memory/rules/evaluateclient.toolsSelect(...)maps toPOST /v1/memory/tools/select
Production baseline
- Reuse one client per service process instead of rebuilding the client for every request.
- Set explicit request timeouts.
- Retry network failures and
429responses with backoff. - Keep
tenant_idandscopeexplicit in every call. - Log
request_id,run_id,decision_id, andcommit_uriwhenever present.
Error handling baseline
- Treat
AionisApiErroras contract-level response failure. - Treat
AionisNetworkErroras retryable transport failure. - Log
request_idand server error code for each failed request.
Validation commands
bash
npm run -s sdk:smoke
npm run -s sdk:tools-feedback-smoke
npm run -s sdk:py:smokeWhen to use the SDK instead of raw HTTP
Use the SDK when you want request validation, shared retry policy, and less integration code. Use raw HTTP only when your platform cannot adopt the official client or you need direct contract testing.