Skip to main content

echotools

通用基础设施 SDK:配置、日志、事件、调度、插件、调用链,以及 entml LLM 工具调用协议与终端 Console UI。

完全项目无关,兼容 Python 3.8–3.14。当前版本:2.4.7(详见 CHANGELOG)。

安装

# 核心(仅 typing-extensions)
pip install echotools

# 完整功能(含 TOML、Web、终端、Console UI 等)
pip install echotools[all]

可选依赖

Extra 用途
toml TOML 配置读写
watch watchdog 文件监视
http aiohttp Web 层
socks SOCKS 代理
ssh SSH 终端
terminal Windows ConPTY
console Rich 终端 UI(渐变、表格、交互选择)
all 全部可选依赖
dev pytest、ruff、mypy

快速开始

基础设施

from echotools import EchoTools

et = EchoTools(service_name="myapp")
et.logger.configure(level="INFO", color=True)
cfg = et.config
cfg.load("config.toml")

with et.tracer.trace("request") as trace:
    with et.tracer.span(trace, "db") as span:
        span.set_tag("query", "select 1")

await et.shutdown()

entml 工具调用

内置 entml<entml:*> 熵标记语言)协议,负责 prompt 注入与模型输出解析。

from echotools import FncallStreamParser, get_protocol, inject_fncall

tools = [
    {
        "name": "Bash",
        "description": "Run a shell command",
        "input_schema": {
            "type": "object",
            "properties": {"command": {"type": "string"}},
            "required": ["command"],
        },
    }
]
messages = [{"role": "user", "content": "列出当前目录"}]

proto = get_protocol()
out_messages = inject_fncall(messages, tools, proto, lang="zh")

parser = FncallStreamParser(proto, tools=tools)
for chunk in model_stream:
    parser.feed(chunk)
    if parser.get_ready_tool_calls():
        ...
result = parser.finalize()

能力包括:prompt 注入(history / 工具结果 / thinking 模式)、batch parse()、流式 partial_text / input_json_delta、伪 history 剥离、工具循环检测。

终端 Console UI

需要 pip install echotools[console](或 [all]):

from echotools.media.console import (
    create_themed_ui,
    render_gradient_banner,
    render_text_lines,
    run_select,
)

ui = create_themed_ui(theme_name="ocean")  # ocean / forest / sunset / violet / rose / slate / cyan
print(render_gradient_banner(render_text_lines("echotools"), theme_name="ocean"))
choice = run_select(ui, "选择主题", ["ocean", "forest", "sunset"])

能力总览

