Getting Started
Welcome to AIGNE! This guide will get you from zero to a running AI Agent in just a few minutes. We'll walk through installing the AIGNE CLI, creating a new project, setting up your environment, and running your first interactive Agent.
Here's a quick look at the journey:
1. Install AIGNE CLI#
The AIGNE Command-Line Interface (CLI) is your primary tool for developing and managing AIGNE projects. It's distributed as an npm package, so you'll need Node.js installed. You can install it globally using your favorite package manager.
Using npm
npm install -g @aigne/cli
Using yarn
yarn global add @aigne/cli
Using pnpm
pnpm add -g @aigne/cli
Once installed, you can verify the installation by running aigne --version
.
2. Create Your First Project#
With the CLI installed, you can now create a new AIGNE project. The create
command scaffolds a new project with a default template, giving you a solid starting point.
aigne create my-first-agent
The CLI will guide you through an interactive process:
- Project name: It will use the name you provided (
my-first-agent
). If you runaigne create
in an existing directory, it will prompt for a name. - Select a template: You can choose the
default
template to get started.
After the command finishes, you'll have a new directory named my-first-agent
containing everything you need. For a detailed breakdown of the files in this template, see the Default Project Template documentation.
3. Configure Your Environment#
Your AIGNE project needs to connect to an AI model provider, which requires API keys. The default template is set up for OpenAI, but you can configure others.
First, navigate into your new project directory:
cd my-first-agent
Inside, you'll find a file named .env.local.example
. This file contains templates for environment variables.
- Create a local environment file by copying the example:
cp .env.local.example .env.local
- Edit the
.env.local
file and add your API key. For example, if you are using OpenAI:# .env.local
# Use different Models
# OpenAI
MODEL="openai:gpt-4o-mini"
OPENAI_API_KEY="YOUR_OPENAI_API_KEY" # <-- Add your key here
For more information on setting up different model providers or proxy settings, please refer to the Configuration guide.
4. Run the Agent#
Now you're ready to bring your Agent to life! The run
command starts an interactive chat loop in your terminal.
aigne run
You'll be greeted with a 💬
prompt. You can now start a conversation with your Agent. The default Agent is a helpful assistant that can also execute JavaScript code using its sandbox.js
tool.
Try asking it something like: "What is 100 * 55?"
To learn about all the options for running agents, including from remote URLs or specifying a different entry Agent, check out the aigne run
command reference.
5. Run Tests#
The default project template comes with a simple test for the sandbox.js
tool to ensure it works correctly. You can run all tests in your project with the aigne test
command.
aigne test
This helps maintain the quality and reliability of your custom tools and Agents. For more details, see the aigne test
command reference.
What's Next?#
Congratulations! You've successfully installed AIGNE CLI, created a project, and interacted with your first Agent.
From here, you can:
- Dive deeper into the Commands Reference to master the CLI.
- Explore the default project template you just created.
- Learn how to configure different AI models and other settings.