Slava Ukraine

Conversational ReAct Description - Multi-Turn AI Agent Framework

Conversational ReAct builds on the original ReAct paradigm by weaving in two critical capabilities: (1) persistent memory so that past turns inform future responses, and (2) context tracking that keeps the dialogue coherent over many back‐and‐forth exchanges.

Conversational ReAct Description
Conversational ReAct Description

Architecture Overview

At its core, Conversational ReAct interleaves three loops:

It allows the AI to:

This approach is especially useful in building chat-based assistants, customer service bots, or AI copilots that need to maintain context, ask clarifying questions, and execute external actions within a conversation loop.

MultiTurn Example

Suppose a user is planning a trip and asks:
User: “What’s the weather in Paris this weekend?”

Keeping Context in TypeScript

Here’s a minimal pattern for appending each turn to a conversation history and retrieving the last n turns before calling your LLM:


// conversation.ts
export interface Turn {
  role: "system" | "user" | "assistant";
  content: string;
}

const MAX_TURNS = 6;
let history: Turn[] = [
  { role: "system", content: "You are a helpful assistant." }
];

export function appendTurn(turn: Turn) {
  history.push(turn);
  if (history.length > MAX_TURNS + 1) {
    // drop oldest user+assistant pair
    history.splice(1, 2);
  }
}

export function getContext() {
  return history;
}

// In your handler:
import OpenAI from "openai";
import { appendTurn, getContext } from "./conversation";

async function chat(userInput: string) {
  appendTurn({ role: "user", content: userInput });

  const response = await new OpenAI().chat.completions.create({
    model: "gpt-4o-mini",
    messages: getContext(),
  });

  const assistantMsg = response.choices[0].message;
  appendTurn({ role: "assistant", content: assistantMsg.content });
  return assistantMsg.content;
}

Benefits Use Cases

Conversational ReAct Description
Conversational ReAct - ReAct + Reasoning + Acting

Best Practices

Conclusions

Conversational ReAct brings together on-the-fly reasoning, tool calls, and persistent memory to deliver truly context-aware, multi-turn dialogue agents. By interleaving the Reasoning, Tool-Use, and Memory loops, your assistant can not only answer immediate questions but also recall past user intents, ask clarifying follow-ups, and adapt over the course of a conversation. With best practices around window size, selective retrieval, and transparent tool logging, Conversational ReAct is ready for production-grade bots, customer-service agents, and AI copilots alike.

References

Agent & Tools — ReAct Chat
LangChain Agents: Conversational React Description