import asyncio
from conversimple import ConversimpleAgent, tool
class MyAgent(ConversimpleAgent):
@tool("Get current weather for a location")
def get_weather(self, location: str) -> dict:
return {"location": location, "temperature": 72, "condition": "sunny"}
def on_conversation_started(self, conversation_id: str):
print(f"Conversation started: {conversation_id}")
async def main():
agent = MyAgent(
api_key="your-api-key",
customer_id="your-customer-id"
)
await agent.start()
# Keep running
while True:
await asyncio.sleep(1)
if __name__ == "__main__":
asyncio.run(main())