-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Move PromptManager to agent controller level #6526
base: main
Are you sure you want to change the base?
Conversation
1. Add new action types: SystemMessageAction and PromptExtensionAction 2. Move PromptManager initialization from CodeActAgent to AgentController 3. Send system message at initialization 4. Handle prompt extensions after first user message 5. Update CodeActAgent to handle new actions 6. Fix type issues with prompt manager methods and file paths
…ior of _apply_conversation_window
raise ValueError(f'Could not find file for module {agent_module.__name__}') | ||
prompt_dir = os.path.join(os.path.dirname(agent_module_file), 'prompts') | ||
|
||
self.prompt_manager = PromptManager( |
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.
we have specialized prompt manager for our sub agents, it subclass from PromptManager
for flexibility, it might be better to add a method to the agent
class, for example:
self.prompt_manager = self.agent.get_prompt_manager(microagent_dir, prompt_dir, ...)
then specialized subagent implementations can override and return a different prompt manager
Otherwise, if every agent will now use the same PromptManager
class, we wouldn't be able to subclass prompt manager anymore and have to push modifications into PromptManager
directly
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.
I think one of the main motivations of bringing this to the controller level would be "we want to show these prompt extension actions as events to the user, so they need to be pushed to the eventstream".
But yeah, what you said definitely make sense! We could just have a .get_prompt_manager
for the agent class :)
…ed prompt managers
Description
This PR moves the PromptManager from CodeActAgent to the agent controller level and makes prompt extensions visible to users through the event stream.
Changes
Added new action types:
SystemMessageAction
- for system messages sent at initializationPromptExtensionAction
- for prompt extensions added after first user messageMoved PromptManager initialization from CodeActAgent to AgentController:
Updated CodeActAgent:
get_action_message
Fixed type issues:
Benefits
Testing
All pre-commit checks pass, including:
To run this PR locally, use the following command: