Homework 3: Build Your First Agent
Released: Friday, February 20
Due: Thursday, March 5 @ 11:59 PM ET (submit on Gradescope)
Overview
You will build a conversational agent that embodies a chosen celebrity. You may choose a politician, actor, musician, influencer, or any other public figure, as long as there is enough reliable information online to build a useful memory store.
Your agent must (1) store information about the celebrity from public sources, (2) decide what to say using that stored information, (3) express the response in the celebrity's style, and (4) end the conversation naturally with a goodbye and sign-off.
You will be provided with a repo that includes a skeleton codebase that defines the expected module boundaries and function/class interfaces. Keep your implementation consistent with those interfaces.
Download the skeleton repo for HW3.
You are welcome to add any additional functionality you want beyond the provided skeleton, as long as your final agent satisfies the core requirements.
Implementation Instructions
Part 1: Memory Store
Goal: Create a searchable memory of the celebrity based on public web content.
Requirements:
- Collect public sources such as Wikipedia pages, interview transcripts, profiles, and talks.
- Convert sources into structured chunks represented by a
MemoryChunkdata structure. - Store chunks in a
MemoryStoreobject. - Implement retrieval through
MemoryStore.retrieve(query). - Use
build_memory_store(...)andload_memory_store(...)as the top-level entry points for constructing/loading the store.
Output of this module: A retrieval interface that takes a query and returns relevant text chunks with metadata.
Part 2: Content Module
Goal: Determine the substance of the response.
Requirements:
- Parse the user query and identify what information is needed.
- Retrieve the relevant chunk(s) from the memory store.
- Produce a content plan through
make_content_plan(user_message, retrieved). - Run one full content step with
content_step(memory, user_message).
Output of this module: A grounded content plan to pass into the style module.
Part 3: Style Module
Goal: Express the content plan in the celebrity's linguistic and conversational style.
Requirements:
- Define a style specification for your celebrity (tone, sentence structure, typical phrasing, conversational habits).
- Using
stylize(content_plan), turn the content module's plan into a stylized response. - Preserve meaning: do not introduce new factual claims not present in the content plan or retrieved evidence.
Output of this module: A final user-facing message in the celebrity's style.
Part 4: Conversational Reasoning and Sign-off
Goal: Track conversation state and end appropriately.
Requirements:
- Decide when the conversation has reached a natural endpoint (e.g., user says "thanks" or "bye," or no open questions remain) and terminate the agent automatically.
- To help, you can optionally maintain basic conversation state (recent turns, whether the user asked an open question, whether a follow-up is pending).
- Implement end logic in
should_end(user_message). - Implement in-character sign-off in
add_signoff(response).
Data and Configuration
- The
data/folder includes sample files (sample_sources.json,sample_index.json) that demonstrate expected formats. - The LLM helper uses Mistral;
MISTRAL_API_KEYmust be set as an environment variable. - Setup details are in the repo's
README.md.
Submission Guidelines
You will submit the celebrity_agent folder (zipped), that contains your implementation for your chosen celebrity's persona agent. You should be able to download this folder, unzip it, and run run_agent.py to launch your agent.
Along with your code, you will also submit a writeup, celebrity_agent.pdf, that describes all the design choices you made, along with your motivations for each.
Your writeup should describe:
- Celebrity: the chosen celebrity, why you picked them, and what defines their voice.
- Data: what sources you used and your collection approach.
- Memory store: Data cleaning/chunking, how you implemented indexing, and how you implemented retrieval.
- Content module: Query parsing logic, retrieval strategy, and error handing (e.g. when no relevant info was found).
- Style module: Style specification, prompt engineering process, and content-preservation strategy.
- Running the agent: Conversation-ending logic, issues you encountered, etc.
- A short example transcript demonstrating retrieval, stylized output, and a natural goodbye.
- Any other design decisions you made, along with your motivation (temperature tuning, response length tuning, model selection, etc.).
Due Date: Thursday, March 5 @ 11:59 PM ET (submit on Gradescope under "HW 3")
Files to Upload:
celebrity_agent.zip— your zipped implementation for your chosen celebrity's persona agent.celebrity_agent.pdf— your writeup describing all the design choices you made, along with your motivations for each.
Late policy: Late days apply automatically; otherwise late work is not accepted.