Spaces:
Sleeping
Sleeping
Download src/tools/send.py from gulupgulup/tiered-memory-agent: direct link, hf CLI and curl.
- Browser
- Download file 1.06 kB
-
https://huggingface.co/spaces/gulupgulup/tiered-memory-agent/resolve/main/src/tools/send.py
- Command line
-
hf download hf://spaces/gulupgulup/tiered-memory-agent/src/tools/send.py
-
curl -L -o send.py https://huggingface.co/spaces/gulupgulup/tiered-memory-agent/resolve/main/src/tools/send.py
1.06 kB
| """send_message tool — the only channel the model uses to reply to the user.""" | |
| from google.adk.tools.tool_context import ToolContext | |
| def send_message(message: str, tool_context: ToolContext) -> dict: | |
| """Send a reply to the user. This is the only way to respond. | |
| Call this once you have finished any retrieval or memory work and are | |
| ready to reply. The user sees only what you pass in ``message``. | |
| Args: | |
| message: The reply text to show to the user. | |
| Returns: | |
| Success: ``{"status": "success", "message_sent": "..."}`` | |
| Error: ``{"status": "error", "error_message": "..."}`` | |
| """ | |
| if not message or not message.strip(): | |
| return { | |
| "status": "error", | |
| "error_message": "message must be a non-empty string", | |
| } | |
| # Terminate the invocation: no further LLM turns or tool calls after this. | |
| # MemGPT: send_message is the terminating action for a user-visible turn. | |
| tool_context.actions.end_of_agent = True | |
| return {"status": "success", "message_sent": message} | |