Skip to main content

Overview

The Maikers CLI provides a command-line interface for interacting with the Maikers API. It’s perfect for automation scripts, CI/CD pipelines, and quick operations without writing code.

Authentication

Manage API keys and authentication

Agent Management

Create, update, and manage AI agents

Agent Interaction

Query and interact with your agents

Automation

Perfect for scripts and automation workflows

Installation & Setup

Build the CLI

First, clone the repository and build the CLI:
# Clone the repository
git clone https://github.com/maikershq/maikers-mainframe-sdk.git
cd maikers-mainframe-sdk

# Install dependencies
pnpm install

# Build the CLI
pnpm build

Verify Installation

# Check if CLI is working
node dist/cli.js --help
You should see the help output with available commands.

Authentication Commands

Login

Authenticate with your Maikers API key:
node dist/cli.js auth login YOUR_API_KEY
Replace YOUR_API_KEY with your actual API key from the Maikers dashboard.

Check Status

Verify your authentication status:
node dist/cli.js auth status
Example Output:
✅ Authenticated
API Key: mk_****...****
Status: Active

Logout

Clear your stored authentication:
node dist/cli.js auth logout

Agent Management Commands

Create Agent

Create a new AI agent with specified configuration:
node dist/cli.js agent create \
  --id "my-trading-bot" \
  --name "Trading Assistant" \
  --description "AI agent for market analysis and trading" \
  --risk-level low \
  --job-types trading,analysis \
  --skills sniper,analyst \
  --persona-id helpful-assistant
Parameters:
  • --id: Unique identifier for the agent
  • --name: Display name for the agent
  • --description: Description of the agent’s purpose
  • --risk-level: Risk tolerance (low, medium, high)
  • --job-types: Comma-separated list of job types
  • --skills: Comma-separated list of skills
  • --persona-id: Persona identifier for the agent
Example Output:
✅ Agent created successfully
ID: my-trading-bot
Name: Trading Assistant
Skills: sniper, analyst
Status: Active

List Agents

List all your agents:
node dist/cli.js agent list
Example Output:
📋 Your Agents:

1. my-trading-bot
   Name: Trading Assistant
   Skills: sniper, analyst
   Status: Active
   Created: 2024-01-15T10:30:00Z

2. content-creator
   Name: Content Generator
   Skills: writer, entertainer
   Status: Active
   Created: 2024-01-14T15:45:00Z

Get Agent Details

Get detailed information about a specific agent:
node dist/cli.js agent get my-trading-bot

Update Agent Settings

Update an existing agent’s configuration:
node dist/cli.js agent update-settings my-trading-bot \
  --persona "professional trader" \
  --risks low,medium

Delete Agent

Remove an agent:
node dist/cli.js agent delete my-trading-bot
This action is irreversible. Make sure you want to permanently delete the agent.

Agent Interaction Commands

Query Agent

Send a message to an agent and get a response:
node dist/cli.js agent query my-trading-bot \
  --message "What are the current market trends for Bitcoin?"
Example Output:
🤖 Agent Response:

Based on current market analysis, Bitcoin is showing:

1. **Bullish Momentum**: Price has broken above key resistance at $45,000
2. **Volume Increase**: Trading volume up 25% in the last 24 hours
3. **Technical Indicators**: RSI at 65, indicating strong but not overbought
4. **Market Sentiment**: Fear & Greed Index at 72 (Greed)

Recommendation: Consider taking profits at $48,000 resistance level.

---
Response Time: 2.3s
Credits Used: 3

Interactive Chat

Start an interactive chat session with an agent:
node dist/cli.js agent chat my-trading-bot
This opens an interactive session where you can have a conversation:
🤖 Starting chat with Trading Assistant
Type 'exit' to quit, 'help' for commands

You: What's the best strategy for DeFi yield farming?

Agent: For DeFi yield farming, I recommend a diversified approach:

1. **Start Conservative**: Begin with established protocols like Aave or Compound
2. **Risk Management**: Never put more than 20% in high-risk farms
3. **Impermanent Loss**: Understand IL before providing liquidity
4. **Gas Optimization**: Use Layer 2 solutions when possible

Would you like me to analyze specific protocols?

You: Yes, analyze Uniswap V3 vs Curve

Agent: Here's a comparison of Uniswap V3 vs Curve for yield farming:

[Detailed analysis continues...]

You: exit

Chat session ended. Total credits used: 8

Automation & Scripting

Batch Operations

