AI Agents

AI Agents are the core of the Pinecall platform. They represent virtual entities that can engage in voice conversations with users, powered by sophisticated language models and text-to-speech technology.

Creating an Agent

Creating an AI agent is straightforward with our SDK. You need to define basic properties like name, voice, language, and the initial prompt that shapes the agent's behavior.

create-agent.js
import { Pinecall } from '@pinecall/sdk';
const pinecall = new Pinecall({
apiKey: process.env.PINECALL_API_KEY
});
async function createCustomerSupportAgent() {
const agent = await pinecall.agents.create({
name: 'Customer Support Agent',
voice: 'sophia', // Choose from available voices
language: 'en-US', // Language code
prompt: `You are a helpful customer support agent for Acme Inc.
Be friendly, professional, and solve customer problems efficiently.
You specialize in helping with product returns, order status,
and general product questions. Always be empathetic and
try to resolve issues in the first call.`
});
console.log(`Agent created with ID: ${agent.id}`);
return agent;
}

Agent Properties

PropertyTypeDescriptionRequired
namestringDescriptive name for your agentYes
voicestringVoice identifier (e.g., 'sophia', 'alex')Yes
languagestringLanguage code (e.g., 'en-US', 'es-ES')Yes
promptstringInstructions for the agent's behaviorYes
modelstringLLM model to use (defaults to 'gpt-4')No
metadataobjectCustom metadata for your agentNo

Available Voices

Pinecall offers a variety of natural-sounding voices to choose from. Each voice has distinct characteristics to match your brand persona.

English Voices

  • sophiaProfessional female
  • alexProfessional male
  • emmaFriendly female
  • jamesFriendly male

Other Languages

  • mariaSpanish (es-ES)
  • jeanFrench (fr-FR)
  • annaGerman (de-DE)
  • yukiJapanese (ja-JP)

Managing Agents

Once created, you can manage your agents with the following methods:

manage-agents.js
// Get a list of all agents
const agents = await pinecall.agents.list();
// Get a specific agent by ID
const agent = await pinecall.agents.get('agent_12345');
// Update an agent
const updatedAgent = await pinecall.agents.update('agent_12345', {
prompt: 'Updated instructions for the agent...',
voice: 'james' // Change the voice
});
// Delete an agent
await pinecall.agents.delete('agent_12345');

Pro Tip

When crafting your agent's prompt, be specific about its personality, tone, expertise, and how it should handle different scenarios. The more detailed the prompt, the more consistent and effective the agent will be.

Next Steps

Now that you've learned how to create and manage AI agents, you can: