refactor(agents): redesign how the agent classes work for call vs invokeLLM#164
Conversation
781aeef to
e0aa216
Compare
77a92af to
9fdb87c
Compare
|
[grinder] BLOCKED — cannot auto-rebase The `evaluate` CI check fails because this branch predates `docs/LOW_RISK_PULL_REQUESTS.md` being added to main (base SHA `cd3eae5`, file added at `0a8ddcd`). A rebase onto current main is required to fix this. Attempted rebase hit 13 conflicts in core agent files:
These files have had significant voice-support and judge-hardening changes on main since this branch was created — the conflicts require human judgment to resolve correctly. Action required: Drew to manually rebase this branch onto main, resolve conflicts, and push. Grinder will resume once the base SHA is updated. Verified by: |
- Replace AgentAdapter, UserSimulatorAgentAdapter, JudgeAgentAdapter abstract classes with Agent interface - Make role readonly to enforce immutability - Update UserSimulatorAgent and JudgeAgent to implement Agent directly - Replace instanceof check with role-based check in scenario-execution - Deprecate abstract classes for backwards compatibility
…oncerns - Extract LLM invocation into protected invokeLLM method in UserSimulatorAgent and JudgeAgent - Create InvokeLLMParams interface with only the params we actually pass - Create minimal InvokeLLMResult interface with only text and toolCalls (not full generateText return type) - Allows users to override invokeLLM to customize LLM calls without losing business logic - Business logic (prompt building, message prep, role reversal) stays in call() method
…rface - Replace deprecated AgentAdapter extension with Agent interface implementation - Update documentation to explain agent architecture patterns (invokeLLM vs call override) - Add comprehensive examples for different agent implementation approaches - Clarify when to use Pattern 1 (invokeLLM) vs Pattern 2 (call override)
- Add new basics/agent-architecture.mdx page with comprehensive agent patterns - Simplify test README to focus on running examples - Remove architecture details from test documentation - Fix misleading RealtimeAgentAdapter example in test docs
…erface - Change OpenAiVoiceAgent to implement AgentAdapter directly (voice agents are special cases) - Change AudioAgent to implement AgentAdapter directly - Both agents override call() method completely due to their unique requirements - Fixes lint errors and maintains backwards compatibility
- Add AudioHelpers.wrapAgentForAudio() for enabling audio on built-in agents - Remove OpenAiVoiceAgent class and inheritance-based voice agents - Update examples to use composition pattern with AudioHelpers - Make invokeLLM methods public to enable overriding - Update agent architecture docs with audio support patterns - Fix RealtimeAgentAdapter to implement Agent interface directly BREAKING: OpenAiVoiceAgent class removed, use AudioHelpers.wrapAgentForAudio() instead
…ted classes - Rename Agent interface to ScenarioAgent for clarity - Simplify InvokeLLMParams/Result types derived from generateText - Remove deprecated AgentAdapter abstract classes - Export JudgeAgent and UserSimulatorAgent classes for audio helpers - Convert OpenAiVoiceAgent to AudioHelpers.wrapAgentForOpenAiAudio utils - Update all implementations to use ScenarioAgent interface directly - Make invokeLLM methods public with proper typing - Update examples and tests to use new patterns - Remove outdated agent architecture documentation - Maintain AgentAdapter as deprecated type alias for backwards compatibility BREAKING: AgentAdapter abstract classes removed, use ScenarioAgent interface
26d67cc to
242171b
Compare
| import { expandTrace, grepTrace } from "./trace-tools"; | ||
| import { getProjectConfig } from "../../config"; | ||
| import { AgentInput, JudgeAgentAdapter, AgentRole, DEFAULT_MAX_TURNS } from "../../domain"; | ||
| import { AgentInput, ScenarioAgent, AgentRole, DEFAULT_MAX_TURNS } from "../../domain"; |
|
[grinder] READY for human review CI: green (zero failing, zero pending) Verified by:
|
|
Automated low-risk assessment This PR was evaluated against the repository's Low-Risk Pull Requests procedure and does not qualify as low risk.
This PR requires a manual review before merging. |
|
Closing as superseded by #561 (voice/TS consolidation). This PR restructures |
No description provided.