高效 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
68%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Fix and improve this skill with Tessl
tessl review fix ./SKILL.mdNeuraLang 是专为 Agent 设计的高效通信协议,通过向量编码实现:
Agent 协作任务
批量消息传输
Token 成本敏感
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)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']}")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")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 bytes | 259 bytes | 4.0x |
| 差分传输 | 1024 bytes | 98 bytes | 10.4x |
| 缓存命中 | 1024 bytes | 2 bytes | 512x |
| 批量 (100 条) | 102,400 bytes | 25,900 bytes | 4.0x |
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 传输cd neuralang/skills-package
pip install -e .AgentSkills 实例encode()/decode() 替代直接向量传输send()/receive() 进行消息通信NeuraLang Team © 2026 | MIT License
SKILL.md
1101631
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.