-
Notifications
You must be signed in to change notification settings - Fork 43
refactor(agents): redesign how the agent classes work for call vs invokeLLM #164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
drewdrewthis
wants to merge
8
commits into
main
Choose a base branch
from
issue163/refactor-scenario-adapters-so-that-we-are-exposing-only-the-method-that-callsinterfaces-with-the-inference-endpoints
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
- 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
fbb179a to
9c1e19a
Compare
…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
781aeef to
e0aa216
Compare
77a92af to
9fdb87c
Compare
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.
No description provided.