Files
llm-multiverse/implementation-plans/issue-086.md
Pi Agent cbd1b5377e feat: implement assistant agent type (issue #86)
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>
2026-03-11 08:15:15 +01:00

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 PromptBuilder with a custom ASSISTANT_SYSTEM_PROMPT
  • Routes via AGENT_TYPE_ASSISTANT (proto value 5) in service.py

Existing Patterns

  • researcher.py — base pattern (web_search + memory_read only)
  • coder.py — extended pattern with tool-output source tracking
  • prompt.py — parameterized PromptBuilder with system_prompt field
  • config.pyAgentConfig dataclass 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: AgentConfig field to Config dataclass
  • Add YAML loading for assistant section in Config.load()

2. Core Logic

  • Create AssistantAgent class in assistant.py
  • Mirror researcher pattern exactly (web_search + memory_read tools only)
  • No _TOOL_OUTPUT_SOURCES tracking (assistant has no fs/code tools)
  • Source tracking: web_search → RESULT_SOURCE_WEB, else RESULT_SOURCE_MODEL_KNOWLEDGE
  • Agent ID prefix: ast-{uuid}
  • Agent-specific messages: "Assistance incomplete: {reason}", "Assistance failed."

3. System Prompt

  • Add ASSISTANT_SYSTEM_PROMPT to prompt.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 AssistantAgent in service.py
  • Instantiate with self._config.assistant
  • Route AGENT_TYPE_ASSISTANT subtasks to assistant.run()

5. Tests

  • Create tests/test_assistant.py mirroring test_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