INDEXTRACK: STRATEGYTRACK: CREATIVE

Subject ID

M01-M1_

UNCLASSIFIED
Module 01

M1 L3 Project Brief

Project Brief: Your First Agentic Workflow

Module: 1: Mastering the New Age of Intelligence Lesson: 3: Beyond Prompts: Engineering Your First Intelligent Agent


1. Objective

This project is your first tangible step into the world of building, not just using, intelligent systems. Your objective is to engineer a multi-step "Chain-of-Thought" application that autonomously solves a logic puzzle. You will apply the principles of Flow Engineering to construct a simple but functional AI agent, moving from theory to a hands-on demonstration of agentic reasoning.


2. The Challenge: The River Crossing Puzzle

Your agent will be tasked with solving a classic logic puzzle:

A farmer needs to cross a river with a wolf, a goat, and a cabbage. His boat is small and can only carry himself and one other item (either the wolf, the goat, or the cabbage) at a time. If left unattended together, the wolf will eat the goat, and the goat will eat the cabbage. How can the farmer get everything across the river safely?

This puzzle cannot be solved in a single step. It requires planning, state tracking, and logical reasoning—a perfect task for an agent.


3. Your Task

You will use a framework like LangGraph (or a similar tool) in Python to build a simple agent that can solve this puzzle. Your agent should use a Chain-of-Thought process to reason through the steps, keeping track of the state of the puzzle at each crossing.

You will define a "flow" that the LLM will follow, which includes:

  1. Analyzing the current state of the puzzle.
  2. Proposing a valid move.
  3. Updating the state after the move.
  4. Checking if the puzzle is solved.
  5. Repeating until a solution is found.

4. Key Requirements

Your agentic workflow must:

  1. Define the Initial State: Your code should clearly define the starting state of the puzzle (e.g., Farmer, Wolf, Goat, Cabbage are all on the West Bank).

  2. Implement a State-Checking Function: Create a function that can check if the current state is valid (i.e., the goat is not left with the wolf, and the cabbage is not left with the goat).

  3. Create a Chain-of-Thought Prompt: Your core prompt should instruct the LLM to act as a logic puzzle solver. It should be prompted to:

    • Receive the current state.
    • Analyze the constraints.
    • Propose the next single, valid move (e.g., "Farmer takes the Goat across").
    • Output only the proposed move.
  4. Build the Workflow Graph: Using LangGraph, create a graph where:

    • A "Reasoning" Node calls the LLM with the current state and the CoT prompt.
    • An "Update State" Node takes the proposed move from the LLM, updates the state of the puzzle, and checks if the new state is valid.
    • An Edge that loops back to the "Reasoning" node if the puzzle is not yet solved.
    • An Edge that terminates the flow when the puzzle is solved.
  5. Log the Output: Your application should print out each step of the agent's reasoning process, showing the sequence of moves it discovers to solve the puzzle.


5. Tools

  • Language: Python
  • Key Library: LangGraph (or a similar agent framework like CrewAI)
  • You will need access to an LLM via an API (e.g., the Gemini API).
  • Environment Setup: Ensure you have Python installed and the necessary libraries (e.g., pip install langchain-core langchain-community langgraph) are installed. You will also need to set up your LLM API key as an environment variable or directly in your code.

6. Format and Deliverable

  • Deliverable: A single Python script (.py) that, when run, executes the agent and prints the step-by-step solution to the puzzle to the console.
  • Your code should be well-commented to explain the different parts of your agentic workflow (the nodes, the edges, the state management).

8. Tips for Success

  • Start Simple: Don't try to build the whole agent at once. Start by getting the LLM to correctly propose a single valid move. Then work on updating the state, and finally, build the loop.
  • Print Everything: Use print statements liberally to see the state of the puzzle and the LLM's output at each step. This will be invaluable for debugging.
  • Iterate: This is an iterative process. Your first attempt will likely not be perfect. Learn from your errors and refine your prompts and logic.
  • Review the Lecture: Revisit the concepts of Chain-of-Thought and LLM State Machines from the lecture notes as you build.

7. Evaluation Criteria

Your project will be evaluated on the following criteria:

  • Functionality (50%):
    • Does the agent successfully solve the River Crossing Puzzle?
    • Does it find a valid sequence of moves without violating any constraints?
    • Is the solution consistently reproducible?
  • Agentic Design (30%):
    • How well did you structure the workflow using nodes and edges (or equivalent concepts in your chosen framework)?
    • Is there a clear separation between the reasoning step (LLM call), the state update, and the validation logic?
    • Does the agent demonstrate a clear Chain-of-Thought process?
  • Code Clarity (20%):
    • Is your code clean, well-commented, and easy to understand?
    • Are variable names descriptive and consistent?
    • Can another developer easily follow the logic of your agent and its flow?

END OF TRANSMISSION

CONFIDENTIAL