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 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.
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;}
Property | Type | Description | Required |
---|---|---|---|
name | string | Descriptive name for your agent | Yes |
voice | string | Voice identifier (e.g., 'sophia', 'alex') | Yes |
language | string | Language code (e.g., 'en-US', 'es-ES') | Yes |
prompt | string | Instructions for the agent's behavior | Yes |
model | string | LLM model to use (defaults to 'gpt-4') | No |
metadata | object | Custom metadata for your agent | No |
Pinecall offers a variety of natural-sounding voices to choose from. Each voice has distinct characteristics to match your brand persona.
Once created, you can manage your agents with the following methods:
// Get a list of all agentsconst agents = await pinecall.agents.list();
// Get a specific agent by IDconst agent = await pinecall.agents.get('agent_12345');
// Update an agentconst updatedAgent = await pinecall.agents.update('agent_12345', { prompt: 'Updated instructions for the agent...', voice: 'james' // Change the voice});
// Delete an agentawait pinecall.agents.delete('agent_12345');
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.
Now that you've learned how to create and manage AI agents, you can: