userId) that you set once on the
client. Memory files are scoped to a namespace you choose, shared by the API key.
See Memory namespaces.
It is written in TypeScript and works from plain JavaScript too. It tracks the
same API as the Python SDK.
Quickstart
Task-by-task examples, most with a runnable script on GitHub.
Guides
Concepts behind capabilities, memory namespaces, and tool-round caps.
Use cases
Recipes that show what a capability changes.
Reference
Every resource, type, event, and error.
GitHub
Source, issues, and the full
examples/ directory.API reference
The HTTP endpoints the SDK calls, with a live playground.
Install
0.4.0 or later. Capabilities, cancel, export, and file uploads need 0.3.0 or
later.
The package is ESM only. From CommonJS, require('@cominty-ai/sdk') works on
Node 22.12 and later. On an older Node, use await import('@cominty-ai/sdk').
Authenticate
You need two credentials, both from platform.cominty.ai:1
Get your API key
Open the API keys page and create a key. A key created now starts with
sk-cmt-. Copy it when you create it: it is shown once. Use the string
as is. Do not add a second sk-cmt- prefix. A key created before the
prefix existed has no sk-cmt- and still works.2
Get your user id
Open your avatar → Profile. It looks like
user_31HPTBuBvX20xlQNAbvxjOxPbKB.3
Export both
new Cominty() picks them up automatically. No arguments
needed. On a runtime without process.env, such as an edge worker, pass
apiToken and userId explicitly.agentId from platform.cominty.ai/agents
(for example __cominty_agents::agent.chat). See
Built-in agents for what Chat, Hive, and Planner can do.
Your first call
Save this asfirst-call.mjs and run node first-call.mjs:
Core concepts
Client: one user per client
Client: one user per client
Cominty is bound to a single userId, validated when you build it. Chat
and thread requests send it. Memory requests do not. Resource methods never
take userId. The client holds no persistent connection, so closing it is
optional. client.close() aborts every request still in flight, and
await using client = new Cominty() calls it for you. See
Client for all settings.Resources: chat, threads, memory, and configuration
Resources: chat, threads, memory, and configuration
client.chat starts and continues conversations, streams progress,
cancels or exports a message, and uploads/downloads files.
client.threads lists, fetches, updates, and archives threads.
client.memory creates, lists, reads, updates, and deletes memory files in
a namespace you choose. See Memory namespaces and
Resources.Five more resources configure the organization (SDK 0.4.0):
client.mcp lists MCP integrations, client.agents manages custom agents
and their models, client.skills manages skills, client.sources turns
files into an indexed source, and client.documents resolves a cited
document. See Custom agents,
Skills, and Sources.The API key: an admin of its organization
The API key: an admin of its organization
An API key acts as an admin of its own organization. What it creates is
owned by the user who created the key. It never sees another member’s
private agents, skills, or drives, and a read by id throws
NotFoundError.
See What an API key can do.Runs: the assistant's in-progress reply
Runs: the assistant's in-progress reply
chat.start and chat.send return a run: the assistant’s reply as it
is being produced. Iterate it with for await for live progress events, or
just await run.text() for the final answer. A run’s stream is single-use.
See The run handle.Capabilities: what the agent can use
Capabilities: what the agent can use
Web search, document search, MCP connections, skills, media generation, and
memory are capabilities. They follow the agent’s setup by default. Change
them for a whole thread with
threadCapabilities (chat.start only), or for
one message with messageScope. Both are plain objects. See
Capabilities and the
reference.sourceIds, documentIds, disabledTools, and memoryNamespace still
work but are deprecated. Use messageScope and threadCapabilities.memory
instead.Configuration
Resolution order is explicit option → environment variable → default. The
SDK does not load
.env files. Export the variables, or run
node --env-file=.env app.mjs.
apiToken and COMINTY_API_KEY hold the key string exactly as the platform
gave it to you, sk-cmt-... included. A missing key or user id, or a malformed
user id, throws a plain Error when you build the client. A wrong or archived
key comes back as a 403 and throws PermissionError. For the detail text of
each case, see Authentication errors.