Agent Steps Timeline
An AI agent's plan shown as steps that move from waiting to running to done, with a visible result card.
AI prompt
Build an agent task card 320px wide titled "Plan a weekend trip" with a Run button. Show four steps as a vertical list with a status icon on the left: Understand the request, Search options, Compare prices, Draft the itinerary. Pending steps show an empty circle in grey, the running step shows a 16px spinner (700ms linear) and a darker label, done steps show a filled dark circle with a check that scales from 0.6 to 1 over 200ms. Pressing Run starts the sequence: each step runs 900ms then completes, one after another; the Run button becomes Stop while running and stopping marks the current step "Stopped". After the last step a result card fades in (250ms) with the text "3 options found" and two small result rows. The list is a polite live region announcing "Step 2 of 4: Search options, running". Reset returns to idle. Under prefers-reduced-motion replace the spinner with an ellipsis and remove scaling.About this pattern
Definition
Instead of one long wait, an agent shows its plan as a list of steps. Each step moves through pending, running and done, and the final result appears as a card when the last step completes.
Purpose & UX principles
- Makes automated work understandable and builds trust: people see what the agent is doing and can stop it.
- Status is conveyed by icon shape and text, not only colour or animation.
- The list is a live region updated politely, so assistive technology users hear step changes without being flooded.
Interaction states
- Idle, running (current step has a spinner), done (check mark), stopped, result visible.
Motion specification
- Each step takes about 900ms; the spinner rotates at 700ms per turn; the check mark scales in over 200ms; the result card fades in over 250ms.
- Reduced motion: no spinner rotation (a "…" marker instead), steps complete in sequence with no scaling.
Responsive behaviour
- Steps stack vertically with one line each; long step names wrap.
- Run and Reset buttons are 40px tall on touch.
Code
<div class="card"><div class="hd"><b>Plan a weekend trip</b><button id="run" type="button">Run</button></div><ol class="st" id="st" aria-live="polite"></ol><div class="res" id="res" hidden><b>3 options found</b><p>Lisbon · 2 nights · $412</p><p>Porto · 2 nights · $368</p></div></div>:root{--bg:#F1F1EF;--surface:#fff;--surface-2:#F7F7F5;--line:#E0E0DC;--text:#171717;--muted:#6f6f6f;--accent:#171717;--accent-ink:#fff;--danger:#d92d20}
*{box-sizing:border-box;margin:0}
.card{width:min(320px,100%);padding:14px;border:1px solid var(--line);border-radius:14px;background:var(--surface)}
.hd{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}
.hd b{font-size:14px;font-weight:600}
.hd button{height:32px;padding:0 14px;border-radius:99px;border:0;background:var(--accent);color:var(--accent-ink);font:inherit;font-size:12.5px;font-weight:600;cursor:pointer}
.hd button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.st{list-style:none;display:grid;gap:8px}
.st li{display:flex;align-items:center;gap:10px;font-size:13px;color:var(--muted)}
.ic{flex:none;width:18px;height:18px;border-radius:50%;border:1.5px solid #c4c4be;display:grid;place-items:center;font-size:10px;line-height:1}
.run{color:var(--text)}.run .ic{border-color:transparent;border-top-color:#171717;border-right-color:#171717;animation:r .7s linear infinite}
.done{color:var(--text)}.done .ic{background:#171717;border-color:#171717;color:#fff}
.done .ic::before{content:"✓";animation:pop .2s ease-out}
.stopped .ic::before{content:"■";font-size:7px}
@keyframes r{to{transform:rotate(360deg)}}
@keyframes pop{from{transform:scale(.6)}}
.res{margin-top:12px;padding:10px 12px;border-radius:10px;background:var(--bg);animation:fd .25s ease-out}
.res b{font-size:13px}.res p{font-size:12.5px;color:var(--muted);margin-top:3px}
@keyframes fd{from{opacity:0}}
@media (prefers-reduced-motion:reduce){.run .ic{animation:none;border-color:#171717;border-style:dotted}.done .ic::before{animation:none}.res{animation:none}}const S=['Understand the request','Search options','Compare prices','Draft the itinerary'],st=document.getElementById('st'),run=document.getElementById('run'),res=document.getElementById('res');
S.forEach(t=>{const li=document.createElement('li');li.innerHTML='<span class="ic" aria-hidden="true"></span><span>'+t+'</span>';st.append(li);});
const L=[...st.children];let idx=-1,t=0,on=false;
function mark(i,c){L[i].className=c;L[i].querySelector('span:last-child').setAttribute('data-s',c);}
function reset(){clearTimeout(t);on=false;idx=-1;L.forEach(l=>l.className='');res.hidden=true;run.textContent='Run';}
function next(){if(idx>=0)mark(idx,'done');idx++;if(idx>=S.length){on=false;run.textContent='Run again';res.hidden=false;return;}
mark(idx,'run');L[idx].setAttribute('aria-label','Step '+(idx+1)+' of '+S.length+': '+S[idx]+', running');t=setTimeout(next,900);}
run.addEventListener('click',()=>{if(on){clearTimeout(t);mark(idx,'stopped');on=false;run.textContent='Run again';return;}reset();on=true;run.textContent='Stop';next();});One complete HTML file. Save it and open it in a browser.
<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Agent Steps Timeline — demo</title>
<style>
:root{--bg:#F1F1EF;--surface:#fff;--surface-2:#F7F7F5;--line:#E0E0DC;--text:#171717;--muted:#6f6f6f;--accent:#171717;--accent-ink:#fff;--danger:#d92d20}
*{box-sizing:border-box;margin:0}
html,body{height:100%}body{background:var(--bg);color:var(--text);font:15px/1.5 -apple-system,BlinkMacSystemFont,'Segoe UI',Inter,Roboto,sans-serif;-webkit-font-smoothing:antialiased}.stage{min-height:100%;display:grid;place-items:center;padding:24px}button,input,select,textarea{font-family:inherit}@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto}}
.card{width:min(320px,100%);padding:14px;border:1px solid var(--line);border-radius:14px;background:var(--surface)}
.hd{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}
.hd b{font-size:14px;font-weight:600}
.hd button{height:32px;padding:0 14px;border-radius:99px;border:0;background:var(--accent);color:var(--accent-ink);font:inherit;font-size:12.5px;font-weight:600;cursor:pointer}
.hd button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.st{list-style:none;display:grid;gap:8px}
.st li{display:flex;align-items:center;gap:10px;font-size:13px;color:var(--muted)}
.ic{flex:none;width:18px;height:18px;border-radius:50%;border:1.5px solid #c4c4be;display:grid;place-items:center;font-size:10px;line-height:1}
.run{color:var(--text)}.run .ic{border-color:transparent;border-top-color:#171717;border-right-color:#171717;animation:r .7s linear infinite}
.done{color:var(--text)}.done .ic{background:#171717;border-color:#171717;color:#fff}
.done .ic::before{content:"✓";animation:pop .2s ease-out}
.stopped .ic::before{content:"■";font-size:7px}
@keyframes r{to{transform:rotate(360deg)}}
@keyframes pop{from{transform:scale(.6)}}
.res{margin-top:12px;padding:10px 12px;border-radius:10px;background:var(--bg);animation:fd .25s ease-out}
.res b{font-size:13px}.res p{font-size:12.5px;color:var(--muted);margin-top:3px}
@keyframes fd{from{opacity:0}}
@media (prefers-reduced-motion:reduce){.run .ic{animation:none;border-color:#171717;border-style:dotted}.done .ic::before{animation:none}.res{animation:none}}
</style></head>
<body><div class="stage">
<div class="card"><div class="hd"><b>Plan a weekend trip</b><button id="run" type="button">Run</button></div><ol class="st" id="st" aria-live="polite"></ol><div class="res" id="res" hidden><b>3 options found</b><p>Lisbon · 2 nights · $412</p><p>Porto · 2 nights · $368</p></div></div>
</div>
<script>
const S=['Understand the request','Search options','Compare prices','Draft the itinerary'],st=document.getElementById('st'),run=document.getElementById('run'),res=document.getElementById('res');
S.forEach(t=>{const li=document.createElement('li');li.innerHTML='<span class="ic" aria-hidden="true"></span><span>'+t+'</span>';st.append(li);});
const L=[...st.children];let idx=-1,t=0,on=false;
function mark(i,c){L[i].className=c;L[i].querySelector('span:last-child').setAttribute('data-s',c);}
function reset(){clearTimeout(t);on=false;idx=-1;L.forEach(l=>l.className='');res.hidden=true;run.textContent='Run';}
function next(){if(idx>=0)mark(idx,'done');idx++;if(idx>=S.length){on=false;run.textContent='Run again';res.hidden=false;return;}
mark(idx,'run');L[idx].setAttribute('aria-label','Step '+(idx+1)+' of '+S.length+': '+S[idx]+', running');t=setTimeout(next,900);}
run.addEventListener('click',()=>{if(on){clearTimeout(t);mark(idx,'stopped');on=false;run.textContent='Run again';return;}reset();on=true;run.textContent='Stop';next();});
</script>
</body></html>