Skip to content

elizaos-plugins/plugin-console

Repository files navigation

@elizaos/plugin-console

Console plugin for ElizaOS - enables agent chat via stdin/stdout.

Description

This plugin provides a simple text-based interface for interacting with ElizaOS agents through the terminal. It's useful for:

  • Development and testing: Quick iteration without needing a full client setup
  • Scripting and automation: Pipe input/output for automated workflows
  • Headless deployments: Run agents on servers without a GUI
  • Interactive CLI sessions: Chat with your agent directly in the terminal

Installation

npm install @elizaos/plugin-console

Or with bun:

bun add @elizaos/plugin-console

Usage

In a Character File

Add the plugin to your character's plugins array:

{
  "name": "MyAgent",
  "plugins": ["@elizaos/plugin-console"]
}

Programmatically

import { consolePlugin } from "@elizaos/plugin-console";

const character = {
  name: "MyAgent",
  plugins: [consolePlugin],
};

Environment Variables

Variable Default Description
CONSOLE_SHOW_THOUGHTS false Set to "true" to display the agent's internal thought process
CONSOLE_SHOW_ACTIONS false Set to "true" to display action names when executed

Interactive Mode

When running with a TTY (interactive terminal), you'll see:

🤖 MyAgent is ready to chat!
Type your message and press Enter. Press Ctrl+C to exit.

> Hello!

MyAgent: Hi there! How can I help you today?

>

Non-Interactive Mode (Piping)

The plugin also supports non-interactive mode for scripting:

# Single message
echo "What is the weather like?" | elizaos start

# Multiple messages from a file
cat questions.txt | elizaos start

# Save responses
echo "Tell me a joke" | elizaos start > response.txt

Features

  • Automatic environment setup: Creates a console world, room, and user entity
  • Event-driven: Integrates with ElizaOS's event system (MESSAGE_RECEIVED, MESSAGE_SENT)
  • Streaming support: Responses appear as they're generated
  • Clean shutdown: Handles Ctrl+C gracefully

Service API

The ConsoleService provides:

interface ConsoleService {
  // Check if the service is running
  readonly running: boolean;
  
  // Get the room ID for console chat
  readonly consoleRoomId: UUID;
  
  // Get the entity ID for the console user
  readonly consoleEntityId: UUID;
  
  // Stop the service
  stop(): Promise<void>;
}

Access the service from runtime:

const consoleService = runtime.getService<ConsoleService>("console");
if (consoleService?.running) {
  console.log(`Console room: ${consoleService.consoleRoomId}`);
}

License

MIT

About

interactive terminal

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published