Skip to main content

echon

Agent 记忆模块 — 自动去重、合并、衰减的长期记忆。

特性

  • 向量检索 — 基于 LanceDB 的语义相似度检索
  • 自动去重 — 语义相同的记忆不会重复存储
  • 智能合并 — 相似但不完全相同的记忆自动合并(可选 LLM 辅助)
  • 时间衰减 — 指数衰减 + 访问频率加成,自动清理过期记忆
  • 文档摄入 — 支持 PDF/Word/PPT/HTML 等格式解析并切分为记忆片段
  • 记忆提取 — 从对话文本中自动提取 fact/event/preference 类型记忆

安装

pip install echon

可选依赖:

pip install echon[doc]       # 文档解析(markitdown + chonkie)
pip install echon[doc-heavy] # 高精度文档解析(MinerU)
pip install echon[llm]       # LLM 辅助合并/提取(flexllm)
pip install echon[all]       # doc + llm

快速开始

from echon import Memory

with Memory("my-agent", embedding_url="http://localhost:8001/v1") as mem:
    # 添加记忆
    mem.add("用户是一名后端工程师", memory_type="fact", importance=0.9)
    mem.add("用户喜欢简洁的代码风格", memory_type="preference", importance=0.8)

    # 检索
    results = mem.recall("代码怎么写比较好", top_k=3)
    for r in results:
        print(f"[{r['memory_type']}] {r['content']}  (score={r['score']})")

    # 重复内容自动去重
    mem.add("用户是一名后端工程师")  # 不会重复存储

文档摄入

from echon import Memory, DocumentParser

parser = DocumentParser(backend="markitdown", chunk_size=512)
with Memory("my-agent", parser=parser, embedding_url="http://localhost:8001/v1") as mem:
    ids = mem.ingest("report.pdf", importance=0.7)
    print(f"摄入 {len(ids)} 条记忆")

记忆提取

# 从对话文本中自动提取记忆
ids = mem.extract("我是数据工程师,最近在研究 RAG 架构,喜欢用 Python")

配置

from echon import EchonConfig, Memory

config = EchonConfig(
    duplicate_threshold=0.95,   # 去重阈值
    merge_threshold=0.92,       # 合并阈值
    decay_lambda=0.001,         # 衰减系数(每小时)
    forget_threshold=0.05,      # 遗忘阈值
    cleanup_interval=10,        # 每 N 次 recall 触发衰减检查
)
mem = Memory("my-agent", config=config, embedding_url="http://localhost:8001/v1")

License

Apache-2.0

Metadata

Release files for echon 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for echon 0.0.1
File Size Uploaded Provenance Actions
echon-0.0.1.tar.gz 378.0 kB Without provenance Details for echon-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for echon 0.0.1
File Interpreter ABI Platform Actions
echon-0.0.1-py3-none-any.whl Python 3 none any Details for echon-0.0.1-py3-none-any.whl

Total release size: 406.1 kB

Release files / echon-0.0.1.tar.gz

Download URL echon-0.0.1.tar.gz
Size 378.0 kB
Tags Source
SHA-256 checksum
How to use checksums
5a6fcb705a256e00ae28541de345e34f39c5cbc9799af8789f545dd777005e64
BLAKE2b-256 checksum
How to use checksums
db289fb99f110b65d107b602716a0d71295215fab523516b215290697fdb4493
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.2

Release files / echon-0.0.1-py3-none-any.whl

Download URL echon-0.0.1-py3-none-any.whl
Size 28.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ccccf4f31fc2093b119b3dc6ec537f6c16c944df12c095e1e4b470bdeebd3f21
BLAKE2b-256 checksum
How to use checksums
57cdcca030abf6751699547cad333485eb161f7ffcf4e593d078c8527e2a9aca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.2

Security for echon 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page