I did not set out to build an AI agent that would tell me what stocks to buy.
What I wanted was much more practical: a self-hosted service that could monitor the stocks I already follow, evaluate them against rules I define, notify me when something meaningful changes, and help me understand what deserves a closer look.
That became my Stock Alert Agent, a containerized Python and FastAPI service running in my homelab. It collects market data, calculates technical indicators, applies portfolio-aware rules, and exposes the results through an authenticated API.
The service did what I originally built it to do: monitor my portfolios and alert me when something meaningful changed or crossed a configured threshold. But over time, I wanted more than alerts. I wanted to ask questions through Discord, understand why a signal had changed, research relevant developments, and receive scheduled portfolio reviews. That is where Hermes became useful.
Instead of turning Hermes into the stock system, I integrated it with the service I had already built.
Each portfolio is represented by a YAML configuration. It can include the stocks being monitored, approximate allocation and cost basis, the reason for holding or watching each position, and the thresholds or rules that matter to me.
For every ticker, the service can evaluate information such as:
Current price and daily movement
Gain or loss relative to cost basis
50-day and 200-day moving averages
Relative Strength Index (RSI)
Position concentration
Stock-specific price, RSI, gain/loss, and score thresholds
The rule engine then produces review signals such as BUY REVIEW, HOLD / WATCH, SELL REVIEW, or URGENT REVIEW.
The wording is deliberate. These are prompts to review a position, not automated trading instructions. The service does not connect to a brokerage and cannot place a trade.
The project supports multiple configuration profiles, allowing separate portfolios or investment accounts to keep their own holdings, strategies, thresholds, and rules. The application reloads those configurations for each API request, so a threshold can be updated without rebuilding the image.
Hermes is the agent and orchestration layer in this setup. I created a dedicated stocks skill within my personal Hermes profile and gave it access to the stock service through its API.
That allows me to use Discord as the interface. I can ask a natural question such as:
How is Snowflake doing?
Hermes can retrieve the configured position context and the latest analysis from the stock service, then research material developments and explain what may deserve attention. It does not invent a new holding, cost basis, allocation, or signal; the backend remains authoritative for those values.
The same separation applies to scheduled work. Hermes can orchestrate portfolio reviews and add research when reasoning is useful. For frequent threshold monitoring, however, no language model is needed at all.
One of the easiest ways to build an “AI stock agent” would have been to send market data to a model and ask whether a stock looked like a buy or sell.
I intentionally chose a different approach.
The calculations and signal decisions are deterministic. The same data and rules should produce the same result. Holdings, cost basis, allocation, thresholds, technical indicators, and alert state remain authoritative in the stock service.
AI can still add value, but in a role that suits it better: explaining the output, researching relevant developments, and turning structured results into a useful conversation.
This also makes the system easier to inspect. If a signal changes, I can trace it back to a rule or a data point instead of wondering how a model interpreted an open-ended prompt.
The production monitor runs through Hermes every ten minutes in script-only, or “no-agent,” mode.
On each run:
Hermes calls the stock service with AI summaries and direct backend Discord delivery disabled.
The stock service fetches current data, evaluates the configured rules, and returns any sendable alert events.
If nothing crossed a threshold, the job remains silent.
If an event is waiting, the Hermes helper sends the alert through the Hermes Discord bot.
Only after Discord returns a message ID does the helper acknowledge that exact event with the stock service.
This keeps a repetitive, deterministic task out of the agent loop. It uses no model call when all the system needs to know is whether a configured boundary was crossed.
It also makes delivery more reliable. Detecting an event and delivering it are separate operations. If Discord delivery fails, the event remains pending and can be retried on the next run.
A simple condition such as “price is above $X” sounds easy until it runs every ten minutes. Without state, the service could send the same message repeatedly for as long as the price remained above the threshold.
The stock service therefore distinguishes a condition from a transition.
It records which side of a price boundary was last observed and creates an event only when the price crosses from one side to the other. Each crossing has a generation-specific event ID. Hermes acknowledges that exact event only after successful delivery.
This detail matters because a delayed acknowledgement should never clear a newer transition. Persisted state also means a pending alert survives container recreation instead of disappearing with the process that detected it.
For other alert types, such as RSI or gain/loss thresholds, the service can apply cooldown behavior to reduce repeated notifications.
The integration is intentionally narrow.
Operational API endpoints require an X-API-Key header.
Secrets are stored in the Hermes personal profile environment, not in the skill or documentation.
Portfolio configuration is mounted read-only inside the stock container.
Only the alert-state directory needs write access.
The frequent monitor asks the backend not to generate an AI summary and not to send its own Discord webhook.
Hermes receives structured research and alerting data, but no brokerage credentials or trade-execution capability exist in the workflow.
This is not a trading bot. It is a research and review system designed to bring relevant changes to my attention.
The stock service is good at repeatable calculations, stored state, and enforcing rules. Hermes is good at natural-language interaction, orchestration, research, and presenting information in context.
Combining them lets each component do the work it is best suited for:
Responsibility Authoritative component
Holdings, cost basis, allocation, and strategy Stock Alert Agent
Market data, indicators, scoring, and signals Stock Alert Agent
Threshold and crossing state Stock Alert Agent
Scheduled execution Hermes
Discord interaction and delivery Hermes
Additional research and plain-language explanation Hermes
Investment decisions and trade execution Me
That final row is the most important one.
The most useful lesson from this project was that adding an agent does not mean moving every responsibility into the agent.
A stronger architecture emerged when I treated Hermes as an orchestration and reasoning layer around a small, purpose-built service. The service remains testable and deterministic. Hermes makes it accessible and capable of richer workflows.
I also learned that reliable notifications require more than a scheduler and a webhook. A real alert workflow needs persistent state, retry behavior, and delivery acknowledgement. Otherwise, the system can lose an event, repeat it indefinitely, or mark it handled before anyone actually received it.
The current integration handles conversational stock analysis, scheduled reviews, and ten-minute threshold monitoring through Discord.
The next planned evolution is a richer Saturday portfolio review. Hermes will use the stock service as the authoritative snapshot, research what materially affected the holdings during the week, and prioritize the positions that deserve attention. To make week-over-week comparisons precise, I plan to persist portfolio snapshots rather than asking the language model to reconstruct history.
The goal remains the same: improve awareness and research without pretending that an AI agent should make the investment decision.
This project is for personal research and alerting. It is not financial advice, and it does not place trades automatically.