-
Notifications
You must be signed in to change notification settings - Fork 426
Refactor AgentScope Studio #586
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors AgentScope Studio by enhancing user agent input handling, refactoring model invocation recording with a new usage metric model, and optimizing the overall architecture by reducing reliance on the global studio client.
- Enhanced User Agent Implementation with custom input sources
- Improved Model Wrapper Architecture using ChatUsage for consistent usage tracking
- Optimized architecture by replacing global StudioClient references with direct HTTP API calls
Reviewed Changes
Copilot reviewed 122 out of 122 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
src/agentscope/models/yi_model.py | Added ChatUsage usage handling for formatting and updating monitor tokens. |
src/agentscope/models/openai_model.py | Integrated ChatUsage for model invocation recording with condition checks for required tokens. |
src/agentscope/models/ollama_model.py | Refactored usage handling by wrapping token counts in ChatUsage. |
src/agentscope/models/model.py | Introduced _class_hooks_save_model_invocation and integrated ChatUsage usage into invocation records. |
src/agentscope/models/litellm_model.py | Added ChatUsage usage integration; note potential inconsistency in passing usage to model invocation. |
src/agentscope/models/gemini_model.py | Updated token utilization formatting using ChatUsage. |
src/agentscope/models/dashscope_model.py | Replaced direct token value references with ChatUsage usage formatting in monitor update and invocation. |
src/agentscope/models/anthropic_model.py | Incorporated ChatUsage usage handling for model invocation and monitor update. |
src/agentscope/models/_model_usage.py | Introduced the ChatUsage model for standardized usage metrics. |
src/agentscope/manager/_manager.py | Replaced StudioClient integration with direct HTTP calls and added hooks for model invocation pushing. |
src/agentscope/logging.py | Removed StudioClient-dependent logging and gradio integration for a cleaner logging output. |
src/agentscope/agents/_user_input.py | Added StudioUserInput and TerminalUserInput classes for flexible user input handling. |
src/agentscope/agents/_user_agent.py | Added input method override functions and updated user input integration in reply generation. |
src/agentscope/agents/_react_agent_v2.py | Updated agent reply to use the speak method for message dispatch. |
src/agentscope/agents/_agent.py | Introduced _reply_id generation to uniquely identify agent replies. |
examples/environments/chatroom/envs/chatroom.py | Updated chat room agent to extend UserAgent and utilize the new input method. |
examples/distributed_debate/user_proxy_agent.py | Adjusted user proxy agent reply signature to use structured output. |
setup.py | Removed unused studio static assets to match the refactored architecture. |
Description
This PR is part of the AgentScope Studio refactoring initiative.
Changes
Enhanced User Agent Implementation
_input_method
attribute (callable) to handle user input from various sourcesTerminalUserInput
for command-line interactionsStudioUserInput
for studio-based interactionsImproved Model Wrapper Architecture
_class_hooks_save_model_invocation
attribute inModelWrapperBase
class to support model invocation recordingChatUsage
class to standardize usage metrics for chat-based LLMsArchitecture Optimization
_studio_client
variable andStudioClient
classChecklist
Please check the following items before code is ready to be reviewed.