Conversational Twin Agent

Ed Donner

Persona-grounded chat agent on Lambda. Bedrock Nova holds the dialogue; OpenAI covers Whisper, TTS, and emotion labels; S3 session memory keeps the conversation across visits.

AWS Lambda · Bedrock Nova · OpenAI Whisper and TTS · S3 memory · FastAPI

Overview

Layers 2–5 on the Mental Model. The Conversational Twin is the only dialogue agent: persona-grounded chat on Lambda, Bedrock Nova for replies, OpenAI for Whisper / TTS / emotion fallback, S3 for session memory.

Behavior

  • Persona before reply. Resume, LinkedIn, style, and summary shape the prompt before Bedrock converse.
  • Session memory. Each turn loads and saves JSON in Memory S3 so the twin continues across visits.
  • Same path for voice and type. Voice becomes text via Whisper, then the same /chat path; TTS speaks the reply.
  • Host embeds, API owns the agent. The widget posts to Lambda; the browser never calls Bedrock.
  • Prompt Chaining. Remember → Ground → Converse → Express. See Building effective agents.

Chat flow

One visitor message, typed or spoken. Diagram key: ✦ AI agent · second line = Anthropic workflow · purple = actor · white = service.

---
config:
  theme: default
  themeVariables:
    background: "#ffffff"
    fontSize: "14px"
---
flowchart TB
    person[Website visitor]
    widget[Twin widget]
    whisper[POST /transcribe]
    chat["POST /chat"]
    mem[Memory S3]
    twin["✦ Conversational Twin
Prompt Chaining"] bedrock[Bedrock Nova] face[Emotion face] tts[TTS mp3] person -->|type| widget --> chat person -->|speak| widget --> whisper --> chat chat --> mem --> twin twin -->|converse| bedrock bedrock --> twin twin --> mem twin --> face --> widget face --> tts --> person classDef agent fill:#e8f0ee,stroke:#0f3d36,stroke-width:2px,color:#0d0d0d classDef service fill:#fafaf8,stroke:#c8c8c2,stroke-width:1px,color:#0d0d0d classDef actor fill:#f3eef8,stroke:#6b4f9a,stroke-width:2px,color:#0d0d0d class twin agent class widget,whisper,chat,mem,bedrock,face,tts service class person actor

API: Lambda FastAPI. Dialogue: Bedrock Nova. Voice: Whisper and TTS. Persona: backend/context.py + backend/data/.

Persona first, then Bedrock. Layer map on Mental Model. Part of Project.