feat: smarter agent — streaming tokens, thinking UI, create_note, multi-query retrieval#117
Open
nv78 wants to merge 2 commits intoclaude/autonomous-agent-corefrom
Open
feat: smarter agent — streaming tokens, thinking UI, create_note, multi-query retrieval#117nv78 wants to merge 2 commits intoclaude/autonomous-agent-corefrom
nv78 wants to merge 2 commits intoclaude/autonomous-agent-corefrom
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 viaretrieve_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 callingretrieve_documentsonce 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:
create_note)Frontend — real-time streaming display
messageUtils.js:text_tokenevents now append tomessage.contentin real-time → users see the answer forming token-by-token instead of waiting for the full responsethinkingevents create a dedicated reasoning step (extended thinking from claude-3-7+)completeevent preserves streamed content ifanswerfield is empty (prevents flash)ThinkingIndicator.js:thinkingstep type gets a yellowfaLightbulbicon and distinctborder-l-yellow-400styling, visually distinct from regular reasoning steps.Test plan
retrieve_documents_multiwith multiple queriescreate_note, note appears in sidebarhttps://claude.ai/code/session_01C9mHttiQ4ZAaBbQecVV7uu