Repository navigation
feat(chat): add an Agent mode that uses tools, and the agent-mode plan - #34
Merged
Merged
Conversation
Six phases: agent mode in chat, attachments and web search through the agent, plans and approvals in the conversation, desktop control tools, a hands-free voice loop, and developer mode. Lists what already exists in the repo, the gaps, and what "done" means for each phase.
The desktop app serves with --agent simple, so its chat never called tools. Add an Agent toggle next to Web search and Deep Research. - Chat requests take an optional mode, "chat" or "agent". Unset keeps the existing routing, so the server's configured agent still answers. - Agent mode reuses the configured agent when it has tools; otherwise it builds an orchestrator on first use with read-only tools (think, calculator, file_read, pdf_extract, memory_manage). file_read stays in the home folder unless security.allowed_dirs is set. Writing files and running commands wait for approvals in the chat. - Agent streams forward that agent's turn and tool events as they happen, so tool cards fill in live. Events from other agents on the bus are skipped. - Warn when the selected model is under 4B, and give a chat answer when the conversation has web search or attachments, which the agent can't use yet. - Add an "assistant" preset with the same tools.
5 of 6 tasks
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.
What does this PR do?
The desktop app starts the server with
--agent simple, so its chat never calls tools. This PR adds an Agent toggle to the chat, next to Web search and Deep Research. It also adds a six-phase plan for turning Locus into an agent that does tasks; this PR is phase 1.Plan:
docs/design/2026-11-08-agent-mode-plan.mdcovers what already exists in the repo, the gaps, and six phases with what "done" means for each:Phase 1:
/v1/chat/completionstakes an optionalmode, either"chat"or"agent". Leaving it unset keeps the current routing, solocus guiusers on the defaultorchestratorsee no change.orchestratorthe first time it's needed (src/locus/server/task_agent.py) and caches it onapp.state.task_agent.think,calculator,file_read,pdf_extractandmemory_manage.file_readstays inside the home folder unlesssecurity.allowed_dirsis set. Writing files and running commands wait for phase 3, because the server can't ask for approval yet.agent_turn_start,tool_call_startandtool_call_endevents while it runs, so the existing tool cards fill in live. Events from other agents on the bus are filtered out.assistantpreset (locus init --preset assistant) uses the same tools. It's listed in the README.How was this tested?
tests/server/test_agent_mode.pyhas 7 tests covering:modelSizeBillionsandisSmallForAgenttests. All 128 vitest tests pass andtsc -bis clean.tests/server, the preset tests and the CLI tests give 546 passed and 9 failed. The same 9 fail onmainwithout this change. They're intest_api_routes(TestAgentRoutes),test_connectors_router,test_deep_research_tools_wiringandtest_security_factory_wiring, and at least one needs thelocus_rustextension, which wasn't installed locally.Checklist
uv run pytest tests/ -v): new and related suites pass; the 9 failures above also fail onmainruff check)ruff format --check)