Skip to content

KarlesP/cli-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cli-agent

A single-binary CLI coding agent for Linux pipeline assessments, built in Rust.
Connects to any OpenAI-compatible LLM (Ollama, vLLM, OpenAI, etc.) and uses real tools — bash, Python, file I/O, HTTP — to complete tasks.

Install

# Auto-detect arch and download latest release
ARCH=$(uname -m)
[ "$ARCH" = "aarch64" ] && BIN="agent-linux-aarch64" || BIN="agent-linux-x86_64"
curl -fsSL "https://github.com/YOUR_ORG/cli-agent/releases/latest/download/$BIN" -o agent
chmod +x agent

Usage

# Basic
./agent run --task "Is nginx running? What version?"

# JSON output (ideal for pipelines)
./agent run --task "Check disk usage and free memory" --output json

# Read task from stdin
echo "List all failed systemd units" | ./agent run

# Custom endpoint + model
./agent run \
  --endpoint http://my-ollama:11434 \
  --model llama3.1:70b \
  --task "Assess open ports on this server" \
  --output json \
  --verbose

# OpenAI
AGENT_API_KEY=sk-... ./agent run \
  --endpoint https://api.openai.com \
  --model gpt-4o \
  --task "Review /etc/nginx/nginx.conf for security issues"

Environment variables

Variable Default Description
AGENT_ENDPOINT http://localhost:11434 LLM API base URL
AGENT_MODEL llama3.1:8b Model name
AGENT_API_KEY Bearer token (OpenAI, hosted APIs)
AGENT_TOOLS all tools Comma-separated enabled tool names
AGENT_OUTPUT text text or json
AGENT_SYSTEM_PROMPT built-in Override the system prompt

Tools

Name Description
bash Execute a bash command; returns stdout/stderr/exit
python Execute a Python 3 snippet via python3
read_file Read a file (truncated at 16 KB)
write_file Write content to a file
list_dir List directory contents with sizes
http_get HTTP GET a URL; returns status + body
./agent tools   # list all tools

JSON output schema

{
  "status": "success",
  "answer": "nginx 1.24.0 is running (active). ...",
  "tool_calls": [
    { "tool": "bash", "params": { "command": "nginx -v" }, "output": "nginx version: nginx/1.24.0" }
  ],
  "turns": 3,
  "model": "llama3.1:8b"
}

Exit codes: 0 = success, 1 = agent non-success status, 2 = runtime error.

Pipeline example (GitHub Actions)

- name: Download agent
  run: |
    ARCH=$(uname -m)
    [ "$ARCH" = "aarch64" ] && BIN="agent-linux-aarch64" || BIN="agent-linux-x86_64"
    curl -fsSL "https://github.com/YOUR_ORG/cli-agent/releases/latest/download/$BIN" -o agent
    chmod +x agent

- name: Run server assessment
  env:
    AGENT_ENDPOINT: ${{ secrets.OLLAMA_ENDPOINT }}
    AGENT_MODEL: llama3.1:70b
  run: |
    ./agent run \
      --task "Assess running services, open ports, and disk usage. Summarise any risks." \
      --output json \
      --timeout 60 \
      --max-turns 15 \
      > assessment.json

- name: Upload assessment
  uses: actions/upload-artifact@v4
  with:
    name: server-assessment
    path: assessment.json

Release a new version

git tag v0.2.0 && git push origin v0.2.0

The workflow builds agent-linux-x86_64 and agent-linux-aarch64 and attaches them to the GitHub release automatically.

Build from source

cargo build --release
# binary → target/release/agent

# Cross-compile to aarch64 (requires gcc-aarch64-linux-gnu)
rustup target add aarch64-unknown-linux-gnu
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
  cargo build --release --target aarch64-unknown-linux-gnu

LLM compatibility

Requires an OpenAI-compatible /v1/chat/completions endpoint with function/tool calling support.
Tested with:

  • Ollama ≥ 0.3 with llama3.1, mistral-nemo, qwen2.5-coder
  • vLLM with any function-calling model
  • OpenAI API (gpt-4o, gpt-4o-mini)

About

Single-binary CLI coding agent for Linux pipeline assessments — Rust, OpenAI-compatible LLMs

Resources

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages