@thesiolab/sdk
v0.1.0
Published
Runtime-agnostic SDK for Agent Gateway, Resource Resolver, and Settlement & Reputation workflows.
Readme
@thesiolab/sdk
The JavaScript SDK for discovering and using resources on the Thesio agent resource network.
Install
Node.js 20 or newer is required. During public testnet, use the explicit prerelease tag:
npm install @thesiolab/sdk@testnetRead-only discovery
No wallet is needed to read public network state or search the resource catalog.
const { ThesioIndexerApiClient } = require("@thesiolab/sdk");
const client = ThesioIndexerApiClient.fromEnv();
const network = await client.getNetworkConfiguration();
const results = await client.searchResources({ q: "weather" });
console.log(network.chainId, results);The default Public Gateway is built into the testnet release. For another deployment:
export INDEXER_API_URL=https://gateway.example.com
export THESIO_API_KEY=optional-revocable-api-keyAgent resource access
AgentNet composes resolution, authorization, provider invocation, proof, and settlement policy:
const { AgentNet, ThesioIndexerApiClient } = require("@thesiolab/sdk");
const agentnet = new AgentNet({
reader: ThesioIndexerApiClient.fromEnv()
}).enableAutoResourceAccess({
budgetPerSession: "2000000",
requireProof: true,
autoOpenEscrow: true,
autoSignPaymentTickets: true,
autoSettle: true
});
const result = await agentnet.invoke({
capability: "retrieve weather observations",
requesterPrincipalId: 501,
input: { city: "Singapore" }
});Set automatic payment options only after the application has a clear budget, selection, and user-approval policy.
Wallets and writes
Create or bind a dedicated Agent wallet without placing the key in application source:
const {
configureWallet,
loadWalletEnvironment,
ThesioProtocolClient
} = require("@thesiolab/sdk");
configureWallet({ action: "create" });
const env = loadWalletEnvironment(process.env);
const protocol = await ThesioProtocolClient.fromGateway(env);
console.log(await protocol.getWalletStatus());The managed wallet file defaults to ~/.thesio/wallet.env, with owner-only permissions. Never use a mainnet or high-value wallet during testnet.
Provider integration
The SDK includes provider publication and gateway runtimes for APIs, databases, MCP tools, sensors, robots, and other synchronous resources. Asynchronous Agent providers should use @thesiolab/provider-connector.
const {
ThesioProtocolClient,
publishApiResource,
startApiResourceGateway
} = require("@thesiolab/sdk");
const client = await ThesioProtocolClient.fromGateway(process.env);
const { manifest } = await publishApiResource({
client,
principalId: 42,
resourceAddress: "weather.example.thesio",
name: "Example Weather API",
gatewayEndpointURI: "https://provider.example.com/thesio/v1/invoke",
free: true,
tags: ["weather", "observations"]
});
await startApiResourceGateway({
manifest,
upstreamURI: "http://127.0.0.1:8000/weather",
gatewayEndpointURI: "https://provider.example.com/thesio/v1/invoke",
gatewayUrl: process.env.INDEXER_API_URL,
port: 8787
});Keep the raw upstream URL private. Publish only the Thesio provider gateway endpoint.
Public modules
@thesiolab/sdk— complete public entrypoint@thesiolab/sdk/indexer-api— Gateway reads and resource lifecycle calls@thesiolab/sdk/adapters/mcp— MCP action definitions and handlers@thesiolab/sdk/adapters/actions— protocol action layer@thesiolab/sdk/adapters/a2a-websocket— session-bound A2A transport@thesiolab/sdk/adapters/langchain,/crewai,/eliza— framework adapters@thesiolab/sdk/provider-connector— embedded provider connector runtime@thesiolab/sdk/agent-gateway— provider publication and gateway runtime
Safety
The testnet is experimental. Confirm chain ID, resource identity, price, token, session expiry, delivery criteria, and final settlement before every write. Do not expose private keys to untrusted tool callers. See the repository's Credentials & Security guide.
Licensed under MIT.
