Add AssistantAgent class with conversational system prompt, minimal tool set (web_search, memory_read only), and AGENT_TYPE_ASSISTANT routing. 29 tests, 98% coverage on new code. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
3.7 KiB
3.7 KiB
Issue #86: Implement assistant agent type
Metadata
| Field | Value |
|---|---|
| Issue | #86 |
| Title | Implement assistant agent type |
| Milestone | Phase 10: Remaining Agent Types |
| Status | PLANNED |
| Language | Python |
| Related Plans | issue-069.md, issue-081.md |
| Blocked by | #69, #52 |
Acceptance Criteria
- Assistant system prompt emphasizing helpful conversation, summarization, Q&A
- Agent manifest with allowed tools: web_search, memory_query only
- No file system or code execution access
- No network egress beyond search
- Uses the same agent loop infrastructure as researcher
- Optimized for conversational response quality
Architecture Analysis
Service Context
- Orchestrator service — new agent type alongside researcher and coder
- Uses the same
PromptBuilderwith a customASSISTANT_SYSTEM_PROMPT - Routes via
AGENT_TYPE_ASSISTANT(proto value 5) inservice.py
Existing Patterns
researcher.py— base pattern (web_search + memory_read only)coder.py— extended pattern with tool-output source trackingprompt.py— parameterizedPromptBuilderwithsystem_promptfieldconfig.py—AgentConfigdataclass reused per agent type
Dependencies
common_pb2.AGENT_TYPE_ASSISTANT(value 5) — already defined in proto- No new proto changes needed
- No new external libraries
Implementation Steps
1. Types & Configuration
- Add
assistant: AgentConfigfield toConfigdataclass - Add YAML loading for
assistantsection inConfig.load()
2. Core Logic
- Create
AssistantAgentclass inassistant.py - Mirror researcher pattern exactly (web_search + memory_read tools only)
- No
_TOOL_OUTPUT_SOURCEStracking (assistant has no fs/code tools) - Source tracking: web_search →
RESULT_SOURCE_WEB, elseRESULT_SOURCE_MODEL_KNOWLEDGE - Agent ID prefix:
ast-{uuid} - Agent-specific messages: "Assistance incomplete: {reason}", "Assistance failed."
3. System Prompt
- Add
ASSISTANT_SYSTEM_PROMPTtoprompt.py - Conversational tone, emphasizing helpful responses, summarization, Q&A
- Capabilities: web_search, memory_read only
- No file system or code references
- Encourage clear, well-structured answers
4. Service Integration
- Import
AssistantAgentinservice.py - Instantiate with
self._config.assistant - Route
AGENT_TYPE_ASSISTANTsubtasks toassistant.run()
5. Tests
- Create
tests/test_assistant.pymirroringtest_researcher.py - Key assistant-specific tests:
- Uses AGENT_TYPE_ASSISTANT for tool discovery/execution
- Agent ID prefix is
ast- - Uses ASSISTANT_SYSTEM_PROMPT
- Only web_search and memory_read tools available
- Source tracking: web → WEB, default → MODEL_KNOWLEDGE
- No tool-output source (no fs/code tools)
- Standard tests: happy path, tool discovery, empty tools, execution, memory, max iterations, timeout, failures, gateway errors, confidence, unknown tools, discovery errors, memory unavailable, parse errors, reasoning, execution errors, compaction
Files to Create/Modify
| File | Action | Purpose |
|---|---|---|
services/orchestrator/src/orchestrator/assistant.py |
Create | AssistantAgent class |
services/orchestrator/tests/test_assistant.py |
Create | Unit tests |
services/orchestrator/src/orchestrator/prompt.py |
Modify | Add ASSISTANT_SYSTEM_PROMPT |
services/orchestrator/src/orchestrator/config.py |
Modify | Add assistant AgentConfig |
services/orchestrator/src/orchestrator/service.py |
Modify | Route AGENT_TYPE_ASSISTANT |
Risks and Edge Cases
- Assistant is closest to researcher pattern — minimal risk
- Must ensure no fs/code tools leak through (enforced by tool broker manifest, not agent code)
Deviation Log
| Deviation | Reason |
|---|