How thrishok/telegram-agent works
Telegram-agent is a Telegram webhook assistant: incoming messages are routed to either a vision path for photos or a LangGraph tool-using chat path for text, then replies are sent back through Telegram. The text agent can invoke web search and a placeholder document-search tool; photo analysis uses a separate vision model. Webhook registration and health endpoints support operation. The implementation is concentrated in main.py; relationships shown here are evidenced by its excerpt.
Main entry points: main.py Webhook handler
Components 12
Telegram Webhook
- Webhook handler
main.py - Reply sender
main.py - Webhook management
main.py
Text Agent
- LangGraph agent
main.py - Tool router
main.py - Web search
main.py - Document search stub
main.py
Photo Analysis
- Image analyzer
main.py
External Services
- Telegram API
- Groq chat model
- Tavily search
Other components
- Telegram user
Connections 14
- Telegram user → Webhook handler: sends update
main.py - Webhook handler → LangGraph agent: invokes text agent
main.py - LangGraph agent → Tool router: dispatches tools
main.py - Tool router → LangGraph agent: returns tool result
main.py - Tool router → Web search: runs search
main.py - Tool router → Document search stub: runs search
main.py - Web search → Tavily search: queries
main.py - LangGraph agent → Groq chat model: invokes model
main.py - Webhook handler → Image analyzer: routes photos
main.py - Image analyzer → Groq chat model: invokes vision model
main.py - Webhook handler → Telegram API: downloads photo
main.py - Reply sender → Telegram API: sends reply
main.py - Webhook handler → Reply sender: passes response
main.py - Webhook management → Telegram API: configures webhook
main.py