File size: 11,780 Bytes
d9ad05e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 900 770" font-family="Segoe UI, Arial, sans-serif">
<defs>
  <marker id="arr" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">
    <polygon points="0 0, 10 3.5, 0 7" fill="#8b949e"/>
  </marker>
  <marker id="arr-green" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">
    <polygon points="0 0, 10 3.5, 0 7" fill="#3fb950"/>
  </marker>
  <marker id="arr-yellow" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">
    <polygon points="0 0, 10 3.5, 0 7" fill="#e3b341"/>
  </marker>
</defs>

<!-- Background -->
<rect width="900" height="770" fill="#0d1117" rx="12"/>

<!-- Title -->
<text x="450" y="30" text-anchor="middle" font-size="16" font-weight="bold" fill="#e6edf3">CpptrajAI β€” Agent Execution Flow</text>

<!-- ═══ User Prompt ═══ -->
<rect x="325" y="45" width="250" height="48" rx="8" fill="#1f6feb" stroke="#388bfd" stroke-width="1.5"/>
<text x="450" y="65" text-anchor="middle" font-size="13" font-weight="bold" fill="#ffffff">User Prompt</text>
<text x="450" y="83" text-anchor="middle" font-size="11" fill="#cdd9e5">"Calculate RMSD of backbone..."</text>

<!-- Arrow down -->
<line x1="450" y1="93" x2="450" y2="120" stroke="#8b949e" stroke-width="1.5" marker-end="url(#arr)"/>

<!-- ═══ System Prompt Injection ═══ -->
<rect x="250" y="123" width="400" height="65" rx="8" fill="#161b22" stroke="#30363d" stroke-width="1.5"/>
<text x="450" y="145" text-anchor="middle" font-size="13" font-weight="bold" fill="#e6edf3">System Prompt Injection</text>
<line x1="260" y1="153" x2="640" y2="153" stroke="#30363d" stroke-width="0.8"/>
<text x="450" y="170" text-anchor="middle" font-size="11" fill="#8b949e">Topology info β€’ File names β€’ Execution rules β€’ Workflow guidelines</text>

<!-- Arrow down -->
<line x1="450" y1="188" x2="450" y2="215" stroke="#8b949e" stroke-width="1.5" marker-end="url(#arr)"/>

<!-- ═══ LLM Decision Engine ═══ -->
<rect x="300" y="218" width="300" height="58" rx="8" fill="#21262d" stroke="#388bfd" stroke-width="2"/>
<text x="450" y="242" text-anchor="middle" font-size="13" font-weight="bold" fill="#79c0ff">LLM Decision Engine</text>
<text x="450" y="262" text-anchor="middle" font-size="11" fill="#8b949e">Decides next tool call or final answer</text>

<!-- ─── Fan-out via top bus ─── -->
<!-- Stem from LLM bottom center to top bus -->
<line x1="450" y1="276" x2="450" y2="315" stroke="#8b949e" stroke-width="1.5"/>
<!-- Top bus horizontal: y=315, x=120 to x=780 -->
<line x1="120" y1="315" x2="780" y2="315" stroke="#8b949e" stroke-width="1.5"/>
<!-- Drops from bus to each tool top (y=350) -->
<line x1="120" y1="315" x2="120" y2="347" stroke="#8b949e" stroke-width="1.5" marker-end="url(#arr)"/>
<line x1="285" y1="315" x2="285" y2="347" stroke="#8b949e" stroke-width="1.5" marker-end="url(#arr)"/>
<line x1="450" y1="315" x2="450" y2="347" stroke="#8b949e" stroke-width="1.5" marker-end="url(#arr)"/>
<line x1="615" y1="315" x2="615" y2="347" stroke="#8b949e" stroke-width="1.5" marker-end="url(#arr)"/>
<line x1="780" y1="315" x2="780" y2="347" stroke="#8b949e" stroke-width="1.5" marker-end="url(#arr)"/>

<!-- ═══ Tool Boxes (y=350, w=140, h=100) ═══ -->

<!-- search_cpptraj_docs (center x=120) -->
<rect x="50" y="350" width="140" height="100" rx="8" fill="#161b22" stroke="#f0883e" stroke-width="1.5"/>
<text x="120" y="371" text-anchor="middle" font-size="10" font-weight="bold" fill="#f0883e">search_cpptraj_docs</text>
<line x1="50" y1="378" x2="190" y2="378" stroke="#f0883e" stroke-width="0.8"/>
<text x="120" y="394" text-anchor="middle" font-size="10" fill="#8b949e">TF-IDF search over</text>
<text x="120" y="409" text-anchor="middle" font-size="10" fill="#8b949e">cpptraj syntax cache</text>
<text x="120" y="424" text-anchor="middle" font-size="10" fill="#8b949e">Returns top-2 chunks</text>
<text x="120" y="441" text-anchor="middle" font-size="9" fill="#484f58">on-demand / always for Ollama</text>

