Connect AgentMail to a Proxidize Price Monitor
This integration gives a price-monitoring worker a dedicated email inbox. Proxidize Residential Proxies route the approved product-page request; AgentMail handles the alert and the operator's reply. AgentMail does not proxy the collection request, and Proxidize does not send the email.
AgentMail inboxes can send and receive messages, keep replies in threads, and use idempotency keys for safe send retries. The tested example combines those AgentMail inbox capabilities with deterministic price extraction, SQLite state, and a Proxidize access point.
Keep both services' credentials outside source code:
An inbox-scoped AgentMail key is the least-privilege option. The example calls auth.me() to discover the inbox assigned to that key. An organization- or pod-scoped key can instead create or reuse an inbox through a stable client ID.
Install and Run the Deterministic Test
The repository uses Python 3.11.5, AgentMail 2.0.26, HTTPX 0.28.1, uv, and a committed lockfile. From the repository root:
Establish a baseline without a network request or email:
Run the second fixture to confirm that the worker detects a price change:
The first valid observation becomes the baseline. The second fixture records a different price. Remove --no-email only after the operator address and AgentMail inbox are correct.
Check an Authorized Page Through Proxidize
Set PRICE_MONITOR_URL to one page that the organization is permitted to monitor, then run the ordinary check command:
The HTTPX client sends that page request through the selected Proxidize Residential Proxy access point. The extractor accepts one unambiguous Product JSON-LD offer, product-price meta tags, or explicit data-price and data-currency attributes. It rejects missing, invalid, or conflicting prices rather than turning uncertain markup into a false alert.
Use residential proxies when the permitted monitoring job needs geographic coverage or a larger pool of real residential exits. Use a US mobile access point only when the approved test specifically requires mobile-network identity. The proxy is the network route; it does not parse the page or grant permission to collect it.
Send One Alert and Process Bounded Replies
When a confirmed value changes, the worker creates a stable event ID from the product, previous observation, and current observation. It reserves that event locally and passes the same value as AgentMail's idempotency key. A retry therefore does not intentionally create a second alert.
The alert includes the previous price, current price, percentage change, and source URL. Replies remain in the same AgentMail thread. The command handler accepts only four exact commands from one authorized operator:
- check now
- show history
- mute 24h
- help
It does not accept a target URL from email, execute free-form instructions, run shell commands, or purchase a product. Unknown text receives the help response, and processed message IDs are recorded to suppress duplicate work.
Choose Sessions and Production Event Handling
Use a sticky proxy session when related requests must observe one temporary network identity, such as a small multi-page product flow. Rotate at an intentional job boundary for independent observations. Keep cookies, cached data, and application state aligned with the selected proxy session.
The included process-inbox command performs one bounded poll and is suitable for a simple scheduled worker. For lower latency, send signed webhook or polling-webhook events into the same command-processing function. Verify event authenticity before trusting a message ID, sender, or extracted reply text.
Use a managed database and a queue when multiple workers can check the same product or mailbox. Keep destination-aware pacing, explicit timeouts, response-size limits, bounded retries, and per-target concurrency controls independent from proxy rotation.
Troubleshoot and Review the Production Checklist
- No alert on the first run: expected; the first confirmed observation establishes the baseline.
- Authentication error: verify the AgentMail key scope and the Proxidize endpoint, username, and password separately.
- No inbox available: set AGENTMAIL_INBOX_ID, use an inbox-scoped key, or allow a broader key to create the stable client-ID inbox.
- Duplicate-looking alerts: confirm that workers share the same durable alert ledger and event-ID inputs.
- Price extraction failure: inspect the target's structured data and add a target-specific extractor instead of weakening validation.
- Unexpected reply behavior: verify the sender allowlist, exact command parser, message-ID deduplication, and webhook signature check.
Before deployment, rotate any key exposed in chat, screenshots, logs, or shell history. Keep live credentials in a secret store, use the narrowest AgentMail scope available, redact proxy configuration from exceptions, and send alerts only to recipients who expect them. Monitor only authorized pages and follow applicable laws, third-party terms, and destination rules.