Build with the local Soterias SDK. Get started with Python and TypeScript.
SoteriasDocsBuild
Core components

Activate a reviewed tool

Activate a complete signed review, retain its new registry checkpoint, and inspect the exact reviewed argument/resource mapping. A descriptor is data, not permission to dispatch the tool.

When to use this

Use this on the administrator surface when a reviewed tool profile should become active for subsequent protected requests.

Install the matching API preview

These examples use the API 2 preview, not names promised by the public RC5 release. Existing RC5 entry points remain available. The Python wheel below is verified on Windows x64; it is not a cross-platform release.

shell
python -m pip install https://docs.soterias.io/downloads/api-preview/soterias_local-0.1.0rc5%2Bapi2-cp311-abi3-win_amd64.whl
shell
npm install https://docs.soterias.io/downloads/api-preview/soterias-core-0.1.0-rc.5-api.2.tgz
npm install --save-dev typescript@5.8.3 @types/node@24

Python imports soterias. TypeScript imports @soterias/core. Use Python 3.11+ for this wheel and Node 22.23.4+ for these examples. For a .mts file, compile with npx tsc example.mts --target ES2022 --module NodeNext --moduleResolution NodeNext --skipLibCheck, then run the emitted .mjs file.

Before you run

Set SOTERIAS_ROOT to your operator-provisioned host directory, SOTERIAS_CHECKPOINT to its independently retained checkpoint file, and SOTERIAS_UNLOCK to its custody unlock. For protected execution/review also set SOTERIAS_CUSTODY. These are explicit trusted inputs, not placeholder authority to generate inside an agent. Set SOTERIAS_OUTPUT to an existing, empty, operator-provisioned private output directory, independent of the host and signing custody. On Windows it must have the same owner/SYSTEM-only private ACL as other native artifacts; a generic temporary directory is insufficient. The SDK's Rust checks are retained.

The SDK never invents missing identities, policy, trust or custody. For protected features, obtaining those operator artifacts is a prerequisite, just as connecting to a database requires its configured credentials. The native test provisioning helper is contributor tooling, not the application API.

Application walkthrough

Choose Python or TypeScript. Create example.py or example.mts and append that language's chunks in order. Each language forms one complete program; indentation and open blocks carry across chunks.

Import the packages

Import the SDK and standard-library helpers. These are the real package exports used by the executable program.

import json
import os
from pathlib import Path
import tempfile
from soterias import security


def save_artifact(name, data):
    # The operator supplies an existing private parent; create files without replacement.
    descriptor = os.open(output / name, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o600)
    with os.fdopen(descriptor, "wb") as stream:
        stream.write(data)
        stream.flush()
        os.fsync(stream.fileno())

Open an operator-provisioned registry against its retained checkpoint

Only the trusted administrator holds this token, unlock and custody path.

# %% Open an operator-provisioned registry against its retained checkpoint
# Only the trusted administrator holds this token, unlock and custody path.
root = Path(os.environ["SOTERIAS_ROOT"])
read = lambda name: (root / name).read_bytes()
checkpoint = Path(os.environ["SOTERIAS_CHECKPOINT"]).read_bytes()
output = Path(os.environ["SOTERIAS_OUTPUT"])
with security.Registry.open(root / "registry", signing_store_path=root / "keys",
        configuration=read("configuration.json"), human_token=read("human.json"),
        checkpoint=checkpoint, passphrase=os.environ["SOTERIAS_UNLOCK"].encode()) as registry:

Activate the complete signed review

Rust checks the review signature and advances the persistent registry generation.

    # %% Activate the complete signed review
    # Rust checks the review signature and advances the persistent registry generation.
    next_checkpoint = registry.activate(read("review.json"))
    save_artifact("checkpoint.json", next_checkpoint)

Describe the reviewed argument and resource mapping

An activated description is data; it cannot authorize or execute an effect.

    # %% Describe the reviewed argument and resource mapping
    # An activated description is data; it cannot authorize or execute an effect.
    descriptor = json.loads(registry.describe(read("request.json")))
    assert descriptor["current_permission"] is False
    print(json.dumps({"status": "PASS", "current_permission": False,
                      "effect_category": descriptor["effect"]["category"],
                      "evidence_directory": str(output)}))

MCP composition

Administration and signing stay on the trusted operator surface shown above. After that setup, an agent uses the real execute_accounting tool below. This client submits an operation through the configured authority; it cannot issue warrants, activate reviews or sign approvals. Native timings and administration diagnostics are read through their SDK owners, rather than invented MCP endpoints.

Configure the host

The following complete host requires the operator's basic SQLite configuration.json, transport-policy.json, exact operation-approval.json and retained checkpoint. For a document or delegated host, use its matching native profile and artifacts; do not substitute the basic host configuration into another profile. Set SOTERIAS_CONNECTION to a new private file for the endpoint/credential, and SOTERIAS_NEXT_CHECKPOINT to a new independently retained file for the shutdown pin. Share only the scoped execution credential with the agent.

host.mjs

Create host.mjs and append these chunks in order. Together they form one complete program; indentation carries across chunks.

Step 1

Import the SDK and standard-library helpers. These are the real package exports used by the executable program.

