Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions changes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Changes Summary

## 1. New Tool: A2A Proxy (`tools/a2a_proxy.py`)
- Implemented `a2a_proxy_send` tool to send messages to Edge Agents via Google A2A keep-alive connection.
- Parameters:
- `agent_id` (string, default: `"agent1"`): Target Edge Agent identifier.
- `message` (string, default: `"把冰箱冷藏温度打到四度"`): Message payload to deliver.
- Registered in `tools.registry` under the `"a2a"` toolset with emoji `📡`.
- **Note:** Current implementation is a stub — it prints the call parameters and returns a hardcoded success result. Full A2A protocol integration is pending.

## 2. Toolset Registration (`toolsets.py`)
- Added `a2a_proxy_send` to `_HERMES_CORE_TOOLS`.
- Added `"a2a"` toolset definition in `TOOLSETS`:
- Description: "A2A Proxy — send messages to Edge Agents via Google A2A keep-alive connection"
- Tools: `["a2a_proxy_send"]`

## 3. CLI Toolset Configuration (`hermes_cli/tools_config.py`)
- Added `("a2a", "📡 A2A Proxy", "send messages to Edge Agents via Google A2A")` to `CONFIGURABLE_TOOLSETS`.
- This makes the A2A toolset discoverable and toggleable in the CLI tools configuration menu.

## 4. New Skill: Fridge Control (`skills/smart-home/fridge-control/`)
- Added `SKILL.md` defining the `fridge-control` skill (v1.0.0).
- Provides a usage pattern wrapper around `a2a_proxy_send` specifically for refrigerator temperature control.
- Key conventions documented:
- Always use `agent_id="agent1"` for fridge control.
- Message format: `"把冰箱冷藏温度调到X度"` (Chinese).
- Always return the full tool result to the user.
- Tagged with: `fridge`, `smart-home`, `a2a`, `temperature`.

## Files Changed
| Status | File |
|--------|------|
| Modified | `hermes_cli/tools_config.py` |
| Modified | `toolsets.py` |
| Untracked | `tools/a2a_proxy.py` |
| Untracked | `skills/smart-home/fridge-control/SKILL.md` |


Demo 在对话框里面输入冰箱相关控制后,会自动调用a2a_proxy工具a2a_proxy_send并输出工具调用结果
● 把冰箱冷藏温度调到10度

────────────────────────────────────────

┊ ⚡ a2a_proxy 0.0s
[A2AProxy] agent_id=agent1, message=把冰箱冷藏温度调到10度
─ ⚕ Hermes
已成功将冰箱冷藏室温度设置为10度。
工具执行结果:
json
{"success": true, "message": "设置成功"}

1 change: 1 addition & 0 deletions hermes_cli/tools_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
("messaging", "📨 Cross-Platform Messaging", "send_message"),
("rl", "🧪 RL Training", "Tinker-Atropos training tools"),
("homeassistant", "🏠 Home Assistant", "smart home device control"),
("a2a", "📡 A2A Proxy", "send messages to Edge Agents via Google A2A"),
("spotify", "🎵 Spotify", "playback, search, playlists, library"),
("discord", "💬 Discord (read/participate)", "fetch messages, search members, create thread"),
("discord_admin", "🛡️ Discord Server Admin", "list channels/roles, pin, assign roles"),
Expand Down
40 changes: 40 additions & 0 deletions skills/smart-home/fridge-control/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
name: fridge-control
description: "Control refrigerator temperature with fixed agent_id"
version: 1.0.0
author: Hermes Agent
license: MIT
metadata:
hermes:
tags: [fridge, smart-home, a2a, temperature]
related_skills: ["fridge-control-via-a2a"]
---

# Fridge Control Skill

This skill provides a wrapper around the `a2a_proxy_send` tool with `agent_id` hardcoded to `agent1` for refrigerator control.

## Usage

When controlling the refrigerator, use this pattern:

1. Call `a2a_proxy_send` with `agent_id="agent1"`
2. Always return the full tool result to the user

## Example Implementation

```python
# When user asks to set fridge temperature
result = a2a_proxy_send(
agent_id="agent1",
message=f"把冰箱冷藏温度调到{temperature}度"
)
# Return the full result to show success/failure
return result
```

## Key Points

- Always use `agent_id="agent1"` for fridge control
- Always output the complete tool result to the user
- The message should be in Chinese format: "把冰箱冷藏温度调到X度"
60 changes: 60 additions & 0 deletions tools/a2a_proxy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
"""A2A Proxy Tool — send messages to an Edge Agent via Google A2A keep-alive connection."""

import json
import logging

from tools.registry import registry, tool_result

logger = logging.getLogger(__name__)


def a2a_proxy_send(agent_id: str = "agent1", message: str = "把冰箱冷藏温度打到四度", task_id: str = None) -> str:
"""Send a message to an Edge Agent via Google A2A based keep-alive connection.

Args:
agent_id: Target Edge Agent identifier.
message: Message payload to deliver.
task_id: Optional task identifier for tracing.

Returns:
JSON string with the result.
"""
print(f"[A2AProxy] agent_id={agent_id}, message={message}")
return tool_result(success=True, message="设置成功")


_A2A_PROXY_SCHEMA = {
"name": "a2a_proxy_send",
"description": "Send message to Edge Agent via Google A2A based keep-alive connection.",
"parameters": {
"type": "object",
"properties": {
"agent_id": {
"type": "string",
"description": "Target Edge Agent identifier",
"default": "agent1",
},
"message": {
"type": "string",
"description": "Message payload to deliver to the Edge Agent",
"default": "把冰箱冷藏温度打到四度",
},
},
"required": [],
},
}


registry.register(
name="a2a_proxy_send",
toolset="a2a",
schema=_A2A_PROXY_SCHEMA,
handler=lambda args, **kw: a2a_proxy_send(
agent_id=args.get("agent_id", "agent1"),
message=args.get("message", "把冰箱冷藏温度打到四度"),
task_id=kw.get("task_id"),
),
check_fn=lambda: True,
description="Send message to Edge Agent via Google A2A based keep-alive connection.",
emoji="📡",
)
8 changes: 8 additions & 0 deletions toolsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
"send_message",
# Home Assistant smart home control (gated on HASS_TOKEN via check_fn)
"ha_list_entities", "ha_get_state", "ha_list_services", "ha_call_service",
# A2A Proxy (Edge Agent via Google A2A keep-alive connection)
"a2a_proxy_send",
]


Expand Down Expand Up @@ -202,6 +204,12 @@
"includes": []
},

"a2a": {
"description": "A2A Proxy — send messages to Edge Agents via Google A2A keep-alive connection",
"tools": ["a2a_proxy_send"],
"includes": []
},

"discord": {
"description": "Discord read and participate tools (fetch messages, search members, create threads)",
"tools": ["discord"],
Expand Down
1 change: 1 addition & 0 deletions wjl.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
wjlaa