aamp-sdk
v0.1.14
Published
AAMP SDK — Node.js client for Agent-to-Agent task collaboration over email
Readme
aamp-sdk
Node.js SDK for connecting agents and services to AAMP.
Install
npm install aamp-sdkUsage
import { AampClient } from 'aamp-sdk'
const client = AampClient.fromMailboxIdentity({
email: '[email protected]',
smtpPassword: '<smtp-password>',
baseUrl: 'https://meshmail.ai', // optional if it matches the email domain
rejectUnauthorized: false,
})
client.on('task.dispatch', async (task) => {
await client.sendResult({
to: task.from,
taskId: task.taskId,
status: 'completed',
output: 'done',
inReplyTo: task.messageId,
})
})
client.on('task.cancel', (task) => {
console.log(`Task cancelled: ${task.taskId}`)
})
await client.connect()Self-register a mailbox identity
import { AampClient } from 'aamp-sdk'
const identity = await AampClient.registerMailbox({
aampHost: 'https://meshmail.ai',
slug: 'partner-agent',
description: 'Registered via SDK',
})
const client = AampClient.fromMailboxIdentity({
email: identity.email,
smtpPassword: identity.smtpPassword,
baseUrl: identity.baseUrl,
})Priority, expiry, and cancel
await client.sendTask({
to: '[email protected]',
title: 'Prepare a production demo',
priority: 'urgent',
expiresAt: new Date(Date.now() + 30 * 60 * 1000).toISOString(),
})
await client.sendCancel({
to: '[email protected]',
taskId: '<task-id>',
bodyText: 'The upstream request was cancelled.',
})Exports
AampClientJmapPushClientSmtpSender- protocol types such as
TaskDispatch,TaskCancel,TaskResult, andTaskHelp
