xpander-cli
v0.0.69
Published
Command Line Interface for Xpander
Readme
Xpander CLI
Table of Contents
- Xpander CLI
Quick Start
# 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_IDInstallation
You can install the Xpander CLI via npm:
npm install -g xpander-cliOr using Yarn:
yarn global add xpander-cliAfter installation, you can use the xpander command from anywhere.
Configuration
Before using the CLI, you need to configure it with your API credentials:
xpander configureYou'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_IDManaging Profiles
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 prodCommand Reference
View All Available Commands
xpander --helpAgent Management
The CLI provides a full suite of agent management capabilities.
Interactive Mode
The easiest way to manage agents is through the interactive mode:
xpander agent
# or
xpander agent interactiveThis provides a guided menu-based interface for all agent operations.
List Your Agents
xpander agent list╭──────────────────────────────────────────────────────────────╮
│ │
│ __ __ _ __ __ _ _ __ __| | ___ _ __ __ _ _ │
│ \ \/ /| '_ \ / _` || '_ \ / _` | / _ \| '__|/ _` || | │
│ > < | |_) || (_| || | | || (_| || __/| | _| (_| || | │
│ /_/\_\| .__/ \__,_||_| |_| \__,_| \___||_|(_)\__,_||_| │
│ | | │
│ │
│ 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 │
└─────────┴────────────────────────┴────────────────────────────────┴────────────┘Get Agent Details
xpander agent get --id AGENT_ID╭──────────────────────────────────────────────────────────────╮
│ │
│ __ __ _ __ __ _ _ __ __| | ___ _ __ __ _ _ │
│ \ \/ /| '_ \ / _` || '_ \ / _` | / _ \| '__|/ _` || | │
│ > < | |_) || (_| || | | || (_| || __/| | _| (_| || | │
│ /_/\_\| .__/ \__,_||_| |_| \__,_| \___||_|(_)\__,_||_| │
│ | | │
│ │
│ 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: 3Create a New Agent
xpander agent newYou'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"Update an Agent
xpander agent update --id AGENT_IDYou can update various properties of an existing agent.
Delete an Agent
xpander agent delete --id AGENT_IDAgent Graph Management
Manage the agent's decision graph:
xpander agent graph --id AGENT_IDThis provides tools for visualizing and modifying the agent's decision flow.
Agent Tools and Operations
Connect agentic operations to your agents:
xpander agent tools --id AGENT_ID╭──────────────────────────────────────────────────────────────╮
│ │
│ __ __ _ __ __ _ _ __ __| | ___ _ __ __ _ _ │
│ \ \/ /| '_ \ / _` || '_ \ / _` | / _ \| '__|/ _` || | │
│ > < | |_) || (_| || | | || (_| || __/| | _| (_| || | │
│ /_/\_\| .__/ \__,_||_| |_| \__,_| \___||_|(_)\__,_||_| │
│ | | │
│ │
│ 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
ExitInterface Operations
Xpander CLI provides tools for working with agentic interfaces.
Interface Explorer
The enhanced interface explorer helps you discover and interact with available interfaces:
xpander interfaces╭──────────────────────────────────────────────────────────────╮
│ │
│ __ __ _ __ __ _ _ __ __| | ___ _ __ __ _ _ │
│ \ \/ /| '_ \ / _` || '_ \ / _` | / _ \| '__|/ _` || | │
│ > < | |_) || (_| || | | || (_| || __/| | _| (_| || | │
│ /_/\_\| .__/ \__,_||_| |_| \__,_| \___||_|(_)\__,_||_| │
│ | | │
│ │
│ 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 Interfaces
List all available interfaces:
xpander interfaces list╭──────────────────────────────────────────────────────────────╮
│ │
│ __ __ _ __ __ _ _ __ __| | ___ _ __ __ _ _ │
│ \ \/ /| '_ \ / _` || '_ \ / _` | / _ \| '__|/ _` || | │
│ > < | |_) || (_| || | | || (_| || __/| | _| (_| || | │
│ /_/\_\| .__/ \__,_||_| |_| \__,_| \___||_|(_)\__,_||_| │
│ | | │
│ │
│ 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 worldwideView Interface Operations
List operations for a specific interface:
xpander interfaces operations --interface INTERFACE_ID╭──────────────────────────────────────────────────────────────╮
│ │
│ __ __ _ __ __ _ _ __ __| | ___ _ __ __ _ _ │
│ \ \/ /| '_ \ / _` || '_ \ / _` | / _ \| '__|/ _` || | │
│ > < | |_) || (_| || | | || (_| || __/| | _| (_| || | │
│ /_/\_\| .__/ \__,_||_| |_| \__,_| \___||_|(_)\__,_||_| │
│ | | │
│ │
│ 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...]Operation Management
Work directly with agentic operations:
xpander operationsThis launches an interactive mode for browsing and working with operations.
To list operations for a specific interface:
xpander operations INTERFACE_IDFile Export Capabilities
The CLI allows you to export various schemas and configurations:
# Export operation schemas (through the interfaces explorer)
xpander interfacesWhen using the interfaces explorer, you can select operations and save their schemas to JSON files for reference or integration with your applications.
Output Formats
By default, the CLI outputs data in table format. You can switch to JSON format:
xpander --output json agent listAuthentication and Login
Login to the Xpander platform:
xpander loginCheck your login status:
xpander login --statusDevelopment
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 cliFor local development and testing:
# Make code changes
# Then build and run locally
npm run build
node ./lib/index.js [command]Project Structure
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 projenKey directories:
src/: Source codesrc/commands/: CLI command implementationssrc/utils/: Utility functions and API clientsrc/types/: TypeScript type definitions
lib/: Compiled JavaScript outputtest/: Test files
Common Build Issues and Solutions
Module Import Errors
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 Variables
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,
},
},CLI Binary Configuration
Ensure the package.json includes the proper bin entry for the CLI:
// In .projenrc.ts
bin: {
xpander: 'lib/index.js',
},License
Apache-2.0
