Lyzr Agent API
- Introduction
- Components
- Environment
- Agents
- Inferences
- Tools
- Activity
- User And Session
- Python Client
Environment
Create environment
curl -X POST "https://agent.api.lyzr.app/v2/environment" \
-H "accept: application/json"\
-H "Content-Type: application/json" \
-H "x-api-key: your_Lyzr_API_Key_Here" \
-d '{
"name": "My Environment",
"features": [
{
"type": "TOOL_CALLING",
"priority": 0,
"config": {
"max_tries": 5
}
},
{
"type": "SHORT_TERM_MEMORY",
"priority": 0
}
],
"tools": [
"perplexity_search"
],
"llm_config": {
"provider": "openai",
"model": "gpt-4o-mini",
"config": {
"temperature": 0.5,
"top_p": 0.9
},
"env": {
"OPENAI_API_KEY": "your_openai_api_key_here"
}
}
}'
{
"env_id": "66e1820aa6xxxxxx"
}
Overview
Endpoint: POST /v2/environment
This endpoint allows you to create a new environment for your agent. An environment contains configurations, features, and tools that define the operational scope of the agent, including the use of external APIs and large language models (LLMs).
Parameters
The name of the environment.
List of tools integrated into the environment.
Configuration for the large language model
LLM service provider (e.g., OpenAI).
The specific LLM model (e.g., GPT-4).
Curl
curl -X POST "https://agent.api.lyzr.app/v2/environment" \
-H "accept: application/json"\
-H "Content-Type: application/json" \
-H "x-api-key: your_Lyzr_API_Key_Here" \
-d '{
"name": "My Environment",
"features": [
{
"type": "TOOL_CALLING",
"priority": 0,
"config": {
"max_tries": 5
}
},
{
"type": "SHORT_TERM_MEMORY",
"priority": 0
}
],
"tools": [
"perplexity_search"
],
"llm_config": {
"provider": "openai",
"model": "gpt-4o-mini",
"config": {
"temperature": 0.5,
"top_p": 0.9
},
"env": {
"OPENAI_API_KEY": "your_openai_api_key_here"
}
}
}'
Python
import requests
data = {
"name": "My Environment",
"features": [
{
"type": "TOOL_CALLING",
"priority": 0,
"config": {
"max_tries": 5
}
},
{
"type": "SHORT_TERM_MEMORY",
"priority": 0
}
],
"tools": [
"perplexity_search"
],
"llm_config": {
"provider": "openai",
"model": "gpt-4o-mini",
"config": {
"temperature": 0.5,
"top_p": 0.9
},
"env": {
"OPENAI_API_KEY": "your_openai_api_key_here"
}
}
}
url = "https://agent.api.lyzr.app/v2/environment"
headers = {
"Content-Type": "application/json",
"x-api-key": "your_Lyzr_API_Key_Here"
}
response = requests.post(url, headers=headers, json=data)
{
"env_id": "66e1820aa6xxxxxx"
}
Response Parameters
Identifier for the associated environment.
curl -X POST "https://agent.api.lyzr.app/v2/environment" \
-H "accept: application/json"\
-H "Content-Type: application/json" \
-H "x-api-key: your_Lyzr_API_Key_Here" \
-d '{
"name": "My Environment",
"features": [
{
"type": "TOOL_CALLING",
"priority": 0,
"config": {
"max_tries": 5
}
},
{
"type": "SHORT_TERM_MEMORY",
"priority": 0
}
],
"tools": [
"perplexity_search"
],
"llm_config": {
"provider": "openai",
"model": "gpt-4o-mini",
"config": {
"temperature": 0.5,
"top_p": 0.9
},
"env": {
"OPENAI_API_KEY": "your_openai_api_key_here"
}
}
}'
{
"env_id": "66e1820aa6xxxxxx"
}