JavaScript
import fs from 'node:fs';
import path from 'node:path';
import { security } from '@soterias/core';
import { listenAccountingHttp } from '@soterias/mcp-server/accounting-http';

Open the operator-selected native owner

Enrollment, tool review, warrants and exact operation approval happen beforehand.

JavaScript
// %% Open the operator-selected native owner
// Enrollment, tool review, warrants and exact operation approval happen beforehand.
const root = process.env.SOTERIAS_ROOT;
const read = name => fs.readFileSync(path.join(root, name));
const owner = security.Host.open({ root, custody: process.env.SOTERIAS_CUSTODY,
  configuration: read('configuration.json'),
  checkpoint: fs.readFileSync(process.env.SOTERIAS_CHECKPOINT),
  passphrase: Buffer.from(process.env.SOTERIAS_UNLOCK) });

Start a loopback host with authenticated native admission

The agent cannot replace the policy, custody or signed approval through a tool call.

JavaScript
// %% Start a loopback host with authenticated native admission
// The agent cannot replace the policy, custody or signed approval through a tool call.
let listener;
try {
  listener = await listenAccountingHttp(owner, {
    transportPolicy: read('transport-policy.json'),
    operationApproval: read('operation-approval.json'),
  });
  const token = owner.issueTransportCredential().toString('base64url');
  fs.writeFileSync(process.env.SOTERIAS_CONNECTION,
    JSON.stringify({url: listener.url, token}), {flag: 'wx', mode: 0o600});
} catch (error) { owner.close(); throw error; }

Retain the acknowledged checkpoint when shutting down

Keep this output independently of the writable host and signing custody.

JavaScript
// %% Retain the acknowledged checkpoint when shutting down
// Keep this output independently of the writable host and signing custody.
let stopping;
function stop() {
  stopping ??= (async () => {
    await listener.close();
    fs.writeFileSync(process.env.SOTERIAS_NEXT_CHECKPOINT, listener.checkpoint(),
      {flag: 'wx', mode: 0o600});
  })();
  return stopping;
}
for (const signal of ['SIGINT', 'SIGTERM']) process.once(signal, () => {
  void stop().catch(() => { process.stderr.write('host_shutdown_failed\n'); process.exitCode = 1; });
});
// A parent process can close this control stream for orderly local shutdown.
process.stdin.resume();
process.stdin.once('end', () => { void stop(); });

Call the protected tool

Save this complete HTTP client as mcp.mjs. It uses the operator-provided endpoint, scoped token and original request from the environment. Run it with node mcp.mjs; inspect its outcome and verify its signed receipts separately.

Install the matching adapter with npm install https://docs.soterias.io/downloads/api-preview/soterias-mcp-server-0.1.0-rc.5-api.2.tgz. Its SDK peer dependency shares the same native class identities as your installed preview.

mcp.mjs

Create mcp.mjs and append these chunks in order. Together they form one complete program; indentation carries across chunks.

Step 1

Import the SDK and standard-library helpers. These are the real package exports used by the executable program.

JavaScript
import fs from 'node:fs';
import { Client, StreamableHTTPClientTransport } from '@modelcontextprotocol/client';

Connect to an operator-configured protected MCP host

The token is scoped to execution. Reviewer keys never enter this client.

JavaScript
// %% Connect to an operator-configured protected MCP host
// The token is scoped to execution. Reviewer keys never enter this client.
const client = new Client({ name: 'invoice-assistant', version: '1.0.0' });
const transport = new StreamableHTTPClientTransport(new URL(process.env.SOTERIAS_MCP_URL),
  { requestInit: { headers: { Authorization: 'Bearer ' + process.env.SOTERIAS_MCP_TOKEN },
    redirect: 'error', credentials: 'omit' } });
try {
  await client.connect(transport);

Execute through the native host's real accounting tool

The host selects routes and approval evidence; the tool receives a request.

JavaScript
  // %% Execute through the native host's real accounting tool
  // The host selects routes and approval evidence; the tool receives a request.
  const requestJson = fs.readFileSync(process.env.SOTERIAS_REQUEST, 'utf8');
  const result = await client.callTool({ name: 'execute_accounting', arguments: { requestJson } });
  if (result.isError) throw new Error('Protected tool refused the request');
  const content = result.content.find(block => block.type === 'text');
  if (!content || content.type !== 'text') throw new Error('Expected an accounting outcome');
  const outcome = JSON.parse(content.text);

Inspect the outcome instead of treating transport success as business success

Verify original receipts separately with your own retained trust.

JavaScript
  // %% Inspect the outcome instead of treating transport success as business success
  // Verify original receipts separately with your own retained trust.
  console.log(JSON.stringify({ status: outcome.status, target_observed: outcome.targetObserved }));
} finally { await client.close(); }

Check the result

The application program prints a JSON result and preserves native refusals. For protected operations inspect status and target_observed: transport success does not imply a completed effect. The pure examples contain assertions for their exact expected values. Successful startup is not proof of production enrollment, a physical human review or current authority.

Put it into a workflow

Use the AML walkthrough for protected document reads, reviewed writes and signed outcome checks. Use multi-agent workflows for personal and enterprise orchestration. Keep each agent's proposals separate from operator authority.

Search guides, examples and API reference.