Endpoint: POST /v2/agent
This endpoint is used to create a new agent within the system. This request requires configuration details for the agent and returns a unique ID for the newly created agent.
Parameters
The ID of the environment in which the agent will operate. This links the agent to a specific environment configuration.
The initial system prompt or instruction that sets the behavior or context for the agent. This prompt guides the agent’s responses and interactions.
A description of the agent’s purpose or functionality. This provides additional context and details about the agent’s role and capabilities.
curl -X POST "https://agent.api.lyzr.app/v2/agent" \
-H "accept: application/json"\
-H "Content-Type: application/json" \
-H "x-api-key: your_Lyzr_API_Key_Here" \
-d '{
"env_id": "60d0fe4f531xxxxxx", # Replace with the actual environment ID
"system_prompt": "Hello, I am your virtual assistant.",
"name": "Virtual Assistant",
"agent_description": "An assistant for handling general queries and tasks."
}'
import requests
agent_config = {
"env_id": "60d0fe4f531xxxxxx", # Replace with the actual environment ID
"system_prompt": "Hello, I am your virtual assistant.",
"name": "Virtual Assistant",
"agent_description": "An assistant for handling general queries and tasks."
}
url = "https://agent.api.lyzr.app/v2/agent"
headers = {
"Content-Type": "application/json",
"x-api-key": "your_Lyzr_API_Key_Here"
}
response = requests.post(url, headers=headers, json=agent_config)
{
"agent_id": "60d0fe4f531xxxxxx"
}
Response Parameters
Unique identifier of the created agent.