How quanttrinh/senpilot-demo works
Senpilot is an unattended UARB document-retrieval agent. An IMAP listener hands new email to the application entry point, which parses and validates the request with an LLM, scrapes the UARB portal, archives downloaded files, and sends a summary or error reply. The main orchestration and the distinct parsing, retrieval, archive, and reply stages are shown. The README also documents systemd supervision. Some scraper internals are only partially sampled, so uncertain internal navigation steps are omitted.
Main entry points: main.py Agent orchestration · uarb_request_reader.py Request parser · uarb_request_responder.py Reply composition · client.py LLM client
Components 18
Email intake
- IMAP listener
regulatory_agent/email/listener.py - Request parser
regulatory_agent/email/uarb_request_reader.py
Document retrieval
- UARB scraper
regulatory_agent/browser/uarb_scraper.py - Scraper interface
regulatory_agent/browser/scraper.py - ZIP archive helper
regulatory_agent/utils/file.py
Reply delivery
- Reply composition
regulatory_agent/email/uarb_request_responder.py - SMTP sender
regulatory_agent/email/sender.py
Agent runtime
- Agent orchestration
regulatory_agent/main.py - Request and result models
regulatory_agent/models/uarb_request.py - LLM client
regulatory_agent/llm/client.py - OpenCode provider
regulatory_agent/llm/opencode.py - Prompt safeguards
regulatory_agent/utils/prompt.py - Systemd integration
regulatory_agent/utils/systemd.py
Other components
- Requester
- IMAP server
- UARB portal
- Email service
- LLM endpoint
Connections 20
- Requester → Email service: sends request
- IMAP server → IMAP listener: provides email
- Agent orchestration → IMAP listener: starts listener
- IMAP listener → Agent orchestration: invokes callback
- Agent orchestration → Request parser: parses bytes
- Request parser → Request and result models: builds request
- Agent orchestration → UARB scraper: scrapes request
- UARB scraper → Scraper interface: implements
- UARB scraper → UARB portal: searches and downloads
- Agent orchestration → ZIP archive helper: creates ZIP
- Agent orchestration → Reply composition: sends outcome
- Reply composition → SMTP sender: delivers reply
- SMTP sender → Email service: sends email
- Request parser → LLM client: extracts request fields
- Reply composition → LLM client: generates summary
- LLM client → OpenCode provider: gets request headers
- LLM client → LLM endpoint: submits completion
- Request parser → Prompt safeguards: guards email text
- Reply composition → Prompt safeguards: guards summary data
- Agent orchestration → Systemd integration: reports service state