Getting Started with Terminal Agent

Getting Started with Terminal Agent
May 9, 2025 Terminal Agent Team 8 minutes

Getting Started with Terminal Agent

Terminal Agent is a powerful terminal assistant tool that helps you interact with the terminal using natural language, performing system diagnostics, command translation, and automatic software installation. This guide will introduce how to install and use Terminal Agent, helping you quickly get started with this tool.

Installing Terminal Agent

Installation from Source Code

  1. Clone the repository
git clone https://github.com/SagesAi/terminal-agent.git
cd terminal-agent
  1. Install packages and dependencies
pip install -e .
  1. Set API Keys
# Copy the example .env file to your config directory
mkdir -p ~/.terminal_agent
cp .env.example ~/.terminal_agent/.env

# Edit the .env file to add your API keys
# For example:
# OPENAI_API_KEY=your_api_key_here
# DEEPSEEK_API_KEY=your_api_key_here
# GOOGLE_API_KEY=your_api_key_here
# ANTHROPIC_API_KEY=your_api_key_here

Basic Usage

Running Terminal Agent

# If installed from source:
terminal-agent

Example Use Cases

System Diagnostics

[Terminal Agent] > My system is running slow, can you help me diagnose the issue?

Command Translation

[Terminal Agent] > Find all files larger than 100MB in my home directory

Software Installation

[Terminal Agent] > Install Docker on my system

Specifying LLM Provider

# Using a specific provider
TERMINAL_AGENT_PROVIDER=gemini terminal-agent

# Using local model with Ollama
TERMINAL_AGENT_PROVIDER=ollama terminal-agent

# Using VLLM server
TERMINAL_AGENT_PROVIDER=vllm VLLM_API_BASE=http://localhost:8000 terminal-agent

# Or set in .env file
echo "TERMINAL_AGENT_PROVIDER=claude" >> ~/.terminal_agent/.env

Using Local Models

Terminal Agent supports local LLM deployment via Ollama and VLLM, providing privacy and flexibility.

Ollama Integration

Ollama allows you to run various open-source models on your local machine.

  1. Install Ollama:

    • Download and install from ollama.com
    • Start Ollama service: ollama serve
  2. Pull models:

    # Pull models (examples)
    ollama pull llama3
    ollama pull mistral
    ollama pull llama2
    
  3. Use with Terminal Agent:

    # Use Ollama with Terminal Agent
    TERMINAL_AGENT_PROVIDER=ollama terminal-agent
    
    # Specify a specific model
    TERMINAL_AGENT_PROVIDER=ollama TERMINAL_AGENT_MODEL=mistral terminal-agent
    
    # Or configure in .env file
    echo "TERMINAL_AGENT_PROVIDER=ollama" >> ~/.terminal_agent/.env
    echo "TERMINAL_AGENT_MODEL=llama3" >> ~/.terminal_agent/.env
    

Configuration Options

Terminal Agent can be configured via environment variables or a .env file:

VariableDescriptionDefault
OPENAI_API_KEYOpenAI API keyNone
DEEPSEEK_API_KEYDeepSeek API keyNone
GOOGLE_API_KEYGoogle Gemini API keyNone
ANTHROPIC_API_KEYAnthropic Claude API keyNone
TERMINAL_AGENT_PROVIDERDefault LLM provideropenai
TERMINAL_AGENT_MODELDefault model for providerProvider-specific
TERMINAL_AGENT_API_BASECustom API base URLProvider-specific
OLLAMA_API_BASEOllama API base URLhttp://localhost:11434
VLLM_API_BASEVLLM API base URLhttp://localhost:8000
VLLM_API_KEYVLLM API key (if needed)None

Advanced Usage

Terminal Agent’s modular architecture allows you to extend its functionality or customize its behavior. Check the terminal_agent directory in the source code for more information about its architecture and extension points.

We hope this guide helps you get started with Terminal Agent. If you have any questions or suggestions, please visit our GitHub repository.

Basic Usage

Running Terminal Agent

# If installed from source:
terminal-agent

Example Use Cases

System Diagnostics

[Terminal Agent] > My system is running slow, can you help me diagnose the issue?

Command Translation

[Terminal Agent] > Find all files larger than 100MB in my home directory

Software Installation

[Terminal Agent] > Install Docker on my system

Specifying LLM Provider

# Using a specific provider
TERMINAL_AGENT_PROVIDER=gemini terminal-agent

Conclusion

Terminal Agent simplifies terminal interaction through natural language, making DevOps tasks more efficient and accessible. By following this guide, you should now be able to install and use Terminal Agent for various tasks.

For more information, visit the official documentation or join our community forum.