Quickstart
Create an agent and send it your first message with the API or SDK. To use your AI assistant, follow the MCP quickstart.
Before you start: a Platica account. For the SDK, Node.js 20.3 or later.
Get an API key
In Platica, open Settings → API Keys and create a key. It is shown once: copy it and store it in an environment variable. Follow API keys if you need help. The key works only in the workspace where you created it; see Authentication.
export PLATIC_API_KEY="pl_key_xxxxxxxxxxxxx"export PLATIC_API_KEY="pl_key_xxxxxxxxxxxxx" npm install platic-sdkCreate an agent
Give the agent a name and instructions for its replies. It is created published and can answer right away. See Create an agent.
curl https://api.platic.ai/v1/agents \ -H "Authorization: Bearer $PLATIC_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "Sales", "instructions": "You are the sales assistant for Acme. Answer kindly and briefly." }'The response has the agent's
idindata.id. Save it:export AGENT_ID="paste-the-id-here"import { Platic } from "platic-sdk"; const platic = new Platic({ apiKey: process.env.PLATIC_API_KEY! }); const agent = await platic.agents.create({ name: "Sales", instructions: "You are the sales assistant for Acme. Answer kindly and briefly.", }); console.log(agent.id);Chat with it
Send a message to the agent. The agent's answer comes back in the same call. See Send a message to the agent.
curl https://api.platic.ai/v1/chat \ -H "Authorization: Bearer $PLATIC_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "agentId": "'$AGENT_ID'", "message": "Which plan fits a team of 25?", "client": { "id": "customer_123", "name": "Ana" } }'const turn = await platic.chat.send({ agentId: agent.id, message: "Which plan fits a team of 25?", client: { id: "customer_123", name: "Ana" }, }); for (const reply of turn.messages) console.log(reply.content);To continue the conversation, include the response's
conversationIdin your next message. If you omit it, a new conversation is created.
It worked if...
- Step 2 gives you the new agent's
id. The REST API response also includes"status": "success"; the SDK returns the agent directly. - Step 3 returns
messageswith at least oneassistantmessage, which is the agent's answer. If you receive401, checkPLATIC_API_KEY: the key is wrong or missing.
The conversation also appears in the Platica inbox, where your team can read it.
Each chat turn uses workspace credits. When you finish, you can delete the test agent.
Next steps
- Create your first agent: edit its instructions in a draft and publish.
- Add knowledge so it knows your business.
- Chat API: follow conversations and read history.
- Connect a channel so it answers your customers.
- Read the core concepts, and Responses before you write your integration.