Start Command
The start
command launches an ElizaOS project or agent in production mode. It initializes the agent runtime, loads plugins, connects to services, and starts handling interactions.
Usage
npx @elizaos/cli start [options]
Options
Option | Description |
---|---|
-p, --port <port> | Port to listen on (default: 3000) |
-c, --configure | Reconfigure services and AI models (skips using saved configuration) |
--character <path> | Path or URL to character file to use instead of default |
--build | Build the project before starting |
Starting a Project
When you run the start
command, ElizaOS detects what's in your current directory:
- If a project is detected, it loads all agents and plugins defined in the project
- If a plugin is detected, it loads the default character with your plugin for testing
- If neither is detected, it loads the default ElizaOS character
ElizaOS will:
- Load and validate the configuration
- Initialize the database system
- Load required plugins
- Start any configured services
- Process knowledge files if present
- Start the HTTP API server
- Initialize agent runtimes
- Begin listening for messages and events
# Navigate to your project directory
cd my-agent-project
# Start the project
npx @elizaos/cli start
Environment Variables
The start
command will look for an .env
file in the project directory and load environment variables from it. You can also set environment variables directly:
# Set environment variables directly
OPENAI_API_KEY=your-api-key npx @elizaos/cli start
Project Detection
ElizaOS automatically detects projects in the current directory by looking for:
- A
package.json
with aneliza.type
field set toproject
- A main entry point that exports a project configuration with agents
- Other project indicators in the package metadata
Plugin Testing
If you're developing a plugin, you can test it by running the start
command in the plugin directory:
# In your plugin directory
cd my-plugin
npx @elizaos/cli start
This will load the default ElizaOS character with your plugin enabled for testing.
Building Before Starting
To build your project before starting it:
npx @elizaos/cli start --build
This will compile your TypeScript files and prepare the project for execution.
Examples
Basic startup
cd my-agent-project
npx @elizaos/cli start
Starting with configuration
npx @elizaos/cli start --configure
Starting with a custom port
npx @elizaos/cli start --port 8080
Starting with a custom character
npx @elizaos/cli start --character path/to/character.json