<!-- run_cpptraj_script (center x=285) -->
<rect x="215" y="350" width="140" height="100" rx="8" fill="#161b22" stroke="#3fb950" stroke-width="1.5"/>
<text x="285" y="371" text-anchor="middle" font-size="10" font-weight="bold" fill="#3fb950">run_cpptraj_script</text>
<line x1="215" y1="378" x2="355" y2="378" stroke="#3fb950" stroke-width="0.8"/>
<text x="285" y="394" text-anchor="middle" font-size="10" fill="#8b949e">Writes &amp; executes</text>
<text x="285" y="409" text-anchor="middle" font-size="10" fill="#8b949e">cpptraj subprocess</text>
<text x="285" y="424" text-anchor="middle" font-size="10" fill="#8b949e">stdout + output files</text>
<text x="285" y="441" text-anchor="middle" font-size="9" fill="#484f58">fresh process each call</text>

<!-- run_python_script (center x=450) -->
<rect x="380" y="350" width="140" height="100" rx="8" fill="#161b22" stroke="#58a6ff" stroke-width="1.5"/>
<text x="450" y="371" text-anchor="middle" font-size="10" font-weight="bold" fill="#58a6ff">run_python_script</text>
<line x1="380" y1="378" x2="520" y2="378" stroke="#58a6ff" stroke-width="0.8"/>
<text x="450" y="394" text-anchor="middle" font-size="10" fill="#8b949e">Executes Python</text>
<text x="450" y="409" text-anchor="middle" font-size="10" fill="#8b949e">pandas / numpy / scipy</text>
<text x="450" y="424" text-anchor="middle" font-size="10" fill="#8b949e">stdout + plot files</text>
<text x="450" y="441" text-anchor="middle" font-size="9" fill="#484f58">post-process &amp; plotting</text>

<!-- read_output_file (center x=615) -->
<rect x="545" y="350" width="140" height="100" rx="8" fill="#161b22" stroke="#bc8cff" stroke-width="1.5"/>
<text x="615" y="371" text-anchor="middle" font-size="10" font-weight="bold" fill="#bc8cff">read_output_file</text>
<line x1="545" y1="378" x2="685" y2="378" stroke="#bc8cff" stroke-width="0.8"/>
<text x="615" y="394" text-anchor="middle" font-size="10" fill="#8b949e">Reads .dat or any</text>
<text x="615" y="409" text-anchor="middle" font-size="10" fill="#8b949e">output file from disk</text>
<text x="615" y="424" text-anchor="middle" font-size="10" fill="#8b949e">Returns raw content</text>
<text x="615" y="441" text-anchor="middle" font-size="9" fill="#484f58">inspect results</text>

<!-- list_output_files (center x=780) -->
<rect x="710" y="350" width="140" height="100" rx="8" fill="#161b22" stroke="#f85149" stroke-width="1.5"/>
<text x="780" y="371" text-anchor="middle" font-size="10" font-weight="bold" fill="#f85149">list_output_files</text>
<line x1="710" y1="378" x2="850" y2="378" stroke="#f85149" stroke-width="0.8"/>
<text x="780" y="394" text-anchor="middle" font-size="10" fill="#8b949e">Lists all files in</text>
<text x="780" y="409" text-anchor="middle" font-size="10" fill="#8b949e">session working dir</text>
<text x="780" y="424" text-anchor="middle" font-size="10" fill="#8b949e">Returns file list</text>
<text x="780" y="441" text-anchor="middle" font-size="9" fill="#484f58">check state</text>

<!-- ─── Fan-in via bottom bus ─── -->
<!-- Stems from tool bottoms (y=450) to bottom bus (y=490) -->
<line x1="120" y1="450" x2="120" y2="490" stroke="#8b949e" stroke-width="1.5"/>
<line x1="285" y1="450" x2="285" y2="490" stroke="#8b949e" stroke-width="1.5"/>
<line x1="450" y1="450" x2="450" y2="490" stroke="#8b949e" stroke-width="1.5"/>
<line x1="615" y1="450" x2="615" y2="490" stroke="#8b949e" stroke-width="1.5"/>
<line x1="780" y1="450" x2="780" y2="490" stroke="#8b949e" stroke-width="1.5"/>
<!-- Bottom bus horizontal: y=490, x=120 to x=780 -->
<line x1="120" y1="490" x2="780" y2="490" stroke="#8b949e" stroke-width="1.5"/>
<!-- Single arrow from bus centre down to Tool Result -->
<line x1="450" y1="490" x2="450" y2="517" stroke="#8b949e" stroke-width="1.5" marker-end="url(#arr)"/>

