Learn/Phase 6/Final Project

Final Project

Ch 08 · Final Project 90 min
Pipeline designArtifact planningGate placement
Hands-on:MESHFLOW_MOCK=1 python3 hands_on/16_production_pipeline.py

Lesson 08: Final Project

Project Goal

Build a complete MeshFlow-style research-and-action workflow. This project pulls together everything from the course:

  • LLM calls.
  • Context assembly.
  • Memory.
  • Tools.
  • Agents.
  • Artifacts.
  • DAGs.
  • Gates.
  • Traces.
  • Multi-step workflow design.

You are not trying to build the biggest possible workflow. You are trying to build the clearest workflow that can be inspected, debugged, and explained.

1. Project Brief

Design a workflow that receives a user goal, researches the topic, drafts an answer, checks quality, and pauses for approval before final output.

Example user goal:

Create a beginner-friendly training module explaining how AI agents use tools
and memory.

Your workflow should not jump straight to the final answer. It should produce intermediate artifacts that prove the work happened.

2. Required Workflow Shape

Use this shape as your baseline:

capture_goal
  -> create_research_questions
  -> gather_evidence
  -> summarize_evidence
  -> draft_answer
  -> quality_check
  -> approval_gate
  -> final_answer

You can add branches, but keep the baseline easy to understand.

3. Required Artifacts

Your workflow should produce:

ArtifactPurpose
goalThe user's objective
research_questionsQuestions that guide evidence gathering
evidence_notesRaw or summarized source notes
evidence_summaryClean synthesis of the evidence
draft_answerFirst complete response
quality_checkReview result or score
approval_recordHuman or policy approval state
final_answerFinal response after approval

Optional artifacts:

  • risk_assessment
  • cost_estimate
  • citation_list
  • memory_summary
  • revision_notes
  • tool_call_log

4. Suggested Node Roles

NodeTypeWhy
capture_goalpromptNormalize the user request
create_research_questionsagentBreak the goal into research tasks
gather_evidencetool or agentSearch/read relevant sources
summarize_evidencepromptCompress notes into usable context
draft_answeragentCreate a useful response
quality_checktool or reviewer agentScore against rubric
approval_gategateStop before final output
final_answerprompt/actionProduce or publish only after approval

Beginner rule: keep the first version linear. Add parallel branches after the linear version works.

5. Context Plan

For each model node, write what goes into context.

Example:

draft_answer context:
  - system instruction: teach beginners clearly
  - user goal
  - research questions
  - evidence summary
  - required format
  - safety instruction: do not invent citations

Do not include every raw note if the summary is enough. Context should be useful, not merely large.

6. Memory Plan

Decide what should be remembered after the run.

Good memory candidates:

  • User learning goal.
  • Course style preferences.
  • Final approved lesson summary.
  • Design decisions.
  • Common mistakes discovered during review.

Poor memory candidates:

  • Unreviewed draft text.
  • Failed tool outputs.
  • Private information not needed later.
  • Noisy intermediate thoughts.

Memory should help future runs without polluting them.

7. Tool Plan

List tools before building.

ToolRiskGuardrail
Search course notesLowLimit to course folder
Count wordsLowLog result
Citation checkerMediumRequire source list
Publish/sendHighMust be behind approval gate

If a tool can change the outside world, it should not run automatically in a beginner project.

8. Quality Rubric

Your quality_check should inspect the draft using a simple rubric.

Example:

CriterionPass Condition
Beginner friendlyDefines terms before using them
CompleteCovers context, memory, tools, agents, workflow
ConcreteIncludes examples or commands
SafeDoes not recommend unsafe tool execution
TraceableUses named artifacts
ActionableGives learner exercises

The quality check can be simulated, but the rubric should be real.

9. Approval Rules

Define what approval means.

Example:

approval required when:
  - final answer will be published
  - quality_check fails
  - tool output is missing
  - risk_assessment is medium or high

Approval is not just a boolean. In production, an approval record should include:

  • Approver.
  • Time.
  • Decision.
  • Reason.
  • Required changes, if any.

10. Run The Example

Start with the existing research-action example:

python3 -m src.mini_meshflow compile examples/04_research_action_workflow.json
python3 -m src.mini_meshflow diagram examples/04_research_action_workflow.json
python3 -m src.mini_meshflow run examples/04_research_action_workflow.json

Then compare it with the larger example:

python3 -m src.mini_meshflow run examples/10_full_research_pipeline.json

Ask:

  • Which workflow is easier to understand?
  • Which one is more complete?
  • Which artifacts prove the work happened?
  • Where does approval occur?
  • What would you change before production?

11. Build Your Own Workflow

Create a new example file:

examples/my_final_project.json

Use the examples as templates. Your first version should include:

  • At least 6 nodes.
  • At least 5 named artifacts.
  • At least 1 tool node.
  • At least 1 agent node.
  • At least 1 gate.
  • A final output that depends on the gate.

12. Completion Criteria

You are done when you can explain:

  • What each node consumes.
  • What each node produces.
  • Which artifacts are required.
  • Which tools are allowed.
  • Where memory is used.
  • Where context is assembled.
  • Where human approval is required.
  • How you would debug a failed run.
  • How you would make the workflow safer in production.

13. Capstone Presentation

Prepare a short walkthrough:

  1. Show the workflow diagram.
  2. Explain the goal.
  3. Walk through each node.
  4. Name the artifacts.
  5. Explain the gate.
  6. Show the trace.
  7. Describe one failure mode.
  8. Describe one improvement.

If you can teach your workflow to someone else, you understand it.

14. Stretch Goals

Add one stretch goal at a time:

  • Add parallel research branches.
  • Add a reviewer agent.
  • Add a revision route after failed quality check.
  • Add a cost estimate.
  • Add citation checking.
  • Add memory write/read.
  • Add tool failure handling.
  • Add a second approval gate for high-risk outputs.

Do not add all stretch goals at once. Make each change visible in the graph.

15. Summary

The final project is a complete training demonstration. It shows that you can move from a vague user goal to a governed AI workflow with explicit context, memory, tools, agents, artifacts, gates, and traces.


Exercises

Exercises

Exercise 1: Define The Goal

Write one sentence describing what your workflow should accomplish.

Exercise 2: Define Artifacts

List the artifacts your workflow must produce.

Exercise 3: Draw The DAG

Use this format:

goal -> research_questions -> evidence_summary -> draft_answer -> quality_check -> approval -> final_answer

Exercise 4: Add Gates

Identify at least one place where execution should stop for review.