@aimform/compute
v0.3.1
Published
Aimform Compute — sandboxed tool execution, agentic actions, and workflow automation.
Maintainers
Readme
@aimform/compute
Sandboxed tool execution, agentic actions, and workflow automation.
Install
npm install @aimform/compute @aimform/coreUsage
import { Compute } from "@aimform/compute";
// D1
const compute = new Compute({ database: env.DB });
// Platform API
const aimform = createAimform({ apiKey: "af_xxx" });
const compute = new Compute({ client: aimform.client });Tools
const tools = await compute.tools.getAvailable("org_456", "prof_123");
await compute.tools.register({
name: "calculate_refund", description: "Refund eligibility check",
inputSchema: JSON.stringify({ type: "object", properties: { transactionId: { type: "string" } } }),
implementation: "sandboxed_code",
requiredScope: "financial:transactions:read",
riskTier: "auto", registeredBy: "ci", version: 1,
idempotent: true, timeoutMs: 5000, memoryMbLimit: 128, networkEgress: "none",
});
await compute.tools.execute("send_email", 3, { to: "[email protected]" }, { profileId: "p1", actorType: "human" });
await compute.tools.registerMCP("org_456", "https://mcp.xero.com/v1");Workflows
await compute.workflows.create({
orgId: "org_456", name: "Weekly Report",
trigger: { type: "schedule", config: { cron: "0 9 * * 1" } },
steps: [
{ toolId: "fetch_data", toolVersion: 2, input: { range: "last_week" } },
{ toolId: "send_email", toolVersion: 3, input: { to: "[email protected]" } },
],
defaultRetryPolicy: { maxAttempts: 3, backoff: "exponential", intervalMs: 1000 },
status: "active", authoredBy: "prof_123",
});
await compute.workflows.pause("wf_123");
await compute.workflows.resume("wf_123");
const runs = await compute.workflows.listRuns("wf_123", 10);
const run = await compute.workflows.getRun("run_456");