Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

formatting

SwiftyOS28714d37f01b
diff --git a/autogpt/agent.py b/autogpt/agent.py
index 4328dddfd0..4f951c2fe1 100644
--- a/autogpt/agent.py
+++ b/autogpt/agent.py
@@ -1,11 +1,11 @@
+import time
+
from agent_protocol import Agent, Step, Task
-import time
+
import autogpt.utils
class AutoGPT:
-
-
def __init__(self) -> None:
pass
@@ -16,12 +16,13 @@ class AutoGPT:
autogpt.utils.run(task.input)
# print(f"Created Task id: {task.task_id}")
return task
-
async def step_handler(self, step: Step) -> Step:
# print(f"step: {step}")
agent_step = await Agent.db.get_step(step.task_id, step.step_id)
- updated_step: Step = await Agent.db.update_step(agent_step.task_id, agent_step.step_id, status="completed")
+ updated_step: Step = await Agent.db.update_step(
+ agent_step.task_id, agent_step.step_id, status="completed"
+ )
updated_step.output = agent_step.input
print(f"Step completed: {updated_step}")
return updated_step
diff --git a/autogpt/db.py b/autogpt/db.py
index 3c85e5225b..d699a61235 100644
--- a/autogpt/db.py
+++ b/autogpt/db.py
@@ -9,7 +9,7 @@ import sqlite3
from typing import Dict, List, Optional
from agent_protocol import Artifact, Step, Task, TaskDB
-from agent_protocol.models import TaskInput, Status
+from agent_protocol.models import Status, TaskInput
class DataNotFoundError(Exception):
@@ -135,8 +135,19 @@ class AgentDB(TaskDB):
steps = cursor.fetchall()
if steps:
for step in steps:
- status = Status.created if step[3] == "created" else Status.completed
- task.steps.append(Step(task_id=step[1], step_id=step[0], name=step[2], status=status, is_last=True if step[4] == 1 else False, additional_properties=step[5]))
+ status = (
+ Status.created if step[3] == "created" else Status.completed
+ )
+ task.steps.append(
+ Step(
+ task_id=step[1],
+ step_id=step[0],
+ name=step[2],
+ status=status,
+ is_last=True if step[4] == 1 else False,
+ additional_properties=step[5],
+ )
+ )
# print(f"Getting task {task_id}.... Task details: {task}")
return task
else:
diff --git a/test.py b/test.py
index 7744e6b117..8207222527 100644
--- a/test.py
+++ b/test.py
@@ -1,7 +1,9 @@
-DATABASE_NAME="agent.db"
+DATABASE_NAME = "agent.db"
import sqlite3
+
# Read all data from database
+
def read_all():
conn = sqlite3.connect(DATABASE_NAME)
cur = conn.cursor()
@@ -10,4 +12,5 @@ def read_all():
conn.close()
return rows
-print(read_all())
\ No newline at end of file
+
+print(read_all())