TDM 20100: Project 7 — Fall 2026

Overview About Single Agent Models

Project Objectives

Motivation: Large Language Models (LLMs) can generate text, but many tasks require them to interact with external systems, and to make decisions based on available information. AI agents extend what LLMs can do by allowing the model to use tools, follow workflows, and complete tasks on behalf of users.

Context: In this project, students will build a single-agent system using LangGraph, LangChain, Ollama, and a customer order dataset. Students will create tools, design agent workflows, connect the agent to a dataset, and implement safeguards to ensure the agent follows set rules.

Scope: AI agents, LangGraph, LangChain, tool calling

Learning Objectives
  • Understand the purpose and workflow of a single-agent system.

  • Build agent workflows using LangGraph and state-based execution.

  • Connect an agent to an external dataset.

  • Set rules for agent behavior to ensure reliability.

Dataset

  • /anvil/projects/tdm/data/orders/Superstore_modified.csv

You can see the first several rows of the data by typing in the terminal:

/anvil/projects/tdm/data/orders/Superstore_modified.csv

or by using a bash magic cell inside Jupyter Lab:

%%bash
/anvil/projects/tdm/data/orders/Superstore_modified.csv

Superstore

This dataset contains a collection of insights into sales, customer behavior, and product performance of a store’s sales. There are 22 columns and nearly 10,000 rows of data. The columns cover many details from each order placed with this store, describing who placed the order, what item was ordered, what country it was from, and more.

Some of the columns from the Superstore dataset we will be working with include:

  • Order ID: representing the origin country, year, and a code unique to the order

  • Customer Name: name connected to the user who placed the order

  • Order Status: current status of the order

The Order Status column starts only containing "Shipped" and "Pending" values. However, thoughout this project, we will modify it by "cancelling" certain orders. Use myDF.value_counts() to check how these values have shifted as you go.

Use 4 cores for this project!

pusheen computer

We remind you have to setup a llama3.2 model with 2 cores here:

For Questions 1, 2, 3, we will need Version 1 of three tools, available here:

For Questions 4 and 5, we will need Version 2 of three tools, available here:

Question 1

In the graph.py file, consider the call_model:

In the prompt where it says: You are an ecommerce support agent

Please change this to a prompt that gives the ecommerce support agent a personality, for instance, an attitude of humbly helping the customer, or an impatient customer service agent, or a support agent that is long-winded and likes to give wordy responses, etc.

Question 2

Also in the graph.py file, consider the call_model.

To the current set of rules, add two rules of your own choosing.

Question 3

After setting up version 1 of the three Python files, run the tests in the file:

and show the outputs.

Question 4

Now we will read in the Superstore Sales dataset as myDF using the Pandas library, and we will update the tools from Version 1 (in Questions 1, 2, 3) to Version 2 (for Questions 4 and 5).

After setting up version 2 of the three Python files (and remembering to use graph = construct_graph() to reconstruct the graph with these updates), run the tests in the file:

and show the outputs.

Question 5

Using version 2 of the three Python files, run the command:

myDF['Order Status'].value_counts()

at the start of version 2, and also after successfully cancelling at least one order.

Submitting your Work

Please make sure that you added comments for each question, which explain your thinking about your method of solving each question. Please also make sure that your work is your own work, and that any outside sources (people, internet pages, generative AI, etc.) are cited properly in the project template.

Prior to submitting your work, you need to put your work into the project template, and re-run all of the code in Jupyter Lab and make sure that the results of running that code is visible in your template. Please check the detailed instructions on how to ensure that your submission is formatted correctly. To download your completed project, you can right-click on the file in the file explorer and click 'download'.

Items to submit
  • firstname_lastname_project7.ipynb

It is necessary to document your work, with comments about each solution. All of your work needs to be your own work, with citations to any source that you used. Please make sure that your work is your own work, and that any outside sources (people, internet pages, generative AI, etc.) are cited properly in the project template.

You must double check your .ipynb after submitting it in gradescope. A very common mistake is to assume that your .ipynb file has been rendered properly and contains your code, markdown, and code output even though it may not.

Please take the time to double check your work. See here for instructions on how to double check this.

You will not receive full credit if your .ipynb file does not contain all of the information you expect it to, or if it does not render properly in Gradescope. Please ask a TA if you need help with this.