You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(agent): render Site Audit results inline in the chat #272
When the assistant runs/reads a Site Audit (#271), render the result as a compact inline audit card in the chat — score gauge, category bars, and the top recommendations — instead of a raw JSON tool-call disclosure.
Why
The Agent already renders charts inline via render_chart; an audit result is far more useful as the same kind of rich inline card than as a JSON blob. It mirrors the existing pattern and reuses the dashboard's audit UI.
Approach (mirror render_chart / AgentChart)
Add an echo-stylerender_audit tool to buildAgentTools (web/src/lib/agent/tools.ts) — like render_chart, its execute just returns its input. Schema carries the displayable fields: { url, totalScore, categoryScores, recommendations[], signalsEvaluated, signalsTotal }. The system prompt instructs the model to call it after get_site_audit/run_site_audit.
In web/src/app/[locale]/(dashboard)/dashboard/agent/page.tsxMessageBubble, add a branch part.type === 'tool-render_audit' → <AuditResultCard .../> (everything else still falls through to the generic JSON disclosure), matching how tool-render_chart → <ChartToolPart> works.
Build the card by reusing/adapting web/src/components/audit/audit-report.tsx (it already renders score gauge + category bars + recommendations); a compact variant is fine for the chat width.
Acceptance
After an audit tool call, the chat shows a readable audit card (score + grade, category breakdown, top fixes) — not raw JSON
Card visual language matches the dashboard audit report (score-band colors, etc.)
Non-audit tool calls are unaffected (still use the generic disclosure)
Assigned — thanks @BharadwajKanneveti! 🎉 Two pointers: (1) this builds on #271 (running/reading a Site Audit from the agent), so it's cleanest to land once the audit tool exists — feel free to coordinate or stack the PRs. (2) Mirror the existing render_chart / AgentChart pattern: add an echo-style render_audit tool in buildAgentTools and reuse the dashboard's audit UI (AuditReport and its pct/scoreColor/CATEGORY_META exports) so the inline card matches the rest of the product.
Quick update, @BharadwajKanneveti — the dependency for this, #271 (running/reading a Site Audit from the agent), is now implemented in #307. Once that merges, the run_site_audit / get_site_audit agent tools you'll build the inline card on top of will be in main. Feel free to start now by stacking on #307, or wait for it to land — whichever you prefer.
As a reminder, the cleanest path is an echo-style render_audit tool in buildAgentTools mirroring render_chart / AgentChart, reusing the dashboard's AuditReport (pct / scoreColor / CATEGORY_META) so the inline card matches the rest of the product. Ping me if you'd like a hand — no rush, just flagging that you're unblocked.
Thanks for the update @gkhngyk I see #307 has been merged now.
I'll rebase onto the latest main and continue implementing the inline audit rendering on top of the new audit tools, following the existing render_chart / AgentChart pattern and reusing the dashboard audit UI helpers to keep the card consistent with the rest of the product.
Good news: the dependency (#271, the agent Site Audit tools) is merged, so this is fully unblocked now. The audit tools (run_site_audit, get_site_audit, list audits) are live in web/src/lib/agent/tools.ts, and the render_chart → ChartToolPart pattern this issue mirrors is right there in web/src/app/[locale]/(dashboard)/dashboard/agent/page.tsx to copy from.
So the two pieces left are: (1) add an echo-style render_audit tool alongside render_chart in tools.ts, and (2) add a part.type === 'tool-render_audit' branch in MessageBubble that renders an AuditResultCard (reuse/adapt web/src/components/audit/audit-report.tsx).
Are you still planning to take it? Take your time if so — just wanted to flag that the blocker is gone. If you'd rather pass on it, no worries at all, just let us know and we'll leave it open for someone else. Thanks! 🙌
Hi @gkhngyk I have already made the changes you asked for but currently I am facing an issue with with claude api where in the rendering the agent is not responding to my answers to see my changes working or not so is there any way to resolve this ?
Sorry for not raising this prior to you
That's just a local setup thing, not a bug in your changes: the in-product agent (web/src/app/api/agent/chat/route.ts) calls Anthropic, and in self-host mode it reads the key from process.env.ANTHROPIC_API_KEY (see web/src/lib/agent/key.ts). If that env var isn't set, the agent stays silent — which is exactly the "no response" you're seeing.
Fix: add your own key to web/.env.local and restart yarn dev:
ANTHROPIC_API_KEY=sk-ant-... # from https://console.anthropic.com
(You'll need your own key — we can't share ours.)
Also: feel free to open your PR as a draft even before you can test the chat locally — reviewers can verify the audit card renders with a real key on our side, so you don't have to stay blocked on this. Thanks again! 🙌
Activity
BharadwajKanneveti commentedon Jun 22, 2026
Hi @gkhngyk can I work on this issue?
gkhngyk commentedon Jun 23, 2026
Assigned — thanks @BharadwajKanneveti! 🎉 Two pointers: (1) this builds on #271 (running/reading a Site Audit from the agent), so it's cleanest to land once the audit tool exists — feel free to coordinate or stack the PRs. (2) Mirror the existing
render_chart/AgentChartpattern: add an echo-stylerender_audittool inbuildAgentToolsand reuse the dashboard's audit UI (AuditReportand itspct/scoreColor/CATEGORY_METAexports) so the inline card matches the rest of the product.gkhngyk commentedon Jun 27, 2026
Quick update, @BharadwajKanneveti — the dependency for this, #271 (running/reading a Site Audit from the agent), is now implemented in #307. Once that merges, the
run_site_audit/get_site_auditagent tools you'll build the inline card on top of will be inmain. Feel free to start now by stacking on #307, or wait for it to land — whichever you prefer.As a reminder, the cleanest path is an echo-style
render_audittool inbuildAgentToolsmirroringrender_chart/AgentChart, reusing the dashboard'sAuditReport(pct/scoreColor/CATEGORY_META) so the inline card matches the rest of the product. Ping me if you'd like a hand — no rush, just flagging that you're unblocked.BharadwajKanneveti commentedon Jun 27, 2026
Thanks for the update @gkhngyk I see #307 has been merged now.
I'll rebase onto the latest
mainand continue implementing the inline audit rendering on top of the new audit tools, following the existingrender_chart/AgentChartpattern and reusing the dashboard audit UI helpers to keep the card consistent with the rest of the product.gkhngyk commentedon Jul 9, 2026
Hey @BharadwajKanneveti — friendly check-in on this one, no pressure. 🙂
Good news: the dependency (#271, the agent Site Audit tools) is merged, so this is fully unblocked now. The audit tools (
run_site_audit,get_site_audit, list audits) are live inweb/src/lib/agent/tools.ts, and therender_chart→ChartToolPartpattern this issue mirrors is right there inweb/src/app/[locale]/(dashboard)/dashboard/agent/page.tsxto copy from.So the two pieces left are: (1) add an echo-style
render_audittool alongsiderender_chartintools.ts, and (2) add apart.type === 'tool-render_audit'branch inMessageBubblethat renders anAuditResultCard(reuse/adaptweb/src/components/audit/audit-report.tsx).Are you still planning to take it? Take your time if so — just wanted to flag that the blocker is gone. If you'd rather pass on it, no worries at all, just let us know and we'll leave it open for someone else. Thanks! 🙌
BharadwajKanneveti commentedon Jul 9, 2026
Hi @gkhngyk I have already made the changes you asked for but currently I am facing an issue with with claude api where in the rendering the agent is not responding to my answers to see my changes working or not so is there any way to resolve this ?
Sorry for not raising this prior to you
gkhngyk commentedon Jul 9, 2026
No worries at all, @BharadwajKanneveti — and great that the code is done! 🙌
That's just a local setup thing, not a bug in your changes: the in-product agent (
web/src/app/api/agent/chat/route.ts) calls Anthropic, and in self-host mode it reads the key fromprocess.env.ANTHROPIC_API_KEY(seeweb/src/lib/agent/key.ts). If that env var isn't set, the agent stays silent — which is exactly the "no response" you're seeing.Fix: add your own key to
web/.env.localand restartyarn dev:ANTHROPIC_API_KEY=sk-ant-... # from https://console.anthropic.com(You'll need your own key — we can't share ours.)
Also: feel free to open your PR as a draft even before you can test the chat locally — reviewers can verify the audit card renders with a real key on our side, so you don't have to stay blocked on this. Thanks again! 🙌
BharadwajKanneveti commentedon Jul 9, 2026
Sure @gkhngyk I will raise the PR thanks!