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.

  1. 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"
    npm install platic-sdk
  2. Create 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.

    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);
  3. 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.

    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 conversationId in 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 messages with at least one assistant message, which is the agent's answer. If you receive 401, check PLATIC_API_KEY: the key is wrong or missing.

The conversation also appears in the Platica inbox, where your team can read it.

Next steps