-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Feature - Delete Agent fix #473 and #529 #558
Feature - Delete Agent fix #473 and #529 #558
Conversation
migration for adding is_deleted to agent is missing |
Hey @Fluder-Paradyne do you want me to add that . py file which got created after alembic migration? |
Yes, |
Hey @Fluder-Paradyne I have removed the drop index and create index commands from the migration file. Please have a look thanx! |
sure @TransformerOptimus will incorporate these |
Hi @TransformerOptimus, I've incorporated the review changes, please review the changes. Lemme know if any other changes are required. Thanking you! |
c1dce6e
to
2710aca
Compare
…ngrade head for the delete agent migration file
if not project: | ||
if project := db.session.query(Project).get(agent.project_id): | ||
db_agent.project_id = project.id | ||
else: |
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.
why is this changed, any specific reason?
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.
just refactored it, reduces lines of code. thought will make it more pythonic
@@ -438,14 +442,14 @@ def get_agent_configuration(agent_id: int, | |||
dict: Agent configuration including its details. | |||
|
|||
Raises: | |||
HTTPException (status_code=404): If the agent is not found. | |||
HTTPException (status_code=404): If the agent is not found or deleted. | |||
""" | |||
|
|||
# Define the agent_config keys to fetch | |||
keys_to_fetch = AgentTemplate.main_keys() | |||
agent = db.session.query(Agent).filter(agent_id == Agent.id).first() | |||
|
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.
Can you update in the query itself rather than doing after fetching from DB?
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.
sure we can do this
superagi/controllers/agent.py
Outdated
db.session.commit() | ||
|
||
return {"success": True} | ||
|
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.
Can we just handle by HTTP status code we are trying to avoid success/failure messages
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.
sure will incorporate this
… element key in order to tackle the update.
Description
The Delete Agent feature is capable of soft-deleting an active agent. This makes sure to update the status flags in both AgentExecution and AgentExecutionPermission. The feature update comes with a new Column in the Agent Table named as is_delete: boolean, representing whether the agent is deleted or not.
Related Issues
close #473 and #529
Solution and Design
Test Plan
Backend (using PostMan)
Update the new database format in the superagi-backend docker. Steps:
-
alembic upgrade head
-
alembic revision --autogenerate -m "Some descriptive message"
-
alembic upgrade head
Create an agent from the front-end
Note the agent-id (this will be used to delete the agent later)
Delete the agent using the /agents/delete endpoint.
Reload the SuperAGI home screen.
Frontend
localhost:3000
Type of change
Checklist