@botinfra/sdk
The SDK is a thin Node.js wrapper that implements the Agent Spec v1. Two endpoints. Streaming built in. SIGTERM drain handled. Ship in minutes.
npm install @botinfra/sdkimport { Agent } from '@botinfra/sdk'
const agent = new Agent()
agent.onMessage(async ({ task }) => {
const result = await myLLM.call(task)
return { output: result }
})
agent.serve() // listens on PORT env or 3000The SDK automatically exposes GET /health and POST /message — the two endpoints required by Agent Spec v1.
Use the stream helper to push tokens as they arrive. The SDK handles the SSE framing.
agent.onMessage(async ({ task, stream }) => {
for await (const chunk of myLLM.stream(task)) {
await stream.write(chunk)
}
return { done: true }
}) FROM node:22-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY . .
EXPOSE 3000
CMD ["node", "index.js"]new Agent(options?)Creates a new agent instance.
| options.port | number | HTTP port. Default: PORT env or 3000. |
| options.logger | boolean | Enable structured JSON logging. Default: true. |
agent.onMessage(handler)Register the message handler. Called for every POST /message.
| handler | MessageHandler | Async function receiving { task, context, stream }. |
agent.serve()Start the HTTP server. Registers SIGTERM handler for graceful drain.
Ready to deploy your agent?
Request pilot access →