Inform Users with Tidy Messages
Human Toolkit is a Python class for AI assistants to send formatted messages to users, keeping them informed during multi-step workflows and long-running
Why it matters
This asset ensures clear and concise communication by sending well-formatted messages to users. It's designed to keep individuals informed about relevant information in a structured and easy-to-understand manner.
Outcomes
What it gets done
Send tidy messages to users.
Keep users informed about important updates.
Format information for clear user consumption.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/camel-humantoolkit | bash Capabilities
What this skill does
Sends alerts or messages via email, Slack, or other channels.
Pulls structured data fields from unstructured text.
Condenses long documents or threads into key takeaways.
Overview
Human Toolkit
What it does
Human Toolkit is a Python class within the CAMEL AI framework that enables AI assistants to send formatted messages to users. It provides a structured interface for agents to communicate progress, status updates, and intermediate results during task execution, ensuring users remain informed throughout multi-step workflows.
How it connects
Use Human Toolkit when your AI assistant performs multi-step tasks, long-running processes, or complex workflows where users benefit from progress updates and status messages. It is essential for scenarios where autonomous agents would otherwise operate silently, leaving users uncertain about what is happening.
Source code
import logging
from typing import List
from camel.toolkits.base import BaseToolkit
from camel.toolkits.function_tool import FunctionTool
logger = logging.getLogger(name)
class HumanToolkit(BaseToolkit):
r"""A class representing a toolkit for human interaction.
Note:
This toolkit should be called to send a tidy message to the user to
keep them informed.
"""
def ask_human_via_console(self, question: str) -> str:
r"""Use this tool to ask a question to the user when you are stuck,
need clarification, or require a decision to be made. This is a
two-way communication channel that will wait for the user's response.
You should use it to:
- Clarify ambiguous instructions or requirements.
- Request missing information that you cannot find (e.g., login
credentials, file paths).
- Ask for a decision when there are multiple viable options.
- Seek help when you encounter an error you cannot resolve on your own.
Args:
question (str): The question to ask the user.
Returns:
str: The user's response to the question.
"""
print(f"Question: {question}")
logger.info(f"Question: {question}")
reply = input("Your reply: ")
logger.info(f"User reply: {reply}")
return reply
def send_message_to_user(self, message: str) -> str:
r"""Use this tool to send a tidy message to the user in one short
sentence.
This one-way tool keeps the user informed about your progress,
decisions, or actions. It does not require a response.
You should use it to:
- Announce what you are about to do (e.g., "I will now search for
papers on GUI Agents.").
- Report the result of an action (e.g., "I have found 15 relevant
papers.").
- State a decision (e.g., "I will now analyze the top 10 papers.").
- Give a status update during a long-running task.
Args:
message (str): The tidy and informative message for the user.
Returns:
str: Confirmation that the message was successfully sent.
"""
print(f"\nAgent Message:\n{message}")
logger.info(f"\nAgent Message:\n{message}")
return f"Message successfully sent to user: '{message}'"
def get_tools(self) -> List[FunctionTool]:
r"""Returns a list of FunctionTool objects representing the
functions in the toolkit.
Returns:
List[FunctionTool]: A list of FunctionTool objects
representing the functions in the toolkit.
"""
return [
FunctionTool(self.ask_human_via_console),
FunctionTool(self.send_message_to_user),
]
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.