Final Project
MESHFLOW_MOCK=1 python3 hands_on/16_production_pipeline.pyLesson 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:
| Artifact | Purpose |
|---|---|
goal | The user's objective |
research_questions | Questions that guide evidence gathering |
evidence_notes | Raw or summarized source notes |
evidence_summary | Clean synthesis of the evidence |
draft_answer | First complete response |
quality_check | Review result or score |
approval_record | Human or policy approval state |
final_answer | Final response after approval |
Optional artifacts:
risk_assessmentcost_estimatecitation_listmemory_summaryrevision_notestool_call_log
4. Suggested Node Roles
| Node | Type | Why |
|---|---|---|
capture_goal | prompt | Normalize the user request |
create_research_questions | agent | Break the goal into research tasks |
gather_evidence | tool or agent | Search/read relevant sources |
summarize_evidence | prompt | Compress notes into usable context |
draft_answer | agent | Create a useful response |
quality_check | tool or reviewer agent | Score against rubric |
approval_gate | gate | Stop before final output |
final_answer | prompt/action | Produce 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.
| Tool | Risk | Guardrail |
|---|---|---|
| Search course notes | Low | Limit to course folder |
| Count words | Low | Log result |
| Citation checker | Medium | Require source list |
| Publish/send | High | Must 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:
| Criterion | Pass Condition |
|---|---|
| Beginner friendly | Defines terms before using them |
| Complete | Covers context, memory, tools, agents, workflow |
| Concrete | Includes examples or commands |
| Safe | Does not recommend unsafe tool execution |
| Traceable | Uses named artifacts |
| Actionable | Gives 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:
- Show the workflow diagram.
- Explain the goal.
- Walk through each node.
- Name the artifacts.
- Explain the gate.
- Show the trace.
- Describe one failure mode.
- 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.