TypeScript / Node.js
@inceptiva/sdk supports Node.js 18+, ships as an ES module, and includes TypeScript declarations.
shell
npm install @inceptiva/sdkts
import { Inceptiva, collectStream } from "@inceptiva/sdk";
const client = new Inceptiva({ apiKey, agentId });
const agent = await client.getAgent();
const first = await client.responses.create({ message: "Analyze this opportunity" });
const followUp = await client.responses.create({
message: "What should we do next?",
conversationId: first.conversationId,
});SSE streaming
ts
const controller = new AbortController();
const events = client.responses.stream({
message: "Summarize the opportunity",
conversationId: followUp.conversationId,
signal: controller.signal,
});
for await (const event of events) {
if (event.type === "response.output_text.delta") process.stdout.write(event.delta);
}
const result = await collectStream(client.responses.stream({ message: "Summarize it" }));The iterator stops on response.completed or error; an initiated stream is never retried. Use conversations.getMessages() for history and conversations.delete() for permanent deletion. The SDK returns only public citations, never retrieval_sources.
See Errors.
Idempotency, external references, and pagination
ts
const result = await client.responses.create({
message: "Update the summary",
externalReference: "ticket-4821",
idempotencyKey: crypto.randomUUID(),
metadata: { customer_id: "123", source: "helpcenter" },
});
const history = await client.conversations.getMessages(result.conversationId, { page: 1, pageSize: 50 });
console.log(result.responseMetadata.idempotencyReplayed);
console.log(history.total, history.hasMore);
· SDKv0.4.0