Skip to content

feat: smarter agent — streaming tokens, thinking UI, create_note, multi-query retrieval#117

Open
nv78 wants to merge 2 commits intoclaude/autonomous-agent-corefrom
claude/autonomous-agent-improvements
Open

feat: smarter agent — streaming tokens, thinking UI, create_note, multi-query retrieval#117
nv78 wants to merge 2 commits intoclaude/autonomous-agent-corefrom
claude/autonomous-agent-improvements

Conversation

@nv78
Copy link
Member

@nv78 nv78 commented Mar 24, 2026

Summary

Backend — 2 new tools + better system prompt

create_note — The agent can now save any generated content (summaries, to-do lists, reports) as a real document in the user's knowledge base, indexed and searchable immediately via retrieve_documents. Use cases: "Summarize all my documents and save it", "Create a to-do list from this meeting transcript".

retrieve_documents_multi — Runs 2–5 retrieval queries in parallel and merges deduplicated results. Better than calling retrieve_documents once for complex questions requiring cross-document evidence. Use cases: "Compare X and Y across all documents", "Find all mentions of topic A, B, and C".

Improved system prompt — Replaced the 10-bullet list with a 4-step decision framework:

  1. Orient (what kind of question?)
  2. Retrieve (pull all info before answering)
  3. Synthesize (cite sources, use markdown)
  4. Persist (optionally call create_note)

Frontend — real-time streaming display

messageUtils.js:

  • text_token events now append to message.content in real-time → users see the answer forming token-by-token instead of waiting for the full response
  • thinking events create a dedicated reasoning step (extended thinking from claude-3-7+)
  • complete event preserves streamed content if answer field is empty (prevents flash)

ThinkingIndicator.js: thinking step type gets a yellow faLightbulb icon and distinct border-l-yellow-400 styling, visually distinct from regular reasoning steps.

Test plan

  • Ask a multi-document question → agent calls retrieve_documents_multi with multiple queries
  • Ask "Summarize all my documents and save it" → agent calls create_note, note appears in sidebar
  • Send a message → text appears token-by-token (streaming) instead of all at once
  • With a claude-3-7 model → thinking steps appear with yellow icon in reasoning panel

https://claude.ai/code/session_01C9mHttiQ4ZAaBbQecVV7uu

claude added 2 commits March 24, 2026 21:56
Backend (autonomous_agent.py):
- New create_note tool: agent can save summaries/lists as searchable
  documents (indexed immediately via the RAG pipeline)
- New retrieve_documents_multi tool: parallel multi-query retrieval with
  deduplication — better for complex cross-document questions
- Overhauled system prompt with a 4-step decision framework: Orient →
  Retrieve → Synthesize → Persist, with explicit tool-selection rules

Frontend:
- messageUtils.js: handle text_token events → text appears token-by-token
  as the agent streams; handle thinking events → added to reasoning steps
- messageUtils.js: complete event preserves streamed content if answer
  field is empty (prevents content flash)
- ThinkingIndicator.js: new "thinking" step type with yellow accent color
  (distinct from regular reasoning steps) for extended thinking blocks

https://claude.ai/code/session_01C9mHttiQ4ZAaBbQecVV7uu
New tools (15 total):
- think: internal reasoning scratchpad before complex actions
- send_email: SMTP email via MAIL_USERNAME/MAIL_PASSWORD env vars
- create_calendar_invite: ICS file + Google Calendar URL generation
- extract_structured_data: AI-powered JSON extraction from raw text
- generate_chart: matplotlib bar/line/pie/scatter/histogram → inline PNG
- translate_text: LLM-based translation to any language
- call_webhook: HTTP POST to external URLs (Zapier, Slack, REST APIs)

Orchestration improvements:
- Parallel tool execution via ThreadPoolExecutor (up to 4 concurrent)
- Comprehensive routing system prompt with explicit tool decision tree
- think tool hidden from UI (internal scratchpad, no tool_start event)
- chart_generated SSE event emitted per chart for real-time rendering

Frontend:
- messageUtils.js handles chart_generated and complete.charts events
- Chatbot.js renders inline chart images (streaming + final state)
- Charts shown during streaming and preserved in final message

https://claude.ai/code/session_01C9mHttiQ4ZAaBbQecVV7uu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants