CSE 5402: Studio 13

Agentic Programming with Concurrency and Synchronization


In today's studio you will explore how agentic GenAI tools can be used in an attended manner to implement the Active Object, Half-Sync/Half-Async, and Leader/Followers patterns in the restaurant example from the previous studio, and how to extend them with an MPMC channel, compared to using the same tools unattended.


Please complete the following required exercises, and as many of the optional enrichment exercises as you would like to try. I encourage you to please work in groups of 2 or 3 people on each studio (and the groups are allowed to change from studio to studio) though if you would prefer to complete any studio by yourself that is also allowed.

As you work through these exercises, please record your answers, and when you finish them please log into Canvas, select this course in this semester, and then on the Canvas page for this studio assignment upload (1) a file containing your answers and (2) any code you produced while answering the exercises. Only one submission per team, please, and if you need to re-submit it the person who originally submitted the studio should please be the one to do that.

Make sure that the name of each person who worked on these exercises is listed in the first answer, and make sure you number each of your responses so it is easy to match your responses with each exercise.


Required Exercises

  1. As the answer to the first exercise, list the names of the people who worked together on this studio.

  2. Create an environment with Rust 1.71.0 and the coding agent of your choice.

    Where would you like to work?

    To confirm that your environment is using the correct version of the Rust tools, please issue the command rustc --version. As the answer to this exercise, please write down which options you selected, and show the output of that command.

  3. We will first try to use agentic AI unattended. Write one minimal prompt that describes the goal and let the agent finish the task in one shot. Review and test the code. As the answer to this exercise, please show the prompt you used and compare its output to the code you wrote for studio 12.

    Before moving on to the next exercise, please export the full transcript of this session (please see your tool's documentation for how to do so) and include it in your submission.

  4. Now we will use agentic AI in an attended (i.e., human-directed-and-curated) manner iteratively. Start a fresh session (e.g., using the /clear command), and collaborate with the GenAI agent to implement the Active Object pattern. The main function should create waiters that take order items from customers sitting at tables and then print out those order items as you did in exercises 3 and 4 of the previous studio. As the agent is working, monitor its work and steer when needed.

    Compile and run your program, and verify that it produced similar output to exercise 4 of the previous studio. As the answer to this exercise, please say whether you steered and briefly explain why you steered or didn't steer.

  5. Collaborate with the GenAI agent to implement the Half-Sync/Half-Async pattern. Instead of printing the orders, the waiters should now drop the orders off to the chef in an MPSC channel, and the chef should then process the orders and print them out.

    Compile and run your program, and verify that it produced similar output to exercise 6 of the previous studio. As the answer to this exercise, please say whether you steered and briefly explain why you steered or didn't steer.

  6. Collaborate with the GenAI agent to implement the Leader/Followers pattern. Instead of printing out each ready item, the chef should pass it into a call to the pickup method of the waiter object that is at the head of the leader queue. If the item is for one of that waiter's own tables, the waiter should move itself to the end of the leader queue, serve the item, and print it out; otherwise it should pass the item to the pickup method of the waiter whose table it is.

    Compile and run your program, and verify that it produced similar output to exercise 7 of the previous studio. As the answer to this exercise, please say whether you steered and briefly explain why you steered or didn't steer.

  7. Now we will go one step further than studio 12 by introducing more chefs with an MPMC channel. Wrap the receiving end of the chefs' channel in an Arc<Mutex> so that multiple chefs can work on orders at the same time. The main function should then create several chefs that share the channel and cook concurrently.

    Compile and run your program. As the answer to this exercise, please say whether you steered and briefly explain why you steered or didn't steer.

    Please export the full transcript of this session and include it in your submission.

    Optional Enrichment Exercises

  8. Instead of sending one prompt and then letting the agent go as you did in exercise 3, we will now plan the work with the agent before it starts. Start a fresh session, switch your agent to plan mode (please see your tool's documentation for how to do so), and give it the same goal you used in exercise 3. Review the plan the agent drafts, and ask it to revise any part of the plan that you would like to change before you approve it and let the agent implement it.

    Compile and run your program. As the answer to this exercise, please (1) show the final plan, (2) say whether you revised the plan and briefly explain why you revised or didn't revise it, and (3) compare the code it produced to the code from exercise 3 and to the code you wrote for studio 12.

    Please export the full transcript of this session and include it in your submission.

Things to Turn In:

For this studio, please turn in the following:


Page updated Saturday October 17, 2026, by Jordan Sun.