Skip to main content

Basic tools of kantan-agents

Project description

kantan-agents-tools

A ready-to-use basic tool pack for kantan-agents (Web/Browser/FS/Exec).
All tool usage is controlled through tool_rules for consistent safety and reproducibility.

What problems it solves

  • You need a ready-to-use set of basic tools for kantan-agents to start fast.
  • Tool interfaces and configs vary across providers, increasing learning cost.
  • Agents can accidentally touch unexpected paths, domains, or commands.
  • It is hard to trace what ran and which limits were applied.

kantan-agents-tools bundles basic tools and centralizes allow/deny, input validation, and policy/limits under tool_rules so you can safely repeat "research -> fetch -> operate -> edit -> execute".

Tool list

Web

  • kantan_web_search: return candidate URLs from search
  • kantan_web_fetch: fetch HTML/text from a URL
  • kantan_web_extract: extract main text from HTML

Browser

  • kantan_browser_open: open dynamic pages and return a page_id
  • kantan_browser_act: run actions like click/input/wait
  • kantan_browser_extract: extract text/links/tables from DOM

FileSystem

  • kantan_fs_list: list directory entries
  • kantan_fs_search: search file contents
  • kantan_fs_read: read a file safely
  • kantan_fs_write: create/overwrite/append a file
  • kantan_fs_apply_patch: apply a unified diff

Exec

  • kantan_shell_run: run a command

About the kantan stack

The kantan stack separates the LLM, agent runtime, tools, and your app into thin layers:

  • kantan-llm: minimal interface for LLM calls
  • kantan-agents: agent runtime and tool_rules governance
  • kantan-agents-tools: this basic tool pack
  • your app: workflow and domain logic

This separation keeps safety and reproducibility while allowing clean replacement and extension.

Install

# 基本ツールを追加 / Add core tools.
uv add kantan-agents kantan-agents-tools

# ブラウザ系ツールを使う場合 / When using browser tools.
uv add playwright
python -m playwright install chromium

Quick Start (Agent)

kantan-agents discovers tool providers via entry points.
Use tool_rules to allow tools and to configure validation + tool settings.

from kantan_agents import Agent, ToolRulesMode, get_context_with_tool_rules

agent = Agent(
    name="tools-agent",
    instructions="Use kantan_web_search to find references.",
    model="gpt-5-mini",  # モデルを明示 / Explicit model.
)

context = get_context_with_tool_rules(ToolRulesMode.RECOMMENDED)  # 推奨ルールを作成 / Build recommended rules.
context["tool_rules"]["allow"] = ["kantan_web_search"]  # 検索のみ許可 / Allow search only.
context["tool_rules"]["params"] = {
    "kantan_web_search": {
        "max_results": {"type": "integer", "minimum": 1, "maximum": 5},  # 入力バリデーション / Input validation.
        "policy": {"allowed_domains": ["example.com"], "search_provider": "auto"},  # 許可ドメイン / Allowed domains.
        "limits": {"max_fetch_bytes": 512000, "max_output_chars": 20000, "max_matches": 200},  # 出力上限 / Output limits.
        "request_id": "req-001",  # 追跡ID / Request ID.
    }
}

result = agent.run("Search for kantan-agents.", context=context)
print(result["result"].final_output)  # 結果を表示 / Print the result.

Notes:

  • tool_rules.params is used for both input validation and tool settings.
  • Reserved keys for tool settings: policy / limits / tracer / request_id.

Direct Call (Non-agent)

from kantan_agents_tools import default_toolset

toolset = default_toolset()
print(toolset.fs_list("."))

Testing

uv run pytest

Docs

  • docs/tool_usage.md
  • docs/spec.md
  • docs/architecture.md

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

kantan_agents_tools-0.1.2.tar.gz (26.9 kB view details)

Uploaded Source

Built Distribution

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

kantan_agents_tools-0.1.2-py3-none-any.whl (26.3 kB view details)

Uploaded Python 3

File details

Details for the file kantan_agents_tools-0.1.2.tar.gz.

File metadata

  • Download URL: kantan_agents_tools-0.1.2.tar.gz
  • Upload date:
  • Size: 26.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for kantan_agents_tools-0.1.2.tar.gz
Algorithm Hash digest
SHA256 d3b511a53d0d0f16cea0e0251dfa4a4d0ccf2e9922b6b22b226eec8bf60a1a25
MD5 fadfb4c1f6b44e975d8b0122d639a1de
BLAKE2b-256 66795cf47c9840b904db56f76cbfb89d26b2bc43bd0a434242311d47650393bc

See more details on using hashes here.

File details

Details for the file kantan_agents_tools-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for kantan_agents_tools-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0f32f0b09e096f351c343cac5a3c750c05aba9b07a73aec49ccbb0ac2d8f5039
MD5 768db5cc5ec8d365c545c220e146fc5c
BLAKE2b-256 de1e036e64754bfb00e747b92c01e645332bb24b1a8f3b6525ef893d3caa581c

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