🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Exercises.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.

Project 30: AI Support Agent Capstone

AI Engineer
Current Task

Objective

Capstone: wire a prompt, a retrieval chain, a memory-backed conversation, and a tool-using agent into one pipeline — the complete LangChain workflow in one script.

Task: assemble all of it, run one turn, and print the memory length and the final answer.

index.py
from langchain.memory import ConversationBufferMemory from langchain.chains import create_retrieval_chain from langchain_core.tools import tool memory = ConversationBufferMemory() @tool def flag_for_review(item_id: str) -> str: """Flag an admin dashboard item for manual review.""" return "flagged" retrieval_chain = create_retrieval_chain(retriever, question_answer_chain) response = retrieval_chain.invoke({"input": "Why was item #482 flagged?"}) memory.save_context({"input": "Why was item #482 flagged?"}, {"output": response["answer"]}) print(len(memory.chat_memory.messages)) print(response["answer"])

* Hint: Correct characters turn green, incorrect ones turn red.

Live Preview
🖼️

Verify your code to see the preview

Previous
Next →