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.
Add agent protocol interface test (#259)
merwanehamadi530eb61f258c
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex ceb5cdfc93..1c8e0beba5 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -170,8 +170,7 @@ jobs:elif [ "$AGENT_NAME" == "beebot" ]; thenpoetry installpoetry run playwright install- uvicorn beebot.initiator.api:create_app --factory --reload --timeout-graceful-shutdown=3 --timeout-keep-alive=300 &- agent-protocol test --url=127.0.0.1:8000 || echo "Beebot is not compliant with the agent protocol"+ uvicorn beebot.initiator.api:create_app --reload &prefix="poetry run "elseecho "Unknown agent name: $AGENT_NAME"diff --git a/agbenchmark/agent_interface.py b/agbenchmark/agent_interface.pyindex 1532bd1e0f..402120e8f3 100644--- a/agbenchmark/agent_interface.py+++ b/agbenchmark/agent_interface.py@@ -20,56 +20,57 @@ def run_agent(task: str, config: Dict[str, Any], artifacts_location: str, cutoff: int) -> None:"""Calling to get a response"""-+ if task == "":+ returnif MOCK_FLAG:print("Running mock agent")copy_artifacts_into_workspace(config["workspace"], "artifacts_out", artifacts_location)- else:- entry_path = "agbenchmark.benchmarks"-- timeout = cutoff- if "--nc" in sys.argv:- timeout = 100000-- print(f"Running '{entry_path}' with timeout {timeout}")-- command = [sys.executable, "-m", entry_path, str(task)]- process = subprocess.Popen(- command,- stdout=subprocess.PIPE,- stderr=subprocess.STDOUT,- universal_newlines=True,- cwd=HOME_DIRECTORY,- bufsize=1,- )+ return+ entry_path = "agbenchmark.benchmarks"++ timeout = cutoff+ if "--nc" in sys.argv:+ timeout = 100000++ print(f"Running '{entry_path}' with timeout {timeout}")++ command = [sys.executable, "-m", entry_path, str(task)]+ process = subprocess.Popen(+ command,+ stdout=subprocess.PIPE,+ stderr=subprocess.STDOUT,+ universal_newlines=True,+ cwd=HOME_DIRECTORY,+ bufsize=1,+ )- start_time = time.time()+ start_time = time.time()- while True:- try:- # This checks if there's data to be read from stdout without blocking.- if process.stdout and select.select([process.stdout], [], [], 0)[0]:- output = process.stdout.readline()- print(output.strip())- except Exception as e:- continue+ while True:+ try:+ # This checks if there's data to be read from stdout without blocking.+ if process.stdout and select.select([process.stdout], [], [], 0)[0]:+ output = process.stdout.readline()+ print(output.strip())+ except Exception as e:+ continue- # Check if process has ended, has no more output, or exceeded timeout- if process.poll() is not None or (time.time() - start_time > timeout):- break+ # Check if process has ended, has no more output, or exceeded timeout+ if process.poll() is not None or (time.time() - start_time > timeout):+ break- if time.time() - start_time > timeout:- print("The Python function has exceeded the time limit and was terminated.")- process.kill()- else:- print("The Python function has finished running.")+ if time.time() - start_time > timeout:+ print("The Python function has exceeded the time limit and was terminated.")+ process.kill()+ else:+ print("The Python function has finished running.")- process.wait()+ process.wait()- if process.returncode != 0:- print(f"The agent timed out")+ if process.returncode != 0:+ print(f"The agent timed out")def copy_artifacts_into_workspace(diff --git a/agbenchmark/challenges b/agbenchmark/challengesindex c57e0bf36a..d51cf0dda4 160000--- a/agbenchmark/challenges+++ b/agbenchmark/challenges@@ -1 +1 @@-Subproject commit c57e0bf36ac52b5586821503582724967677816f+Subproject commit d51cf0dda467142c64f81e97367d3d882ccab165diff --git a/agbenchmark/utils/challenge.py b/agbenchmark/utils/challenge.pyindex c8a625600e..8ecd013dca 100644--- a/agbenchmark/utils/challenge.py+++ b/agbenchmark/utils/challenge.py@@ -177,7 +177,9 @@ class Challenge(ABC):percentage = Nonetry:- if isinstance(self.data.ground, Ground):+ if self.data.task == "" and MOCK_FLAG:+ scores = [1.0]+ elif isinstance(self.data.ground, Ground):files_contents = self.get_artifacts_out(config["workspace"], self.data.ground)diff --git a/agent/beebot b/agent/beebotindex 7e3704f7cd..f91f8e3c65 160000--- a/agent/beebot+++ b/agent/beebot@@ -1 +1 @@-Subproject commit 7e3704f7cd58532b28fcb3d0ce1598d16448b028+Subproject commit f91f8e3c65d6047db32f3a32f1c4997ac0f02516