import asyncio
import os
from definable.agent import Agent
from definable.agent.interface import TelegramInterface
from definable.memory import Memory, SQLiteStore
from definable.tool.decorator import tool
@tool
def get_weather(city: str) -> str:
"""Get the current weather for a city."""
return f"Sunny, 24C in {city}"
agent = Agent(
model="gpt-4o",
instructions="You are a helpful Telegram assistant with weather tools.",
tools=[get_weather],
memory=Memory(store=SQLiteStore("./telegram_memory.db")),
audio_transcriber=True, # Transcribe voice notes via Whisper
)
interface = TelegramInterface(
agent=agent,
bot_token=os.environ["TELEGRAM_BOT_TOKEN"],
)
asyncio.run(interface.serve_forever())