https://retellai.com/?utm_source=discord&utm_medium=seo logo
what is the JSON schema for importing agents
# 💬・general
r
@AI Evy what is the JSON schema for importing agents?
a
Thanks for tagging me @renovia_70920. I'll look through relevant sources and get back to you shortly.
### Answer I don't have the specific JSON schema for importing agents in the available sources. The documentation I have access to shows the Create Agent API structure [(1) ]() , but doesn't include the specific import schema. From the Discord discussions, there have been issues with agent imports where users received 400 errors due to JSON configuration problems [(2) ]() [(3) ]() . One specific issue mentioned was that in custom functions,
headers
,
query_params
, and
response
variables should be objects
{}
rather than empty arrays
[]
[(2) ]() . For detailed guidance on agent creation structure, you can refer to the [Create Agent]() documentation [(1) ]() . If you need the exact import schema, I'd recommend checking the official documentation or contacting support for the most current schema requirements.
​ To learn more, see the sources I considered: [[1] Create Agent](https://docs.retellai.com/api-references/create-agent) [[2] Import Agent](https://discord.com/channels/1186424376300679209/1396620050303156224) [[3] Discord message from @helloamitkg on 2025-05-21](https://discord.com/channels/1186424376300679209/1294891368505937952/1374587254160232448) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
a
@AI Evy what is the api to create chat agent in retell
a
Thanks for the follow-up, @aparna_10250. I'll get back to you soon.
### Answer To create a chat agent in Retell AI, you'll use the Create Agent API endpoint [(1) ]() . Here's the JavaScript code example:
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
 apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const agentResponse = await client.agent.create({
 response_engine: { llm_id: 'llm_234sdertfsdsfsdf', type: 'retell-llm' },
 voice_id: '11labs-Adrian',
}) ;
console.log(agentResponse.agent_id) ;
The API endpoint is
POST /create-agent
. The required parameters are: -
response_engine
- The Response Engine to attach to the agent, which needs to be created first [(2) ]() -
voice_id
- Unique voice id used for the agent The response_engine requires: -
type
- set to "retell-llm" -
llm_id
- id of the Retell LLM Response Engine Once you have created the agent, you can then create chat sessions using the Create Chat API [(3) ]() :
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
 apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const chatResponse = await client.chat.create({ agent_id: 'oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD' }) ;
console.log(chatResponse.agent_id) ;
For a complete step-by-step guide on implementing chat functionality, refer to the Create Chat Completion documentation [(4) ]() .
​ To learn more, see the sources I considered: [[1] Create Agent](https://docs.retellai.com/api-references/create-agent) [[2] Create Agent](https://docs.retellai.com/api-references/create-agent) [[3] Create Chat](https://docs.retellai.com/api-references/create-chat) [[4] Create Chat Completion](https://docs.retellai.com/deploy/create-chat-completion) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
a
this creates a voice agent @AI Evy
a
Thanks for the follow-up, @aparna_10250. I'll get back to you soon.
### Answer You're correct. The Create Agent API creates agents that can be used for both voice and text interactions [(1) ]() . The code example shown:
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
 apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const agentResponse = await client.agent.create({
 response_engine: { llm_id: 'llm_234sdertfsdsfsdf', type: 'retell-llm' },
 voice_id: '11labs-Adrian',
}) ;
console.log(agentResponse.agent_id) ;
Creates a voice agent because it includes the
voice_id
parameter . The same agent can then be used for chat interactions through the Create Chat API, but the agent itself is configured with voice capabilities from the start . The Create Agent API is the unified endpoint for creating agents that can handle both voice calls and text-based chat interactions .
​ To learn more, see the sources I considered: [[1] Create Agent](https://docs.retellai.com/api-references/create-agent) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
a
@AI Evy i am not able to create chat using this agent, i am getting error in the api
a
Thanks for the follow-up, @aparna_10250. I'll get back to you soon.
### Answer To create a chat using the agent you've created, you need to use the Create Chat API with the correct format [(1) ]() . The JavaScript code should look like this:
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
 apiKey: 'YOUR_RETELL_API_KEY',
}) ;

const chatResponse = await client.chat.create({ agent_id: 'oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD' }) ;
console.log(chatResponse.agent_id) ;
The required parameter for creating a chat is
agent_id
, which should be the ID returned when you created your agent . Common issues that could cause API errors include: 1. **Invalid agent_id**: Make sure you're using the correct agent ID returned from the Create Agent API [(2) ]() 2. **Agent not published**: The agent might need to be published before it can be used for chats [(3) ]() 3. **Incorrect API key**: Ensure your API key is valid and has the proper permissions [(1) ]() If you're still getting errors, could you share the specific error message you're receiving? This would help identify the exact issue with your chat creation request.
​ To learn more, see the sources I considered: [[1] Create Chat](https://docs.retellai.com/api-references/create-chat) [[2] Create Agent](https://docs.retellai.com/api-references/create-agent) [[3] 404 when creating agent with /create-agent](https://discord.com/channels/1186424376300679209/1392679614882517042) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
a
Copy code
{
  "status": "error",
  "message": "Cannot start a chat session with selected agent."
}
@AI Evy
a
Thanks for the follow-up, @aparna_10250. I'll get back to you soon.
### Answer The error "Cannot start a chat session with selected agent" suggests there's an issue with the agent configuration that prevents it from being used for chat sessions [(1) ]() . Here are the most common causes and solutions: 1. Agent Version Issue When creating a chat, you can specify the agent version :
Copy code
javascript
const chatResponse = await client.chat.create({
  agent_id: 'oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD',
  agent_version: 1
}) ;
2. Agent Configuration Ensure your agent was created with the correct response engine configuration [(2) ]() . The agent needs a valid response engine attached . 3. Agent Status Check if the agent exists and is properly configured by retrieving it first [(3) ]() :
Copy code
javascript
const agentResponse = await client.agent.get('16b980523634a6dc504898cda492e939') ;
console.log(agentResponse.agent_id) ;
4. Dynamic Variables If your agent uses dynamic variables, make sure to include them in the chat creation request [(1) ]() :
Copy code
javascript
const chatResponse = await client.chat.create({
  agent_id: 'oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD',
  retell_llm_dynamic_variables: {
    "customer_name": "John Doe"
  }
}) ;
To troubleshoot further, I'd recommend: 1. Verify the agent ID is correct 2. Check that the agent's response engine is properly configured [(2) ]() 3. Ensure the agent version exists if you're specifying one [(1) ]()
​ To learn more, see the sources I considered: [[1] Create Chat](https://docs.retellai.com/api-references/create-chat) [[2] Create Agent](https://docs.retellai.com/api-references/create-agent) [[3] Get Agent](https://docs.retellai.com/api-references/get-agent) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
a
all these are yes
@AI Evy
a
Thanks for the follow-up, @aparna_10250. I'll get back to you soon.
Thanks for the feedback, glad I was helpful.
### Answer I don't have specific troubleshooting information for the "Cannot start a chat session with selected agent" error in the available sources. Based on the API documentation, here are a few additional things to verify: Check Agent Configuration Use the Get Agent API to examine your agent's configuration [(1) ]() :
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
 apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const agentResponse = await client.agent.retrieve('16b980523634a6dc504898cda492e939') ;
console.log(agentResponse.agent_id) ;
Verify Agent Versions Check what versions are available for your agent [(2) ]() :
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
 apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const agentResponses = await client.agent.getVersions('16b980523634a6dc504898cda492e939') ;
console.log(agentResponses) ;
Review Chat Status You can also check existing chat sessions using the List Chat API [(3) ]() . Since you've confirmed the agent ID is correct, the response engine is configured, and you've tried with dynamic variables, I'd recommend: 1. Visit [Contact Sales]() 2. Visit [) Would you like a general answer based on my knowledge instead?
​ To learn more, see the sources I considered: [[1] Get Agent](https://docs.retellai.com/api-references/get-agent) [[2] Get Agent Versions](https://docs.retellai.com/api-references/get-agent-versions) [[3] List Chat](https://docs.retellai.com/api-references/list-chat) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
a
i still am not able to create chat agent
@AI Evy
a
Thanks for the follow-up, @aparna_10250. I'll get back to you soon.
### Answer Looking at your issue with creating chat sessions, there are a few specific requirements for chat functionality that might be causing the problem. According to the documentation, Retell does not provide native integration with SMS or chat applications at this moment - you can only interact with the chat agent via API [(1) ]() . This might explain why you're encountering the "Cannot start a chat session with selected agent" error. To create a chat session properly, you need to follow this specific sequence: 1. Create a Chat Agent first - Before starting a chat session, you need a chat agent specifically designed to handle conversations . 2. Use the Create Chat API - The correct API endpoint structure is:
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
 apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const chatResponses = await client.chat.list() ;
console.log(chatResponses) ;
[(2) ]() 3. Create Chat Completion - To generate responses from the chat agent, use the create-chat-completion API endpoint [(1) ]() . The key issue might be that the agent you created is configured primarily for voice interactions (since it includes voice_id parameter) [(3) ]() , but chat functionality requires specific configuration that may not be compatible with all agent types. For the exact requirements and troubleshooting this specific error, I'd recommend: 1. Visit [Contact Sales]() 2. Visit [) Would you like a general answer based on my knowledge instead?
​ To learn more, see the sources I considered: [[1] Create Chat Completion](https://docs.retellai.com/deploy/create-chat-completion) [[2] List Chat](https://docs.retellai.com/api-references/list-chat) [[3] Create Agent](https://docs.retellai.com/api-references/create-agent) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
a
how do i create a chat agent. if i pass voice id voice agent gets created
@AI Evy
a
Thanks for the follow-up, @aparna_10250. I'll get back to you soon.
### Answer Looking at the Create Agent API documentation, the
voice_id
parameter is required when creating an agent [(1) ]() . The API structure shows:
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
 apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const agentResponse = await client.agent.create({
 response_engine: { llm_id: 'llm_234sdertfsdsfsdf', type: 'retell-llm' },
 voice_id: '11labs-Adrian',
}) ;
console.log(agentResponse.agent_id) ;
Based on the documentation, there isn't a separate "chat agent" creation endpoint - the Create Agent API creates agents that can handle both voice and text interactions . The
voice_id
parameter is marked as required in the API specification [(2) ]() . However, looking at the response structure, agents are created with an
is_published
field that defaults to
false
[(1) ]() . This might be related to your chat session issue. When an agent is not published, it may not be available for certain operations. The documentation doesn't show a way to create an agent without a
voice_id
parameter, as it's listed as required [(2) ]() . All agents in Retell AI appear to be created with voice capabilities, but can then be used for both voice calls and chat interactions. For the specific error you're encountering with chat sessions, I don't have detailed troubleshooting information in the available sources. I'd recommend: 1. Visit [Contact Sales]() 2. Visit [) Would you like a general answer based on my knowledge instead?
​ To learn more, see the sources I considered: [[1] Create Agent](https://docs.retellai.com/api-references/create-agent) [[2] Create Agent](https://docs.retellai.com/api-references/create-agent) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
r
@AI Evy It would be really helpful if there we can get the JSON schema for importing an agent
a
Thanks for the follow-up, @renovia_70920. I'll get back to you soon.
### Answer I don't have the specific JSON schema for importing agents in the available sources [(1) ]() . The documentation shows the Create Agent API structure [(2) ]() , but doesn't include the specific import schema. From Discord discussions, there have been common issues with agent imports where users received 400 errors due to JSON configuration problems [(3) ]() . The most frequent issue mentioned was that in custom functions,
headers
,
query_params
, and
response
variables should be objects
{}
rather than empty arrays
[]
. Another issue reported was with the "Wait" tool where parameters must be formatted as objects [(4) ]() . For detailed guidance on agent structure, you can refer to the [Create Agent]() documentation [(2) ]() , which shows the expected format for agent configuration. Since I don't have the exact import schema in the available sources, I'd recommend: 1. Visit [Contact Sales]() 2. Visit [) Would you like a general answer based on my knowledge instead?
​ To learn more, see the sources I considered: [[1] Discord message from @renovia_70920 on 2025-08-14](https://discord.com/channels/1186424376300679209/1186462578310910112/1405650264744136766) [[2] Create Agent](https://docs.retellai.com/api-references/create-agent) [[3] Import Agent](https://discord.com/channels/1186424376300679209/1396620050303156224) [[4] Import Option does not work for outbound agents](https://discord.com/channels/1186424376300679209/1385302044956426451) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.