gulupgulup's picture
Initial commit: MemGPT-lite v1
f5c4bfe
Raw History Blame Contribute Delete
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}