Skip to main content

Terminal-based AI agent — a function-calling loop with minimum harness

Project description

slife

Terminal-based AI agent — a function-calling loop with minimum harness. Chat with an LLM that can execute shell commands, search the web, and load on-demand skills.

Quick Start

# Install
uv sync

# Configure
cp slife.json5.example slife.json5
# Edit slife.json5 — set your API keys via ${ENV_VAR} references

# Run
uv run slife

Configuration

Edit slife.json5. Key sections:

{
  models: {
    providers: {
      deepseek: {
        base_url: "https://api.deepseek.com",
        api_key: "${DEEPSEEK_API_KEY}",
        models: [
          { model: "deepseek-v4-flash", name: "DeepSeek V4 Flash" },
          { model: "deepseek-v4-pro", name: "DeepSeek V4 Pro", reasoning: true },
        ],
      },
    },
  },
  active_model: "deepseek/deepseek-v4-pro",
  agent: { max_iterations: 10 },
  tools: [
    { type: "platform" },
    { type: "shell", timeout: 30 },
    { type: "serper" },
    { type: "skill", skills_dir: "skills" },
  ],
}

API keys use ${ENV_VAR} syntax — set them in your environment, not in the config file.

Tools

Tool Type What it does
execute_shell shell Run shell commands on the host machine
get_shell_command platform Translate intent into OS-correct shell syntax
web_search serper Google Search via Serper.dev API
list_skills skill List available skill plugins
use_skill skill Load a skill's documentation into context

Add or remove tools from the tools[] list to control what the agent can do.

Skills

Skills are on-demand documentation plugins. The agent loads them only when needed, keeping the context lean.

skills/baidu-search/
  SKILL.md              # Instructions the agent reads
  scripts/search.py     # Supporting code

Flow: the agent calls list_skills → sees what's available → calls use_skill("baidu-search") to load full instructions.

To add a skill, create a directory under skills/ with a SKILL.md file.

Tips

  • /file image.png — attach an image for vision models
  • Ctrl+C — clear the conversation
  • Ctrl+Q — quit

Design

slife is a minimum-harness agent. The harness only does three things the LLM cannot: execute tools, maintain conversation state, and stream responses. Everything else — reasoning, planning, tool selection, error recovery — is the LLM's job.

The system prompt is intentionally lean. It only contains project-specific information not in the LLM's training data. The LLM already knows how function calling works.

See docs/design.md for the full design rationale.

Project Structure

slife/
  agent/           # Core agent loop, LLM client, conversation
    loop.py        #   Function-calling while-loop
    llm_client.py  #   OpenAI-compatible streaming client
    conversation.py#   Message history (OpenAI format)
    service.py     #   Wiring: client + tools + loop
    system_prompt.py#  Jinja2 template rendering
  tools/           # Extensible tool system
    base.py        #   Tool ABC
    registry.py    #   Name → Tool lookup
    factory.py     #   Config type → Tool instances
    shell.py       #   execute_shell
    shell_command.py#  get_shell_command (platform-aware)
    serper.py      #   web_search (Serper.dev)
    skill.py       #   list_skills / use_skill
  ui/              # Textual TUI
    app.py         #   Main application
    chat.py        #   Message widgets
    handler.py     #   Streaming event → UI bridge
    tool_display.py#   Tool call rendering
  config.py        # JSON5 config loading
  env.py           # ${ENV_VAR} resolution
  platform.py      # OS detection, shell syntax
  skills/          # Skill plugins
  docs/            # Design documents

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

slife-0.1.0.tar.gz (86.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

slife-0.1.0-py3-none-any.whl (36.8 kB view details)

Uploaded Python 3

File details

Details for the file slife-0.1.0.tar.gz.

File metadata

  • Download URL: slife-0.1.0.tar.gz
  • Upload date:
  • Size: 86.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.5

File hashes

Hashes for slife-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d8b2c0f154f236e56bfdc73e1e02fa36974115128e3b55b562d319c92c608160
MD5 cca3e6f6ba015896718b3acb84291629
BLAKE2b-256 b87722e6008820760570b958263ca4076bb4f49e146976d60f450d343c6c5e27

See more details on using hashes here.

File details

Details for the file slife-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: slife-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 36.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.5

File hashes

Hashes for slife-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d84975164b7a104ac4520e99f48825ae511469650753bb8e7801b174963009b9
MD5 0236eb37bea0fdfeed7844d5063b1abf
BLAKE2b-256 74ede5cf154743f48e33069f065f460d636a5ec38e0c63f58fb6fd421f5795c7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page