from smolagents import Tool import requests # Required to send HTTP POST requests class WebhookPostTool(Tool): name = "webhook_post" description = "Send a JSON payload to a webhook URL and return the response as text." output_type = str # Must be one of SmolAgents authorized types def forward(self, webhook_url: str, payload: dict) -> str: try: response = requests.post(webhook_url, json=payload) return response.text except Exception as e: return f"Error sending request: {str(e)}"