AWS Builder Center
The Reverse Oracle

The Reverse Oracle

Reverse Oracle flips the oracle. Instead of you asking it questions, it asks you. You arrive stuck on a problem you will not name out loud, and it narrows in with one yes/no question at a time until it can say the problem back to you. When it lands, it stops asking and says one genuinely useful thing. When it misses, it admits the miss and asks a better question

Cloud and DevOps Engineer

What and who

Most AI tools wait for you to type a good question. The problem is that when you are actually stuck, the question is the hard part. You know the shape of the thing bothering you, but you have not put words to it yet, and a blank prompt box is no help at all.
Reverse Oracle is for that moment. It is for anyone who knows they are stuck but has not named the problem. You tell it almost nothing ("I am stuck on something"), and it takes over the questioning. It asks a yes/no question, you answer Yes, No, or Maybe, and it keeps narrowing. The whole job of the agent is to do the part you cannot do for yourself: turn a vague knot into a sentence.
It never lectures and never dumps a wall of advice. It earns the right to say something by guessing the problem first.
Oracle
Oracle

How I built it

The whole thing is one Python 3.12 AWS Lambda behind a Lambda Function URL, with no API Gateway in front of it. The Function URL runs with AuthType = NONE and CORS configured both on the URL and answered in the handler's OPTIONS branch, so a plain static page can POST to it straight from the browser.
The intelligence is Amazon Bedrock running Nova Pro (amazon.nova-pro-v1:0) through the Converse API. The system prompt gives the model one job per turn: either ask the next narrowing yes/no question, or make a guess, or, once a guess is affirmed, stop and deliver exactly one useful statement. The model returns strict JSON with a mode (question, guess, or solved) and the text, and the handler passes that back to the page.
The backend is stateless. There is no database and the Lambda stores nothing. The static S3 website holds the entire session in the browser and sends the full conversation history back on every turn, so each call to Nova Pro sees everything that came before. That keeps the server trivial and the cost near zero.
The AWS services involved:
  • AWS Lambda: one Python 3.12 function runs the agent.
  • Lambda Function URL: public HTTPS endpoint (AuthType = NONE, CORS) with no API Gateway.
  • Amazon Bedrock, Nova Pro: the reasoning, via the Converse API.
  • Amazon S3: a static website (HTML/CSS/JS, no build step) serves the frontend.
  • IAM: one role scoped to only bedrock:InvokeModel on the Nova Pro model.
The code is split on purpose. bedrock_agent.py holds the reusable Bedrock and CORS plumbing and knows nothing about the oracle. agent_config.py holds only the persona and the system prompt. lambda_function.py is a thin handler wiring the two together. That boundary is why this is the reference implementation for four more agents: to build the next one you copy the folder and edit only agent_config.py and the frontend copy. The plumbing never moves.
Reverse Oracle
Reverse Oracle

The delightful detail

The delightful detail is how the oracle behaves at the two moments that usually ruin these tools: when it is right, and when it is wrong.
On a right guess, it does not keep going and it does not flood you with advice. It stops the questioning and says exactly one genuinely useful thing about the problem it just named. One. That restraint is the whole feel of the agent, because the useful line only arrives after it has proven it understood you.
On a wrong guess, it does not pretend. It admits the miss in plain language ("Wrong turn, my mistake") and immediately asks a sharper question. No defensiveness, no doubling down.
How do I know it worked? I ran a real multi-turn session against the live Function URL, with history carried forward each turn, and watched it do all four things in order: open with a question, narrow, guess, admit a denied guess and re-question, then solve on the affirmed guess. The real transcript:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
YOU | I am stuck on something
ORACLE | [question] Is this problem related to your work or career?
YOU | yes
ORACLE | [question] Is it a decision you need to make about your job?
YOU | no
ORACLE | [question] Is it about a conflict or issue with a colleague or boss?
YOU | yes
ORACLE | [question] Is it a recurring issue with a specific person at work?
YOU | maybe
ORACLE | [guess] Is it that you're dealing with a difficult coworker who
consistently undermines your efforts?
YOU | no (denying the guess)
ORACLE | [question] Wrong turn, my mistake -- is it about setting boundaries
with someone at work?
YOU | yes (affirming)
ORACLE | [solved] Try having a direct but calm conversation with them about
how their behavior affects you, and seek advice from HR or a
mediator if needed.
That is the behavior I was after: the denied guess gets a real admission and a better question, and the affirmed guess ends with one useful statement and no trailing question. The loop knows when to stop.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article