AgentQL JavaScript SDK Installation
Prerequisites
Installation options
There are two ways to install AgentQL SDK:
- AgentQL CLI installation — Get set up fast by installing the AgentQL library and then using AgentQL CLI to download dependencies.
- Manual installation — For a more customized setup, manually install the AgentQL SDK.
Option 1: AgentQL CLI Installation
From your terminal, run the following command to install the AgentQL library:
1. Install AgentQL library and CLI
npm install agentql
npm install -g agentql-cli2. Install dependencies and set API key
The following AgentQL CLI command will install Playwright dependencies and an example script.
agentql init3. Set your AgentQL API Key
Set the AGENTQL_API_KEY environment variable with your API key.
To set the environment variable temporarily for your terminal session, in your terminal run
export AGENTQL_API_KEY=your-api-keyOption 2: Manual Installation
From your terminal, run the following command to install the AgentQL library:
1. Install AgentQL library
npm install agentql2. Install Playwright
The default version of AgentQL JavaScript SDK uses Playwright as a web driver, so Playwright dependencies need to be installed.
npx playwright install chromium3. Set your AgentQL API Key
Set the AGENTQL_API_KEY environment variable with your API key.
To set the environment variable temporarily for your terminal session, in your terminal run
export AGENTQL_API_KEY=your-api-keyRun Your First AgentQL Script
Now you are ready to run your first AgentQL script! Continue to First Steps to get started.