Warren Buffett AI Stock Picker¶
This bot picks stocks the way Warren Buffett describes in his Berkshire Hathaway letters: buy wonderful businesses at fair prices and hold them for a long time. Why copy that? From 1965 through 2025, Berkshire’s stock grew 19.7% a year, versus 10.5% for the S&P 500 (Berkshire 2025 letter).
How it works¶
Research agent reads each company’s latest financial reports and checks its price today. It picks the 3 to 5 companies with the best mix of steady profits, a lasting edge over rivals, and a fair price.
Skeptic agent, like Buffett’s partner Charlie Munger, attacks each pick: a price that is too high, a shrinking edge, too much debt, or numbers that do not add up. It keeps only the picks that survive.
Trading agent owns the survivors, split about evenly. It holds for the long run and only sells when the skeptic drops a stock because the business got worse or the price got far too high.
Change universe to pick from different companies.
Run it on BotSpot¶
Run this bot on BotSpot without installing anything. BotSpot runs LumiBot in the cloud, backtests it, and connects it to your broker.
Backtest tear sheet¶
GPT-6 Luna, January 5 to 16, 2026, Yahoo daily prices and company reports, $100,000 start. After the skeptic’s review the bot bought AXP, GOOGL, KO, and PG and held them, ending at $101,660 (+1.7%) while SPY rose 1%. Cash never went below $5,145.
Open the full tear sheet. A short backtest shows the bot works as written. It is not a promise of future returns.
The code¶
The whole bot is one short file. The prompts are plain English, and they are the strategy.
"""Warren Buffett AI Stock Picker.
Invests the way Warren Buffett describes in his Berkshire Hathaway letters: buy
great businesses at fair prices and hold them. A research agent reads each
company's reports and picks the best mix of quality and price. A skeptic agent,
like Charlie Munger, attacks each pick. A trading agent owns what survives.
Not affiliated with or endorsed by Warren Buffett or Berkshire Hathaway.
"""
from lumibot.strategies import Strategy
class AITradingTeamWarrenBuffettValueStrategy(Strategy):
parameters = {"universe": ["AAPL", "MSFT", "GOOGL", "COST", "V", "MA", "KO", "AXP", "JPM", "PG"]}
def initialize(self):
self.sleeptime = "1D"
self.agents.create(
name="researcher",
allow_trading=False,
system_prompt=(
"Read each company's latest financial reports and check its stock price today. Pick the 3 to "
"5 companies with the best mix of steady profits, a lasting edge over rivals, and a fair "
"price. Do not trade."
),
)
self.agents.create(
name="skeptic",
allow_trading=False,
system_prompt=(
"You are a skeptic like Charlie Munger. Attack each pick: is the price too high, is the edge "
"shrinking, is there too much debt? Keep only the picks that survive. Do not trade."
),
)
self.agents.create(
name="trader",
allow_trading=True,
system_prompt=(
"Own the picks the skeptic kept, split about evenly. Hold for the long run and ignore small "
"price moves. Sell a stock only when the skeptic drops it."
),
)
def on_trading_iteration(self):
facts = {"universe": self.parameters["universe"]}
research = self.agents["researcher"].run(task_prompt="Pick the best companies.", context=facts)
review = self.agents["skeptic"].run(
task_prompt="Attack each pick.", context={**facts, "research": research.summary}
)
self.agents["trader"].run(
task_prompt="Own the picks that survived.", context={**facts, "skeptic": review.summary}
)
if __name__ == "__main__":
from lumibot.credentials import IS_BACKTESTING
if IS_BACKTESTING:
from lumibot.backtesting import YahooDataBacktesting
AITradingTeamWarrenBuffettValueStrategy.backtest(YahooDataBacktesting)
else:
AITradingTeamWarrenBuffettValueStrategy().run_live()
Run it yourself¶
pip install lumibot
python -m lumibot.example_strategies.ai_trading_team_warren_buffett_value
Put these in your .env file: OPENAI_API_KEY, and your broker keys (for example ALPACA_API_KEY, ALPACA_API_SECRET, and ALPACA_IS_PAPER=true for paper trading). With IS_BACKTESTING=false the bot trades. With IS_BACKTESTING=true it backtests instead; set BACKTESTING_START and BACKTESTING_END to pick the dates, and start with a week or two, because every AI call costs a little.
Good to know¶
Inspired by Warren Buffett’s public shareholder letters. Not affiliated with or endorsed by Warren Buffett or Berkshire Hathaway.
See AI Trading Bot Examples for more AI trading bots and Backtest, paper, or live: choose the runner for backtest and live runs.