
Security News
Ruby's Bundler 4.0.18 Extends Cooldown to bundle lock and bundle cache
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.
TypeScript SDK for the Treza Execution API - enables AI agents to submit tasks for execution in secure enclave environments
TypeScript/JavaScript SDK for the Treza Execution API. This SDK enables AI agents to submit tasks for execution in secure enclave environments, retrieve results, and verify execution integrity through cryptographic attestations.
npm install treza-sdk
import { TrezaClient } from 'treza-sdk';
// Initialize the client
const client = new TrezaClient({
apiKey: 'your-api-key-here'
});
// Submit a task
const response = await client.submitTask({
agent_id: 'my-agent-001',
task_code: 'console.log("Hello from enclave!");',
payload: { message: 'Hello World' }
});
console.log('Task submitted:', response.task_id);
// Get task result
const result = await client.getTaskStatus(response.task_id);
console.log('Task result:', result);
The TrezaClient accepts the following configuration options:
const client = new TrezaClient({
apiKey: 'your-api-key', // Required: Your Treza API key
baseUrl: 'https://api.treza.xyz', // Optional: API base URL (default shown)
timeout: 30000 // Optional: Request timeout in ms (default: 30000)
});
submitTask(request: TaskRequest): Promise<TaskResponse>Submit a task for execution in the enclave.
Parameters:
request.agent_id (string, required): Unique identifier for the submitting agentrequest.task_code (string, required): The code or logic to be executed inside the enclaverequest.payload (object, optional): Input parameters to pass to the enclave taskrequest.metadata (object, optional): Task metadata (e.g., labels, tags)Returns: Promise resolving to a TaskResponse with task ID and status.
getTaskStatus(taskId: string): Promise<TaskResult>Get the status or result of a submitted task.
Parameters:
taskId (string, required): The ID of the task to checkReturns: Promise resolving to a TaskResult with execution details.
waitForTaskCompletion(taskId: string, options?): Promise<TaskResult>Poll a task until it completes or fails.
Parameters:
taskId (string, required): The ID of the task to wait foroptions.pollInterval (number, optional): Polling interval in ms (default: 1000)options.maxWaitTime (number, optional): Maximum wait time in ms (default: 300000)Returns: Promise resolving to the completed TaskResult.
submitAndWait(request: TaskRequest, waitOptions?): Promise<TaskResult>Submit a task and wait for its completion in one call.
Parameters:
request: Same as submitTaskwaitOptions: Same as waitForTaskCompletionReturns: Promise resolving to the completed TaskResult.
import { TrezaClient } from 'treza-sdk';
const client = new TrezaClient({
apiKey: process.env.TREZA_API_KEY!
});
async function runTask() {
try {
const result = await client.submitAndWait({
agent_id: 'data-processor-v1',
task_code: `
// Your enclave code here
const data = payload.numbers;
const sum = data.reduce((a, b) => a + b, 0);
return { sum, count: data.length, average: sum / data.length };
`,
payload: {
numbers: [1, 2, 3, 4, 5]
},
metadata: {
label: 'data-processing',
version: '1.0'
}
});
console.log('Execution completed:', result.output);
if (result.attestation) {
console.log('Attestation received:', result.attestation);
}
} catch (error) {
console.error('Task failed:', error);
}
}
runTask();
async function manualPolling() {
// Submit task
const response = await client.submitTask({
agent_id: 'my-agent',
task_code: 'return { result: "computed value" };'
});
console.log(`Task ${response.task_id} submitted with status: ${response.status}`);
// Poll for completion
let result;
do {
await new Promise(resolve => setTimeout(resolve, 2000)); // Wait 2 seconds
result = await client.getTaskStatus(response.task_id);
console.log(`Task status: ${result.status}`);
} while (result.status === 'queued' || result.status === 'running');
if (result.status === 'completed') {
console.log('Task completed successfully:', result.output);
} else {
console.error('Task failed:', result.logs);
}
}
import { TrezaSdkError } from 'treza-sdk';
async function handleErrors() {
try {
const result = await client.submitTask({
agent_id: 'test-agent',
task_code: 'invalid code here'
});
} catch (error) {
if (error instanceof TrezaSdkError) {
console.error('Treza SDK Error:', {
message: error.message,
code: error.code,
statusCode: error.statusCode,
details: error.details
});
} else {
console.error('Unexpected error:', error);
}
}
}
The SDK exports TypeScript types for all API entities:
import {
TrezaConfig,
TaskRequest,
TaskResponse,
TaskResult,
TaskAttestation,
TaskStatus,
TrezaSdkError
} from 'treza-sdk';
npm run build
npm test
npm run lint
npm run lint:fix
MIT
For issues and questions, please visit the GitHub repository or contact support.
FAQs
TypeScript SDK for the Treza Execution API - enables AI agents to submit tasks for execution in secure enclave environments
We found that treza-sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.

Company News
Socket is now in the AWS Security Hub Extended plan. Adopt it through AWS, apply committed spend, and block malicious open source packages.