<!-- ═══ Tool Result ═══ -->
<rect x="300" y="520" width="300" height="52" rx="8" fill="#161b22" stroke="#30363d" stroke-width="1.5"/>
<text x="450" y="542" text-anchor="middle" font-size="13" font-weight="bold" fill="#e6edf3">Tool Result</text>
<text x="450" y="560" text-anchor="middle" font-size="11" fill="#8b949e">Appended to conversation history</text>

<!-- Arrow down -->
<line x1="450" y1="572" x2="450" y2="598" stroke="#8b949e" stroke-width="1.5" marker-end="url(#arr)"/>

<!-- ═══ Tool Result β†’ loop back to LLM (left side, green) ═══ -->
<line x1="300" y1="546" x2="30"  y2="546" stroke="#3fb950" stroke-width="1.5"/>
<line x1="30"  y1="546" x2="30"  y2="247" stroke="#3fb950" stroke-width="1.5"/>
<line x1="30"  y1="247" x2="298" y2="247" stroke="#3fb950" stroke-width="1.5" marker-end="url(#arr-green)"/>
<text x="16" y="410" text-anchor="middle" font-size="11" font-weight="bold" fill="#3fb950" transform="rotate(-90 16 410)">More tool calls needed β€” loop back</text>
<!-- Safety limit note on loop -->
<rect x="35" y="528" width="148" height="26" rx="4" fill="#21262d" stroke="#e3b341" stroke-width="1"/>
<text x="109" y="540" text-anchor="middle" font-size="9" fill="#e3b341">⚠ Safety limit: max 15 calls</text>
<text x="109" y="551" text-anchor="middle" font-size="9" fill="#484f58">auto-stops if exceeded</text>

<!-- ═══ LLM β†’ Final Response direct (right side, task complete) ═══ -->
<line x1="600" y1="247" x2="870" y2="247" stroke="#8b949e" stroke-width="1.5" stroke-dasharray="5,3"/>
<line x1="870" y1="247" x2="870" y2="630" stroke="#8b949e" stroke-width="1.5" stroke-dasharray="5,3"/>
<line x1="870" y1="630" x2="602" y2="630" stroke="#8b949e" stroke-width="1.5" stroke-dasharray="5,3" marker-end="url(#arr)"/>
<text x="884" y="440" text-anchor="middle" font-size="11" fill="#8b949e" transform="rotate(90 884 440)">Task complete β€” no tool needed</text>

<!-- Arrow from Tool Result down to Final Response -->
<line x1="450" y1="572" x2="450" y2="600" stroke="#8b949e" stroke-width="1.5" marker-end="url(#arr)"/>

<!-- ═══ Final Response ═══ -->
<rect x="300" y="603" width="300" height="52" rx="8" fill="#1a7f37" stroke="#3fb950" stroke-width="1.5"/>
<text x="450" y="625" text-anchor="middle" font-size="13" font-weight="bold" fill="#ffffff">Final Response</text>
<text x="450" y="643" text-anchor="middle" font-size="11" fill="#aff5b4">1–2 sentence summary streamed to user</text>

<!-- ═══ Legend ═══ -->
<rect x="20" y="675" width="860" height="82" rx="8" fill="#161b22" stroke="#30363d" stroke-width="1"/>
<text x="450" y="695" text-anchor="middle" font-size="12" font-weight="bold" fill="#e6edf3">Legend</text>
<rect x="38"  y="706" width="12" height="12" rx="2" fill="#f0883e"/>
<text x="56"  y="717" font-size="10" fill="#8b949e">RAG / Docs search</text>
<rect x="175" y="706" width="12" height="12" rx="2" fill="#3fb950"/>
<text x="193" y="717" font-size="10" fill="#8b949e">cpptraj execution</text>
<rect x="310" y="706" width="12" height="12" rx="2" fill="#58a6ff"/>
<text x="328" y="717" font-size="10" fill="#8b949e">Python execution</text>
<rect x="445" y="706" width="12" height="12" rx="2" fill="#bc8cff"/>
<text x="463" y="717" font-size="10" fill="#8b949e">File read</text>
<rect x="540" y="706" width="12" height="12" rx="2" fill="#f85149"/>
<text x="558" y="717" font-size="10" fill="#8b949e">File listing</text>
<line x1="640" y1="712" x2="665" y2="712" stroke="#3fb950" stroke-width="1.5"/>
<text x="672" y="717" font-size="10" fill="#8b949e">Loop back</text>
<line x1="745" y1="712" x2="775" y2="712" stroke="#8b949e" stroke-width="1.5" stroke-dasharray="4,3"/>
<text x="782" y="717" font-size="10" fill="#8b949e">Task complete</text>
<text x="450" y="747" text-anchor="middle" font-size="10" fill="#484f58">Each run_cpptraj_script is a fresh process β€” write intermediates to disk, reload via readdata</text>

</svg>