Installation and Configuration

1

Install the CLI

Install the xpander CLI globally:

npm install -g xpander-cli
2

Configure your credentials

Set up your API key and organization:

xpander configure

Creating Your First Agent

1

Create a new agent

Create your agent using the CLI:

xpander agent new
2

Configure environment variables

Create a .env file in the root directory with the following credentials:

.env file
XPANDER_API_KEY=your_xpander_api_key  # From the xpander login output
OPENAI_API_KEY=your_openai_api_key
OPENAI_MODEL_ID=gpt-4o

Working with Your Agent

With your agent created, you can now work with it in several ways:

  1. Using the SDK in your code: Implement the agent loop and integrate with your application
  2. Stream events from the cloud: Set up a handler to receive events from xpander.ai
  3. Deploy to the cloud: Host your agent in the xpander.ai cloud

For detailed code examples and step-by-step implementation instructions, see our dedicated Instrument & Run AI Agents guide.