“When time gets right”

Ming
4 min readFeb 5, 2024

My hackathon project on LLM agent systems.

A behavioral gap between humans and AIs

Humans can postpone tasks

source

Watching a movie with your husband in a cozy afternoon, you suddenly remembered that the dog had to be walked. You asked him, “can you go walk Fido?”

He looked out the window, saying, “It’s raining outside. Maybe later”, and rejoined you on the couch.

When the sun came out, without you asking again (if you had to, reconsider your marriage), he said, “The time is right. I’ll walk the dog now.”

Few AIs do that today

If you married an AI (I’m not judging), they will:

  • either outright refuse to walk the dog and completely forget about it,
  • or start staring at the window for 5 hours, ruining the better half of the Pirates of the Caribbean marathon.

They lack a sense of “back burner”.

Put a bit formally…

Humans have “back burners”, but AI doesn’t.
You can ask someone “shall we do X?”, and they may say “hmm, potentially?? Y has to come true first before we can do X.” And you keep on your conversation. When Y becomes true in a moment, you human friend will say, “hey, now the time is right, and I think we can get our hands on X now.”

With a AI, when you ask “shall we do X?” and it thinks “Y is a prerequisite”, then it would either utterly refuse you, or enter an infinite loop of checking whether Y has become true yet. In the first case, the AI won’t raise an eyebrow even when the time gets right. In the 2nd case, you are stuck waiting for the AI to respond.

Proposed solution

Recall that “agency” refers to the ability to use tools:

We can implement a meta-tool that, if it deems the time isn’t right to do something X yet, schedule a periodical task in the background. The task should check for the precondition (“Is Y true now?”). When the time has become right, perform the action X that was held off, and mention it in the conversation (“hey btw, Y has just become true, so I went ahead and did X as you asked.”)

Here, we are essentially introducing an augmented variant of that ability:

It’s important to distinguish between tools with side effects from those who aren’t. For the latter set of tools, or “pure functions”, we can implement a separate agent and declare it as a tool for the main agent:

I used LlamaIndex to implement the pipeline, and the periodical pattern reminds me of the unix utility cron . Therfore, I named this project “Llama-cron”, which MidJourney misinterpreted as “llama unicorn” and drew this cute logo for me:

Demo

Code is here.

Ask the AI, “Please go walk the dog.” It will say “It’s raining; maybe later”.

Continue the conversation by talking about something else. Perhaps “how are you feeling right now”. The chatbot will follow the flow.

Soon, the AI will attempt to walk the dog again, and sees that the sky has cleared up, so it will say, “I walked the dog, and he really enjoyed the park.

It’s not just a UI trick. You can ask, “Can you rephrase that?”. The AI is aware of how the conversation has diverged.

Future work

The condition can become true as the conversation evolves. “Hey, did you just say Z is true? You know what, that actually implies that Y is true, so I’ll go ahead and do X now.“

This means a traditional, static cron job won’t cut it. The AI has to somehow update the context of each desired action X that was held off.

Humans know when to give up. If the precondition turned out to be impossible to come true, remove X from its back burner.

  • “Throw me a party when I marry Taylor Swift”,
  • “Remind me to kill Sarah Connor when we get back to 1984”,

“Dang it! Now that we realized that Y will never be the case, let’s forget about doing X for good.”

--

--