Card 2: Research desk, always on¶
The same desk, alive 24/7 in your Telegram. Card 1's agent is one of its tools.
LazyPulse keeps a lead agent running. Message your bot any question and get a cited answer back in the chat. Every weekday at 08:00 UTC it also sends you a morning brief on its own.
How it is built¶
- Import Card 1.
from research_desk import desk, sonnet, terra: the whole desk is one object, and it becomes a tool. - A
PulseAgentis anAgentthat never stops. Sameengine=andtools=, plus where work comes from (adapters=,calendar=) and who may ask (policy=). - Telegram in, Telegram out.
TelegramInboxpolls your bot and replies in the same chat;TelegramPolicylets only you talk to it. - A calendar.
Cron("morning", ...)fires a task on schedule;notify=Truesends the result to you.
The code¶
"""Card 2: the same research desk, always on, in your Telegram.
LazyPulse keeps a lead agent (Claude Code, Opus) running. Its tools are the
research desk from Card 1 plus the two specialists. Message your bot any
research question; every weekday at 08:00 UTC it also sends a morning brief.
export TELEGRAM_TOKEN=123456:ABC... # from @BotFather
export TELEGRAM_OWNER_ID=123456789 # your numeric Telegram id
python research_desk_pulse.py
"""
import os
from lazypulse import Calendar, Cron, PulseAgent
from lazypulse.adapters.telegram import TelegramInbox, TelegramInboxConfig, TelegramPolicy
from lazytools.connectors.telegram import TelegramClient
from research_desk import desk, sonnet, terra
from lazybridge import ClaudeCodeEngine, Store
# Prompts
LEAD = (
"You are an always-on research assistant. For a research question call "
"research_desk. For a quick lookup call deep_research or fact_check. "
"Reply in a few lines, with sources."
)
MORNING = "Brief me on the most important AI developer-tools news of the last 24 hours."
# Telegram: only the owner can talk to the bot
owner = int(os.environ["TELEGRAM_OWNER_ID"])
telegram = TelegramClient.from_token(os.environ["TELEGRAM_TOKEN"])
# Lead: Card 1's desk and the two specialists are all tools
pulse = PulseAgent(
name="research_pulse",
engine=ClaudeCodeEngine(model="opus", system=LEAD, web=False),
tools=[desk, sonnet, terra],
store=Store(db="research_pulse.db"),
adapters=[TelegramInbox(telegram, TelegramInboxConfig(bot_id="research_pulse"))],
policy=TelegramPolicy(owner_ids=[owner]),
calendar=Calendar([Cron("morning", MORNING, "0 8 * * MON-FRI", notify=True)]),
scheduled_responder=lambda text, *_: telegram.send_message(chat_id=owner, text=text[:4000]),
max_concurrent_inbound=1,
)
if __name__ == "__main__":
print("Always on. Message your bot; Ctrl-C to stop.")
pulse.serve()
Run it¶
- Create the bot and find your owner id: see Set up the Telegram bot.
- Start it:
export TELEGRAM_TOKEN=123456:ABC...
export TELEGRAM_OWNER_ID=123456789
python research_desk_pulse.py
It runs in the foreground; stop it with Ctrl-C.