Testing
Lobu provides multiple ways to test your agent during development.
CLI chat
Section titled “CLI chat”Send a prompt and stream the response in your terminal.
# Basic testnpx @lobu/cli@latest chat "Hello, what can you do?"
# Multi-turn conversationnpx @lobu/cli@latest chat "What's on my calendar?" --thread my-testnpx @lobu/cli@latest chat "Cancel the 3pm meeting" --thread my-test
# Target a specific agent (if you have multiple in lobu.toml)npx @lobu/cli@latest chat "Hello" --agent support
# Dry run (no history persisted)npx @lobu/cli@latest chat "Test prompt" --dry-run
# Force a fresh sessionnpx @lobu/cli@latest chat "Start over" --newThis uses API mode — the agent runs and responds directly to your terminal. No platform connection needed.
Testing through a platform
Section titled “Testing through a platform”Route messages through a connected platform to test the full end-to-end flow.
Using the CLI
Section titled “Using the CLI”The --user flag routes your message through a platform connection:
# Send as a Telegram usernpx @lobu/cli@latest chat "Hello" --user telegram:12345
# Send to a Slack channelnpx @lobu/cli@latest chat "Hello" --user slack:C0123ABCD
# Send to Discordnpx @lobu/cli@latest chat "Hello" --user discord:987654321The response appears on the platform and streams to your terminal.
Using the test script
Section titled “Using the test script”The test-bot.sh script automates platform testing with automatic response polling:
# Auto-detect platform from active connections./scripts/test-bot.sh "Hello, test message"
# Send multiple messages in sequence./scripts/test-bot.sh "First question" "Follow-up" "Third message"
# Explicit platformTEST_PLATFORM=telegram ./scripts/test-bot.sh "Hello"TEST_PLATFORM=slack ./scripts/test-bot.sh "Hello"Telegram testing
Section titled “Telegram testing”For Telegram, the script sends messages as your real user account using tguser, so the bot sees a real user message:
# Uses the active Telegram bot connection from the gateway./scripts/test-bot.sh "Hello bot"
# Target a specific botTEST_CHANNEL=@mybot ./scripts/test-bot.sh "Hello"Requirements: tguser installed, TG_API_ID and TG_API_HASH set in .env.
Slack testing
Section titled “Slack testing”TEST_PLATFORM=slack QA_SLACK_CHANNEL=C0123ABCD ./scripts/test-bot.sh "Hello"Set SLACK_BOT_TOKEN in .env to enable automatic reply polling.
WhatsApp testing
Section titled “WhatsApp testing”TEST_PLATFORM=whatsapp TEST_CHANNEL=+1234567890 ./scripts/test-bot.sh "Hello"Environment variables
Section titled “Environment variables”| Variable | Description |
|---|---|
TEST_PLATFORM | Force platform: telegram, slack, whatsapp (auto-detected if unset) |
TEST_CHANNEL | Channel/chat ID for the target platform |
TEST_TIMEOUT | Response timeout in seconds (default: 120) |
TEST_AGENT_ID | Agent ID to test (default: test-{platform}) |
GATEWAY_URL | Gateway URL (default: http://localhost:8080) |
REST API
Section titled “REST API”Send messages directly to the gateway HTTP API:
curl -X POST http://localhost:8080/api/v1/agents/{agentId}/messages \ -H "Authorization: Bearer $ADMIN_PASSWORD" \ -H "Content-Type: application/json" \ -d '{ "platform": "api", "content": "Hello!" }'Route through a platform by adding platform-specific fields:
# Through Slackcurl -X POST http://localhost:8080/api/v1/agents/{agentId}/messages \ -H "Authorization: Bearer $ADMIN_PASSWORD" \ -H "Content-Type: application/json" \ -d '{ "platform": "slack", "content": "Hello!", "slack": { "channel": "C0123ABCD" } }'
# Through Telegramcurl -X POST http://localhost:8080/api/v1/agents/{agentId}/messages \ -H "Authorization: Bearer $ADMIN_PASSWORD" \ -H "Content-Type: application/json" \ -d '{ "platform": "telegram", "content": "Hello!", "telegram": { "chatId": "12345" } }'Browse all available endpoints at /api/docs on your running gateway.
Testing against remote environments
Section titled “Testing against remote environments”Use named contexts to test against staging or production:
# Add a staging contextnpx @lobu/cli@latest context add staging --api-url https://staging.example.com/api/v1npx @lobu/cli@latest login -c staging
# Chat with the staging agentnpx @lobu/cli@latest chat "Hello" -c stagingResetting conversation state
Section titled “Resetting conversation state”If the agent gives stale or incorrect responses, clear the chat history in Redis:
# Find chat history keysdocker compose -f docker/docker-compose.yml exec redis redis-cli KEYS 'chat:history:*'
# Delete a specific conversationdocker compose -f docker/docker-compose.yml exec redis redis-cli DEL 'chat:history:{key}'Agent evaluations
Section titled “Agent evaluations”For automated quality checks, use the eval command:
npx @lobu/cli@latest eval # run all evalsnpx @lobu/cli@latest eval basic-qa # run a specific evalnpx @lobu/cli@latest eval --model claude/sonnet # eval with a specific modelnpx @lobu/cli@latest eval --list # list available evalsnpx @lobu/cli@latest eval --ci --output results.json # CI modeEval files live in the agent directory and define test cases with expected outcomes. Use --ci for non-zero exit codes on failure in CI/CD pipelines.