Application tools over HTTPS

Keep backend tools available after a connected SDK caller exits. Your service owns execution; Aex records dispatch and durable completion.

Declare and serve a tool

npm install @aexhq/sdk@1.0.0
import { Application, createApplicationHandler } from "@aexhq/sdk";
const descriptor = { name: "lookup", description: "Look up an item", input_schema: { type: "object", properties: { id: { type: "string" } }, required: ["id"] }, output_schema: { type: "string" } };
const handler = createApplicationHandler({
  credential: process.env.APPLICATION_TOKEN,
  tools: [{ ...descriptor, run: ({ id }) => `Item ${id}` }],
});
// Serve handler(request) from your HTTPS route.
const tools = [Application({
  endpoint: "https://your-service.example/tools",
  credential: process.env.APPLICATION_TOKEN,
  tools: [descriptor],
})];
// Pass tools to aex.sessions.create(...).

Keep a distinct random credential of at least 32 characters on your backend. Endpoints require HTTPS on port 443. Private destinations, redirects and oversized requests or results are rejected.

Commit a result before exiting

Return JSON from a handler, report progress with await context.progress(value), or call await context.finish(value). A finish is acknowledged after durable storage, so its caller can then exit. Repeating an identical finish is safe; changing an acknowledged result fails.

Aex records dispatch before contacting your endpoint. Lost acknowledgements retain an explicit uncertain outcome and never cause automatic redispatch. Completion URLs are scoped capabilities for the configured gateway, without account keys. Session deletion invalidates them and removes cached private results after active work stops.

See the Application guide for boundaries and self-hosted gateway configuration.