MESHFLOW_MOCK=1 python3 hands_on/16_production_pipeline.pyBuild a complete MeshFlow-style research-and-action workflow. This project pulls together everything from the course:
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.
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.
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.
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| 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.
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.
Decide what should be remembered after the run.
Good memory candidates:
Poor memory candidates:
Memory should help future runs without polluting them.
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.
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.
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:
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:
Create a new example file:
examples/my_final_project.json
Use the examples as templates. Your first version should include:
You are done when you can explain:
Prepare a short walkthrough:
If you can teach your workflow to someone else, you understand it.
Add one stretch goal at a time:
Do not add all stretch goals at once. Make each change visible in the graph.
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.
Write one sentence describing what your workflow should accomplish.
List the artifacts your workflow must produce.
Use this format:
goal -> research_questions -> evidence_summary -> draft_answer -> quality_check -> approval -> final_answer
Identify at least one place where execution should stop for review.