- Xpander CLI
# Install the CLI
npm install -g xpander-cli
# Configure with your API key
xpander configure
# Create a new agent (interactive mode)
xpander agent new
# Test your agent with a message
xpander agent invoke "Hello, what can you do?"
# Explore available interfaces
xpander interfaces
# Connect operations to your agent
xpander agent tools --id YOUR_AGENT_ID
You can install the Xpander CLI via npm:
npm install -g xpander-cli
Or using Yarn:
yarn global add xpander-cli
After installation, you can use the xpander
command from anywhere.
Before using the CLI, you need to configure it with your API credentials:
xpander configure
You'll be prompted to enter your Xpander API key and organization ID. You can find these in your account settings on the Xpander platform.
Alternatively, you can provide these directly:
xpander configure --key YOUR_API_KEY --org YOUR_ORG_ID
The CLI supports multiple profiles for different API credentials:
# Create a new profile
xpander configure --profile dev
# List available profiles
xpander profile --list
# Switch between profiles
xpander profile --switch prod
# Set a default profile
xpander profile --set-default prod
xpander --help
The CLI provides a full suite of agent management capabilities.
The easiest way to manage agents is through the interactive mode:
xpander agent
# or
xpander agent interactive
This provides a guided menu-based interface for all agent operations.
xpander agent list
Example output
╭──────────────────────────────────────────────────────────────╮
│ │
│ __ __ _ __ __ _ _ __ __| | ___ _ __ __ _ _ │
│ \ \/ /| '_ \ / _` || '_ \ / _` | / _ \| '__|/ _` || | │
│ > < | |_) || (_| || | | || (_| || __/| | _| (_| || | │
│ /_/\_\| .__/ \__,_||_| |_| \__,_| \___||_|(_)\__,_||_| │
│ | | │
│ │
│ Build Better AI Agents faster │
│ v0.0.0 Profile: personal │
│ │
╰──────────────────────────────────────────────────────────────╯
✅ Found 3 agents:
┌─────────┬────────────────────────┬────────────────────────────────┬────────────┐
│ Name │ ID │ Description │ Type │
├─────────┼────────────────────────┼────────────────────────────────┼────────────┤
│ TestBot │ 647a8d4c52e83a07d9e3b5 │ A test agent for documentation │ chat │
│ DocBot │ 647a8d4c52e83a07d9e3b7 │ Documentation assistant │ structured │
│ AnalyzeX│ 647a8d4c52e83a07d9e3c1 │ Data analysis helper │ chat │
└─────────┴────────────────────────┴────────────────────────────────┴────────────┘
xpander agent get --id AGENT_ID
Example output
╭──────────────────────────────────────────────────────────────╮
│ │
│ __ __ _ __ __ _ _ __ __| | ___ _ __ __ _ _ │
│ \ \/ /| '_ \ / _` || '_ \ / _` | / _ \| '__|/ _` || | │
│ > < | |_) || (_| || | | || (_| || __/| | _| (_| || | │
│ /_/\_\| .__/ \__,_||_| |_| \__,_| \___||_|(_)\__,_||_| │
│ | | │
│ │
│ Build Better AI Agents faster │
│ v0.0.0 Profile: personal │
│ │
╰──────────────────────────────────────────────────────────────╯
📋 Agent Details:
Name: TestBot
ID: 647a8d4c52e83a07d9e3b5
Type: chat
Model: gpt-4
Description: A test agent for documentation
📊 Statistics:
- Created: 2023-07-15
- Last Updated: 2023-08-20
- Message Count: 156
- Connected Operations: 3
xpander agent new
You'll be guided through the process of creating a new agent interactively.
For non-interactive creation:
xpander agent new --name "My Agent" --description "Agent description" --type "chat" --model "gpt-4"
xpander agent update --id AGENT_ID
You can update various properties of an existing agent.
xpander agent delete --id AGENT_ID
Manage the agent's decision graph:
xpander agent graph --id AGENT_ID
This provides tools for visualizing and modifying the agent's decision flow.
Connect agentic operations to your agents:
xpander agent tools --id AGENT_ID
Example output
╭──────────────────────────────────────────────────────────────╮
│ │
│ __ __ _ __ __ _ _ __ __| | ___ _ __ __ _ _ │
│ \ \/ /| '_ \ / _` || '_ \ / _` | / _ \| '__|/ _` || | │
│ > < | |_) || (_| || | | || (_| || __/| | _| (_| || | │
│ /_/\_\| .__/ \__,_||_| |_| \__,_| \___||_|(_)\__,_||_| │
│ | | │
│ │
│ Build Better AI Agents faster │
│ v0.0.0 Profile: personal │
│ │
╰──────────────────────────────────────────────────────────────╯
🔧 Xpander Agent Tools Manager
════════════════════════════════════════════════════════════
Configuring Tools for Agent: TestBot (647a8d4c52e83a07d9e3b5)
════════════════════════════════════════════════════════════
? What would you like to do? ›
❯ Connect interface operations to this agent
View connected operations
Remove operations from this agent
Back to main menu
Exit
Xpander CLI provides tools for working with agentic interfaces.
The enhanced interface explorer helps you discover and interact with available interfaces:
xpander interfaces
Example output
╭──────────────────────────────────────────────────────────────╮
│ │
│ __ __ _ __ __ _ _ __ __| | ___ _ __ __ _ _ │
│ \ \/ /| '_ \ / _` || '_ \ / _` | / _ \| '__|/ _` || | │
│ > < | |_) || (_| || | | || (_| || __/| | _| (_| || | │
│ /_/\_\| .__/ \__,_||_| |_| \__,_| \___||_|(_)\__,_||_| │
│ | | │
│ │
│ Build Better AI Agents faster │
│ v0.0.0 Profile: personal │
│ │
╰──────────────────────────────────────────────────────────────╯
🚀 Xpander Tools Explorer
════════════════════════════════════════════════════════════
Discover, Connect, and Manage your AI Agent Operations
════════════════════════════════════════════════════════════
✔ Interfaces loaded successfully
? Select an interface: ›
❯ Reddit (7b925b25...)
arXiv (1ec81aa7...)
Movie Database (49c3130c...)
Weather (c6d57ee2...)
Perplexity (33bd2a1a...)
Crunchbase (825b3405...)
x.com (475019c2...)
xpanderAI Tools (794f532f...)
List all available interfaces:
xpander interfaces list
Example output
╭──────────────────────────────────────────────────────────────╮
│ │
│ __ __ _ __ __ _ _ __ __| | ___ _ __ __ _ _ │
│ \ \/ /| '_ \ / _` || '_ \ / _` | / _ \| '__|/ _` || | │
│ > < | |_) || (_| || | | || (_| || __/| | _| (_| || | │
│ /_/\_\| .__/ \__,_||_| |_| \__,_| \___||_|(_)\__,_||_| │
│ | | │
│ │
│ Build Better AI Agents faster │
│ v0.0.0 Profile: personal │
│ │
╰──────────────────────────────────────────────────────────────╯
Available Interfaces:
Reddit (7b925b25-9a0f-41df-a7ab-2a09bef334a7)
Access Reddit posts, comments, and search capabilities
arXiv (1ec81aa7-3aee-460d-a5a6-492dd05242ad)
Search and retrieve scientific papers from arXiv repository
Movie Database (49c3130c-23c8-490f-9511-9b136880061e)
Query information about movies, actors, and TV shows
Weather (c6d57ee2-a749-46d1-820a-2b9d7745ae14)
Get current weather and forecasts for locations worldwide
List operations for a specific interface:
xpander interfaces operations --interface INTERFACE_ID
Example output
╭──────────────────────────────────────────────────────────────╮
│ │
│ __ __ _ __ __ _ _ __ __| | ___ _ __ __ _ _ │
│ \ \/ /| '_ \ / _` || '_ \ / _` | / _ \| '__|/ _` || | │
│ > < | |_) || (_| || | | || (_| || __/| | _| (_| || | │
│ /_/\_\| .__/ \__,_||_| |_| \__,_| \___||_|(_)\__,_||_| │
│ | | │
│ │
│ Build Better AI Agents faster │
│ v0.0.0 Profile: personal │
│ │
╰──────────────────────────────────────────────────────────────╯
Found 7 operation(s):
1. Get Comments by Post ID
Summary: Retrieve comments for a specific Reddit post. Workflow: SearchPostsByQuery to get post_id -> GetCommentsByPostId for detailed comments. Returns comment depth, score, and nested post/author details.
Endpoint: GET /post_comments
ID: 6730dafddbeac5e67e4cbd77
2. Search Comments by Query
Summary: Search Reddit comments by keyword or phrase. Workflow: SearchCommentsByQuery to find relevant comments -> GetCommentsByPostId for full context.
Endpoint: GET /search_comments
ID: 6730dafddbeac5e67e4cbd78
[Additional operations...]
Work directly with agentic operations:
xpander operations
This launches an interactive mode for browsing and working with operations.
To list operations for a specific interface:
xpander operations INTERFACE_ID
The CLI allows you to export various schemas and configurations:
# Export operation schemas (through the interfaces explorer)
xpander interfaces
When using the interfaces explorer, you can select operations and save their schemas to JSON files for reference or integration with your applications.
By default, the CLI outputs data in table format. You can switch to JSON format:
xpander --output json agent list
Login to the Xpander platform:
xpander login
Check your login status:
xpander login --status
To build the CLI from source:
# Clone the repository
git clone https://github.com/xpander-ai/xpander-cli.git
cd xpander-cli
# Install dependencies
yarn install
# Build
yarn build
# Run locally
yarn cli
For local development and testing:
# Make code changes
# Then build and run locally
npm run build
node ./lib/index.js [command]
This project uses projen for project configuration and build management. The main configuration is in .projenrc.ts
:
# Edit the project configuration
nano .projenrc.ts
# Compile the configuration
tsc .projenrc.ts
# Apply changes to the project
npx projen
Key directories:
src/
: Source codesrc/commands/
: CLI command implementationssrc/utils/
: Utility functions and API clientsrc/types/
: TypeScript type definitions
lib/
: Compiled JavaScript outputtest/
: Test files
If you encounter module import errors related to CommonJS modules (like chalk, ora, etc.), make sure you have the proper TypeScript configuration:
// In .projenrc.ts
tsconfig: {
compilerOptions: {
esModuleInterop: true,
},
},
Unused imports or variables can cause TypeScript compilation errors. You can either:
- Comment out unused imports and variables
- Configure TypeScript to ignore these warnings:
// In .projenrc.ts
tsconfigDev: {
compilerOptions: {
noUnusedLocals: false,
noUnusedParameters: false,
},
},
Ensure the package.json includes the proper bin
entry for the CLI:
// In .projenrc.ts
bin: {
xpander: 'lib/index.js',
},
Apache-2.0