Create multiple agents from a configuration file:
# Create agents.json configuration file
cat > agents.json << EOF
[
  {
    "id": "trader-1",
    "name": "BTC Trader",
    "skills": ["sniper", "analyst"],
    "jobTypes": ["trading"]
  },
  {
    "id": "researcher-1",
    "name": "Market Researcher",
    "skills": ["hunter", "analyst"],
    "jobTypes": ["research"]
  }
]
EOF

# Create agents from file
node dist/cli.js agent create-batch --file agents.json

Scheduled Queries

Use with cron for scheduled operations:
# Add to crontab for hourly market analysis
# 0 * * * * /path/to/node /path/to/dist/cli.js agent query trader-1 --message "Analyze current market conditions" >> /var/log/maikers.log

Pipeline Integration

Use in CI/CD pipelines:
#!/bin/bash
# deploy-trading-bot.sh

# Authenticate
node dist/cli.js auth login $MAIKERS_API_KEY

# Create trading bot
node dist/cli.js agent create \
  --id "production-trader-$(date +%s)" \
  --name "Production Trading Bot" \
  --description "Automated trading bot for production" \
  --risk-level medium \
  --skills sniper,analyst,strategist

# Test the bot
RESPONSE=$(node dist/cli.js agent query production-trader-$(date +%s) \
  --message "Perform system check and report status")

if [[ $RESPONSE == *"✅"* ]]; then
  echo "Trading bot deployed successfully"
  exit 0
else
  echo "Trading bot deployment failed"
  exit 1
fi

Advanced Usage

JSON Output

Get machine-readable JSON output:
node dist/cli.js agent query my-trading-bot \
  --message "Analyze Bitcoin" \
  --format json
Output:
{
  "agentId": "my-trading-bot",
  "response": "Bitcoin analysis shows bullish momentum...",
  "creditsUsed": 3,
  "timestamp": "2024-01-15T10:30:00Z",
  "responseTime": 2300
}

Verbose Mode

Get detailed operation logs:
node dist/cli.js agent create \
  --id "debug-agent" \
  --name "Debug Agent" \
  --verbose

Configuration File

Use a configuration file for default settings:
# Create ~/.maikers/config.json
mkdir -p ~/.maikers
cat > ~/.maikers/config.json << EOF
{
  "apiKey": "your-api-key",
  "baseUrl": "https://api.maikers.com",
  "defaultRiskLevel": "medium",
  "defaultPersona": "helpful-assistant"
}
EOF

# CLI will automatically use these defaults
node dist/cli.js agent create --id "auto-config-agent"

Error Handling

Common Errors

Error: ❌ Authentication failed. Invalid API key.Solutions:
  • Verify your API key is correct
  • Check if the key has expired
  • Ensure you’re using the right environment (dev/prod)
# Re-authenticate
node dist/cli.js auth logout
node dist/cli.js auth login NEW_API_KEY
Error: ❌ Agent 'my-agent' not found.Solutions:
  • Check the agent ID spelling
  • List all agents to verify it exists
  • Ensure the agent wasn’t deleted
# List all agents
node dist/cli.js agent list
Error: ❌ Rate limit exceeded. Please try again later.Solutions:
  • Wait before retrying
  • Implement delays in scripts
  • Consider upgrading your plan
# Add delay in scripts
sleep 5
node dist/cli.js agent query my-agent --message "..."
Error: ❌ Network error: Connection timeout.Solutions:
  • Check internet connection
  • Verify API endpoint is accessible
  • Try again with longer timeout
# Increase timeout
node dist/cli.js agent query my-agent \
  --message "..." \
  --timeout 60000

Help & Documentation

Get Help

# General help
node dist/cli.js --help

# Command-specific help
node dist/cli.js agent --help
node dist/cli.js agent create --help
node dist/cli.js auth --help

Version Information

node dist/cli.js --version

Best Practices

Security

Protect Your API Key
  • Never commit API keys to version control
  • Use environment variables in scripts
  • Rotate keys regularly
  • Use different keys for different environments

Automation

Script Optimization
  • Add error handling to scripts
  • Implement retry logic with backoff
  • Log operations for debugging
  • Use JSON output for parsing

Performance

Efficient Usage
  • Batch operations when possible
  • Respect rate limits
  • Cache responses when appropriate
  • Monitor credit usage

Monitoring

Operation Tracking
  • Log all operations
  • Monitor agent performance
  • Track credit consumption
  • Set up alerts for failures

Next Steps