Create your first agent
Create an agent with instructions for answering your customers. Save changes in a draft and publish them when they are ready.
Before you start
Use your assistant connected to Platica or an API key stored in PLATIC_API_KEY.
In the platform: Create an agent with the creator.
Create the agent
Set the agent's name and instructions. 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." }'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.", });Create an agent called Sales. It is the sales assistant for Acme: it answers kindly and briefly.
Tool:
create_agent.Save the agent's
idfor the following calls. In cURL, assign it toAGENT_ID.Tune its instructions
Edit the draft. The agent keeps using the published version while you prepare it. Update the draft.
curl -X PATCH https://api.platic.ai/v1/agents/$AGENT_ID/draft \ -H "Authorization: Bearer $PLATIC_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "instructions": "You are the sales assistant for Acme. Answer in under 80 words. If you do not know a price, say so: never make it up." }'await platic.agents.draft.update(agent.id, { instructions: "You are the sales assistant for Acme. Answer in under 80 words. If you do not know a price, say so: never make it up.", });Change the Sales instructions: answer in under 80 words and never make up prices.
Tool:
update_agent_draft.Publish
Publish the draft to use the new instructions from the next message. Publish.
curl -X POST https://api.platic.ai/v1/agents/$AGENT_ID/publication \ -H "Authorization: Bearer $PLATIC_API_KEY"await platic.agents.publish(agent.id);Publish the Sales changes.
Tool:
publish_agent_version.
Check it worked
Call Get the agent. The publication is ready when publication.versionId is set and hasUnpublishedChanges is false. Channels for receiving customer messages are connected separately.
Each save creates a version. See Versions and how to go back to restore an earlier one.
Next steps
- Connect an API so it can look up or act on your systems.
- Give it files so it knows your business.
- Test it before you publish.
- Talk to your agent from your application.
- Put it on a channel so it starts answering, or add a chat to your site.
- Install a template to start from a configured agent. Complete its pending items before using it.