Skip to main content

Installation

First, install the lyzr-agent-api package:
For more detailed installation instructions, refer to the installation guide on PyPI.

Initializing the Client

To start using the API, initialize the AgentAPI client with your Lyzr API key:
Tip: You can generate your API key from the Lyzr Agent API Studio.

Environment

Create an Environment

The environment is a fundamental building block of the Lyzr Agent API. It defines the modules, features, tools available, and other configurations for your agent.For more,click here.

Update an Environment

This function updates the configuration of an existing environment by passing in the environment ID (env_id) and a JSON body containing the new environment settings (json_body).

Get an Environment

This function retrieves a list of all available environments. It returns the details of each environment, allowing you to view their configurations and statuses.

Agent

Create an Agent

Once the environment is set up, create an agent within that environment. The agent uses the environment ID to operate and can be customized with a system prompt and a description:

Update an Agent

This function updates the configuration of an existing agent by providing the agent ID (agent_id) and a JSON body containing the new settings (json_body). It allows you to modify an agent’s behavior or properties dynamically.

Get an Agent

This function retrieves a list of all available agents. It returns the details and configurations of each agent, allowing you to review and manage them.

Delete an Agent

This function deletes an agent by specifying its agent_id.

Inference

Chat with the Agent

After creating the agent, you can initiate a chat session with it. Provide the user ID, agent ID, and a message to start the conversation:

Execute Task with Agent

Get Task Status and Response