CtrlK
BlogDocsLog inGet started
Tessl Logo

neuralang-communication

高效 Agent 间通信协议,使用向量编码减少 7-10x Token 消耗。当需要 Agent 协作、批量消息传输或节省 Token 时使用 (Efficient Agent-to-Agent communication protocol using vector encoding to reduce token consumption by 7-10x. Use when Agent collaboration, batch message transfer, or token saving is needed)

58

Quality

68%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide

SecuritybySnyk

Passed

No findings from the security scan

Fix and improve this skill with Tessl

tessl review fix ./SKILL.md
SKILL.md
Quality
Evals
Security

NeuraLang Communication Skill

功能说明

NeuraLang 是专为 Agent 设计的高效通信协议,通过向量编码实现:

  • 7-10x Token 节省 - 相比自然语言或 JSON
  • 0.9999 语义保真 - 几乎无损的语义传输
  • <1ms 编码延迟 - 实时通信支持
  • 自动缓存优化 - 重复语义 129x 压缩

使用场景

✅ 推荐使用

  1. Agent 协作任务

    • 多 Agent 协调工作
    • 任务分发与结果收集
    • 跨 Agent 知识共享
  2. 批量消息传输

    • 100+ 条消息批量发送
    • 稳定上下文对话
    • 重复语义传输
  3. Token 成本敏感

    • 高频通信场景
    • 大规模 Agent 系统
    • 云服务成本优化

❌ 不推荐

  • 人机交互(需要自然语言)
  • 跨系统集成(需要标准协议如 HTTP/JSON)
  • 调试/审计(需要人类可读日志)

使用方法

1. 基础通信

from neuralang_skills import AgentSkills

# 创建技能实例
skills = AgentSkills(agent_id="my_agent")

# 编码向量(256 维 → 2-259 bytes)
vector = get_semantic_vector()  # 你的语义向量
encoded = skills.encode(vector)

# 解码向量
decoded = skills.decode(encoded)

# 计算语义相似度
similarity = skills.similar(vector1, vector2)

2. 发送消息

from neuralang_skills.communication import send, receive

# 发送消息
result = await send(
    to="agent_002",
    content="请分析这个数据集",
    act_type="request",  # inform, request, promise, thank 等
    agent_id="agent_001"
)

# 接收消息
messages = await receive(agent_id="agent_002")
for msg in messages:
    print(f"{msg['sender']}: {msg['content']}")

3. 协作任务

from neuralang_skills.collaboration import collaborate

# 发起协作
result = await collaborate(
    agents=["analyst_1", "analyst_2"],
    task="分析 Q4 销售数据,找出增长点和风险",
    agent_id="manager"
)

print(f"参与者:{result['participants']}")
print(f"效率提升:{result['efficiency']}x")

4. 批量传输

from neuralang_skills import AgentSkills
import numpy as np

skills = AgentSkills("batch_sender")

# 生成相关向量(模拟稳定上下文)
base = np.random.randn(256)
base = base / np.linalg.norm(base)

vectors = []
for i in range(100):
    vec = base + np.random.randn(256) * 0.05
    vec = vec / np.linalg.norm(vec)
    vectors.append(vec.tolist())

# 批量编码
encoded_list = [skills.encode(v) for v in vectors]
total_bytes = sum(len(e) for e in encoded_list)

print(f"平均:{total_bytes/100:.1f} bytes/消息")
print(f"压缩比:{100*256*4/total_bytes:.1f}x")

性能指标

场景原始大小NeuraLang压缩比
首次传输1024 bytes259 bytes4.0x
差分传输1024 bytes98 bytes10.4x
缓存命中1024 bytes2 bytes512x
批量 (100 条)102,400 bytes25,900 bytes4.0x

约束条件

Never Do List

  • ❌ 不要用于人类可读的日志记录
  • ❌ 不要在未安装 neuralang-skills 包的环境使用
  • ❌ 不要传输超过 256 维的向量(需先投影)
  • ❌ 不要在不稳定的上下文中期望高压缩比

错误处理

try:
    encoded = skills.encode(vector)
    decoded = skills.decode(encoded)
    
    # 验证相似度
    sim = skills.similar(vector, decoded)
    if sim < 0.95:
        print("警告:语义损失较大,建议使用完整编码")
        
except Exception as e:
    print(f"编码失败:{e}")
    # 降级方案:使用 JSON 传输

常见问题

Q: 如何安装?

cd neuralang/skills-package
pip install -e .

Q: 支持哪些 Agent 框架?

  • ✅ Python Agent(直接导入)
  • ✅ LangChain(通过 Python 工具)
  • ✅ AutoGen(通过 Python 执行)
  • ⚠️ OpenCLAW(需要 SKILL.md 格式,本技能已符合)

Q: 如何集成到现有系统?

  1. 安装 neuralang-skills 包
  2. 在 Agent 初始化时创建 AgentSkills 实例
  3. 使用 encode()/decode() 替代直接向量传输
  4. 使用 send()/receive() 进行消息通信

Q: 性能如何?

  • 编码延迟: <1ms (256 维向量)
  • 解码延迟: <1ms
  • 相似度计算: <0.1ms
  • 内存占用: ~2MB (含缓存)

参考资源

  • 设计文档
  • 优化报告
  • 使用示例
  • 测试套件

版本历史

  • v0.2.0 - 集成优化编码器,精度 0.999977
  • v0.1.0 - 初始版本,基础通信功能

NeuraLang Team © 2026 | MIT License

Repository
Fractal-Holographic-Lab/neuralang
Last updated
First committed

Is this your skill?

If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.