Alphakdeps.io is experimental and evolving — the registry and packages may change or reset.
Toolkdeps asset

kdeps-tools-tail_file

v2.0.0

Read the last N lines of a file (default 20) -- for checking the end of a log or output file without knowing its total length upfront. Use as evidence that a command's output or a log ends the way a task claims it does.

set tools / shelf tools

LLM context: ~145 tokens when loaded (prompt or tool definition)

Where it runs

Part of the tools set, used in workflow and agent mode. What the model is told about each built-in tool: its description, usage notes and parameters. kdeps runs the tool itself.

  1. the agent loop builds the request
  2. the tool definitions are sent to the modeltools/tail_file
  3. the model calls a tool
  4. kdeps runs it
  5. the result goes back to the model

Loaded by: kdeps (agent loop), /update, /settings, kdeps run, kdeps install, kdeps list, kdeps uninstall, kdeps update

In the code: kdeps (agent loop)agent.RegisterBuiltinToolsagent.definedAs

Install

A kdeps asset: installed with the first-run profile that includes its set, or the first time a command needs it, and updated without a new release.

kdeps install tools/tail_file

Pin a version with kdeps install tools/tail_file@<version>.

Contents

Read the last N lines of a file (default 20) -- for checking the end of a log or output file without knowing its total length upfront. Use as evidence that a command's output or a log ends the way a task claims it does.

category
file
outputFormat
numbered lines (number, tab, text); a "[last N/M lines shown]" note when the file is longer
seeAlso
read_file, md5_file, list_files
ParameterTypeDescription
file_path *stringPath to the file (absolute, or relative to the working directory)
linesnumberNumber of lines from the end to return (default 20)

Python script (declared in YAML, no Go code)

import collections, json, os, sys

a = json.loads(sys.argv[1])
path = a["file_path"] if os.path.isabs(a["file_path"]) else os.path.abspath(a["file_path"])
if os.path.isdir(path):
    sys.exit("tail_file: %s is a directory" % path)
try:
    n = int(float(a.get("lines") or 0))
except ValueError:
    n = 0
if n <= 0:
    n = 20
total, last = 0, collections.deque(maxlen=n)
try:
    with open(path, "rb") as f:
        if b"\0" in f.read(512):
            sys.exit("tail_file: %s appears to be a binary file" % path)
        f.seek(0)
        for line in f:  # streamed: a large log is never held in memory
            total += 1
            last.append(line)
except OSError as e:
    sys.exit("tail_file: %s: %s" % (path, e.strerror or e))
start, width = total - len(last), len(str(total))
for i, line in enumerate(last):
    text = line[:-1] if line.endswith(b"\n") else line
    print("%*d\t%s" % (width, start + i + 1, text.decode("utf-8", "replace")))
if start > 0:
    print("[last %d/%d lines shown]" % (len(last), total))

Paths kept in the workspace: file_path

aliases:
  - tail

Versions

VersionPublishedStatus
2.0.010/24/2026active
1.1.010/17/2026active
1.0.010/11/2026active

Details

Author
kdeps
License
Apache-2.0
Latest Version
2.0.0
Published
10/11/2026

Tags

kdepstool