{"slug": "i-built-an-ai-agent-that-gets-curious-on-its-own", "title": "I Built an AI Agent That Gets Curious On Its Own", "summary": "A developer built an AI agent using active inference that becomes curious on its own by minimizing surprise rather than chasing rewards. On a foraging task, the agent achieved 100% success by checking a hint before acting, compared to 48% for a reward-chasing agent. The approach, inspired by brain science, yields curiosity for free and handles surprises without explicit exploration bonuses.", "body_md": "*Active inference: curiosity emerges for free from minimizing surprise — 48% vs 100% on a foraging task.*\n\n**TL;DR:** Most AI agents chase rewards — they pick whatever action scores the most points. I tried a different, brain-inspired goal: avoid *surprises*. Something neat happened — the agent became **curious without being told to.** It goes looking for information before acting, and that takes it from 48% to 100% on a simple task. ~100 lines.\n\nMost AI agents are \"reward chasers.\" Give them points for doing well, and they'll pick whatever action they expect to score highest. Simple and effective.\n\nThere's another idea from brain science: instead of chasing points, **try to avoid being surprised** — act so the world matches what you expected. It sounds almost too simple, but it leads to a surprising bonus: **when you're trying not to be surprised, going and finding out what you don't know becomes valuable all by itself.** In other words, curiosity isn't something you have to bolt on. It comes for free.\n\nThis is called *active inference*, and in 2026 it jumped from neuroscience into AI as a serious approach ([here's a 2026 paper](https://arxiv.org/abs/2606.22813)). Here's the smallest demo that makes it click.\n\nThe task: a reward is hidden behind either the **LEFT** door or the **RIGHT** door (50/50). There's also a **hint** you can check that tells you which door — *if you bother to look.*\n\n| ❌ Reward-chaser | ✅ Curious agent | |\n|---|---|---|\n| What it cares about | getting the reward, right now | getting the reward + not being unsure\n|\n| What it does | guesses a door | checks the hint first, then opens the right door |\n| Success (400 tries) | 48% |\n100% |\n\nNobody told the second agent \"go check the hint.\" It did it on its own, because being unsure *bothered* it.\n\nBefore acting, the agent scores each option on two things:\n\n```\nvalue_of_checking_the_hint = how_unsure_am_i    # high when it's a total coin-flip\nvalue_of_just_guessing     = chance_of_being_right  # only ~50% on a blind guess\n\nif value_of_checking_the_hint > value_of_just_guessing:\n    check_the_hint()     # this is where curiosity shows up\nopen(best_door)          # now actually go get the reward\n```\n\nWhen it's a total coin-flip, checking the hint is worth a lot (it removes all the doubt), way more than a 50/50 guess. So it looks first. Once it *knows*, there's nothing left to be unsure about, so it just grabs the reward. The reward-chaser never sees any value in the hint, so it flips a coin forever.\n\nTwo reasons engineers should care:\n\n**Curiosity for free.** A long-standing headache in AI is agents getting stuck doing the same thing, never trying anything new. People hand-tune \"exploration bonuses\" to force them to explore. This approach gives you curiosity automatically — the agent looks for info exactly when it's unsure, and stops once it isn't.\n\n**It handles surprises.** An agent built to avoid surprises is built to deal with situations it wasn't trained for. When reality stops matching its expectations, closing that gap *becomes* its goal — so it keeps adapting instead of breaking.\n\nA reward-chaser asks \"what gets me the most points?\" A surprise-avoider asks \"what don't I understand yet?\" — and that second question is what makes it adapt.\n\n```\ngit clone https://github.com/Shridhar-2205/living-software\ncd living-software/04-active-inference\npython demo.py\n```\n\nHonest note: the full version of this idea has a fair bit of math behind it. I've boiled it down to the one decision that makes it obvious — *being unsure has a cost* — so you can watch curiosity appear in a few lines of code.\n\n*Written by **Shridhar Shah**, Senior Software Engineer at Outshift by Cisco — AI agents, search, and how they \"think.\" Part 4 of \"Toward Living Software.\" GitHub · LinkedIn*\n\nBackground:Karl Friston's \"Free Energy Principle\" (the brain-science origin); \"Active Inference as the Test-Time Scaling Law for Physical AI Agents\" (arXiv:2606.22813).", "url": "https://wpnews.pro/news/i-built-an-ai-agent-that-gets-curious-on-its-own", "canonical_source": "https://dev.to/shridhar_shah2297/i-built-an-ai-agent-that-gets-curious-on-its-own-4oe1", "published_at": "2026-06-27 21:43:35+00:00", "updated_at": "2026-06-27 22:03:49.433753+00:00", "lang": "en", "topics": ["artificial-intelligence", "machine-learning", "ai-agents", "ai-research", "neural-networks"], "entities": ["Shridhar Shah", "Outshift by Cisco", "Karl Friston", "GitHub", "LinkedIn", "arXiv"], "alternates": {"html": "https://wpnews.pro/news/i-built-an-ai-agent-that-gets-curious-on-its-own", "markdown": "https://wpnews.pro/news/i-built-an-ai-agent-that-gets-curious-on-its-own.md", "text": "https://wpnews.pro/news/i-built-an-ai-agent-that-gets-curious-on-its-own.txt", "jsonld": "https://wpnews.pro/news/i-built-an-ai-agent-that-gets-curious-on-its-own.jsonld"}}