from droidrun.agent.droid import DroidAgent
from droidrun.config_manager.config_manager import DroidrunConfig
def send_notification(title: str, *, tools=None, shared_state=None, **kwargs):
"""Send a notification using channel from custom variables.
Args:
title: Notification title
tools: Tools instance (optional, injected automatically)
shared_state: DroidAgentState (optional, injected automatically)
"""
if not shared_state:
return "Error: shared_state required"
# Access custom variables
channel = shared_state.custom_variables.get("notification_channel", "default")
return f"Sent '{title}' to {channel}"
custom_tools = {
"send_notification": {
"arguments": ["title"],
"description": "Send a notification with title. Usage: {\"action\": \"send_notification\", \"title\": \"Alert\"}",
"function": send_notification
}
}
config = DroidrunConfig()
agent = DroidAgent(
goal="Send notification with title 'Alert'",
config=config,
custom_tools=custom_tools,
variables={"notification_channel": "alerts"}
)