模块 说明
EchoTools 门面:配置、日志、事件、调度、插件等统一入口
ConfigCenter 点路径配置 + 热重载 + 类型绑定
LoggerManager 调用链注入 + 颜色 + 轮转
EventBus 同步/异步事件
Tracer 轻量调用链
TaskDispatcher 单发/竞速 + 贝叶斯自适应选择
PluginRegistry 自动发现 + 热重载
get_protocol / inject_fncall entml 工具协议与 prompt 注入
FncallStreamParser 流式工具调用解析
media.console Rich 终端 UI、多主题、交互选择与 ANSI 渐变
PrintStream 动态速度打印流
ProxyManager HTTP/HTTPS/SOCKS
WebApplication aiohttp Web(需 [http]
LocalTerminal / SSHTerminal 终端会话(需 [terminal] / [ssh]
AutoUpdater git 自动更新
FileWatcher 轮询文件监视
plat.capture 跨平台音频监控/录音/截图(纯 ctypes,零第三方依赖)

开发

pip install -e ".[dev,all]"
make -C docs lint
make -C docs test
make -C docs cov

模块指南见 docs/modules.md,API 参考见 docs/api.md

变更记录

docs/CHANGELOG.md

许可证

MIT

Download files

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

Source Distribution

echotools-2.4.7.tar.gz (390.1 kB view details)

Uploaded Source

Built Distribution

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

echotools-2.4.7-py3-none-any.whl (506.1 kB view details)

Uploaded Python 3

File details

Details for the file echotools-2.4.7.tar.gz.

File metadata

  • Download URL: echotools-2.4.7.tar.gz
  • Upload date:
  • Size: 390.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.15

File hashes

Hashes for echotools-2.4.7.tar.gz
Algorithm Hash digest
SHA256 372d6cc5d7d7fc60ca2a0edff9122c40269c5e5ae8246cb37ef3d677180a626c
MD5 1818f7b8cb2cdbb9cfe251c53b6bfe88
BLAKE2b-256 6c1333d7951e64c02557c34fb0a16acaecaa9800b6538f71088bb9959021c875

See more details on using hashes here.

File details

Details for the file echotools-2.4.7-py3-none-any.whl.

File metadata

  • Download URL: echotools-2.4.7-py3-none-any.whl
  • Upload date:
  • Size: 506.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.15

File hashes

Hashes for echotools-2.4.7-py3-none-any.whl
Algorithm Hash digest
SHA256 7c2ea692c579ffffc1da01e66e0babedfaf06b6e36b35c5c2152b2395b6bcec9
MD5 466308ccfe9a4929b95f2c3b96066502
BLAKE2b-256 79a951430236075d691c1d42b5be32af627bac30b28f44c796852545360ba481

See more details on using hashes here.

Release history Release notifications | RSS feed

2.4.11

2 files

2.4.10

2 files

2.4.9

2 files

2.4.8

2 files

This release

2.4.7 This release

2 files

2.4.6

2 files

2.4.5

2 files

2.4.4

2 files

2.4.3

2 files

2.4.2

2 files

2.4.1

2 files

2.4.0

2 files

2.3.104

2 files

2.3.103

2 files

2.3.100

2 files

2.3.99

2 files

2.3.98

2 files

2.3.97

2 files

2.3.96

2 files

2.3.94

2 files

2.3.93

2 files

2.3.91

2 files

2.3.90

2 files

2.3.89

2 files

2.3.88

2 files

2.3.87

2 files

2.3.86

2 files

2.3.85

2 files

2.3.84

2 files

2.3.83

2 files

2.3.82

2 files

2.3.81

2 files

2.3.80

2 files

2.3.78

2 files

2.3.74

2 files

2.3.73

2 files

2.3.71

2 files

2.3.70

2 files

2.3.67

2 files

2.3.66

2 files

2.3.64

2 files

2.3.62

2 files

2.3.61

2 files

2.3.60

2 files

2.3.56

2 files

2.3.55

2 files

2.3.53

2 files

2.3.52

2 files

2.3.51

2 files

2.3.50

2 files

2.3.49

2 files

2.3.48

2 files

2.3.47

2 files

2.3.46

2 files

2.3.45

2 files

2.3.44

2 files

2.3.43

2 files

2.3.42

2 files

2.3.40

2 files

2.3.39

2 files

2.3.38

2 files

2.3.31

2 files

2.3.30

2 files

2.3.29

2 files

2.3.25

2 files

2.3.23

2 files

2.3.22

2 files

2.3.21

2 files

2.3.19

2 files

2.3.16

2 files

2.3.15

2 files

2.3.14

2 files

2.3.13

2 files

2.3.12

2 files

2.3.11

2 files

2.3.10

2 files

2.3.8

2 files

2.3.7

2 files

2.3.6

2 files

2.3.5

2 files

2.3.4

2 files

2.3.3

2 files

2.3.2

2 files

2.3.1

2 files

2.3.0

2 files

2.1.0

2 files

2.0.0

2 files

1.0.36

2 files

1.0.35

2 files

1.0.33

2 files

1.0.32

2 files

1.0.31

2 files

1.0.30

2 files

1.0.29

1 file

1.0.28

1 file

1.0.27

2 files

1.0.26

2 files

1.0.25

2 files

1.0.24

2 files

1.0.23

2 files

1.0.22

2 files

1.0.21

2 files

1.0.20

2 files

1.0.19

1 file

1.0.18

1 file

1.0.17

2 files

1.0.16

2 files

1.0.15

2 files

1.0.14

2 files

1.0.13

2 files

1.0.12

2 files

1.0.11

2 files

1.0.10

2 files

1.0.9

2 files

1.0.8

2 files

1.0.7

2 files

1.0.6

2 files

1.0.5

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

Supported by

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