Skip to content

Commit 62402cd

Browse files
authored
The-Agent-Company evaluation harness: Support splits (#6577)
1 parent be522f1 commit 62402cd

File tree

2 files changed

+63
-9
lines changed

2 files changed

+63
-9
lines changed

evaluation/benchmarks/the_agent_company/README.md

+16-7
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,36 @@ When the `run_infer.sh` script is started, it will automatically pull all task i
1717

1818
```bash
1919
./evaluation/benchmarks/the_agent_company/scripts/run_infer.sh \
20-
--agent-llm-config <agent-llm-config> \
21-
--env-llm-config <env-llm-config> \
22-
--outputs-path <outputs-path> \
23-
--server-hostname <server-hostname> \
24-
--version <version>
20+
--agent-llm-config <agent-llm-config, default to 'agent'> \
21+
--env-llm-config <env-llm-config, default to 'env'> \
22+
--outputs-path <outputs-path, default to outputs> \
23+
--server-hostname <server-hostname, default to localhost> \
24+
--version <version, default to 1.0.0> \
25+
--start-percentile <integer from 0 to 99, default to 0> \
26+
--end-percentile <integer from 1 to 100, default to 100>
27+
2528

2629
# Example
2730
./evaluation/benchmarks/the_agent_company/scripts/run_infer.sh \
2831
--agent-llm-config claude-3-5-sonnet-20240620 \
2932
--env-llm-config claude-3-5-sonnet-20240620 \
3033
--outputs-path outputs \
3134
--server-hostname localhost \
32-
--version 1.0.0
35+
--version 1.0.0 \
36+
--start-percentile 10 \
37+
--end-percentile 20
3338
```
3439

3540
- `agent-llm-config`: the config name for the agent LLM. This should match the config name in config.toml. This is the LLM used by the agent (e.g. CodeActAgent).
3641
- `env-llm-config`: the config name for the environment LLM. This should match the config name in config.toml. This is used by the chat bots (NPCs) and LLM-based evaluators.
3742
- `outputs-path`: the path to save trajectories and evaluation results.
3843
- `server-hostname`: the hostname of the server that hosts all the web services. It could be localhost if you are running the evaluation and services on the same machine. If the services are hosted on a remote machine, you must use the hostname of the remote machine rather than IP address.
3944
- `version`: the version of the task images to use. Currently, the only supported version is 1.0.0.
45+
- `start-percentile`: the start percentile of the task split, must be an integer between 0 to 99.
46+
- `end-percentile`: the end percentile of the task split, must be an integer between 1 to 100 and larger than start-percentile.
4047

41-
The script is idempotent. If you run it again, it will resume from the last checkpoint. It would usually take a few days to finish evaluation.
48+
The script is idempotent. If you run it again, it will resume from the last checkpoint. It would usually take 2 days to finish evaluation if you run the whole task set.
49+
To speed up evaluation, you can use `start-percentile` and `end-percentile` to split the tasks for higher parallelism,
50+
provided concurrent runs are **targeting different servers**.
4251

4352
Note: the script will automatically skip a task if it encounters an error. This usually happens when the OpenHands runtime dies due to some unexpected errors. This means even if the script finishes, it might not have evaluated all tasks. You can manually resume the evaluation by running the script again.

evaluation/benchmarks/the_agent_company/scripts/run_infer.sh

100644100755
+47-2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ while [[ $# -gt 0 ]]; do
5656
VERSION="$2"
5757
shift 2
5858
;;
59+
--start-percentile)
60+
START_PERCENTILE="$2"
61+
shift 2
62+
;;
63+
--end-percentile)
64+
END_PERCENTILE="$2"
65+
shift 2
66+
;;
5967
*)
6068
echo "Unknown argument: $1"
6169
exit 1
@@ -69,16 +77,53 @@ if [[ ! "$OUTPUTS_PATH" = /* ]]; then
6977
OUTPUTS_PATH="$(cd "$(dirname "$OUTPUTS_PATH")" 2>/dev/null && pwd)/$(basename "$OUTPUTS_PATH")"
7078
fi
7179

80+
: "${START_PERCENTILE:=0}" # Default to 0 percentile (first line)
81+
: "${END_PERCENTILE:=100}" # Default to 100 percentile (last line)
82+
83+
# Validate percentile ranges if provided
84+
if ! [[ "$START_PERCENTILE" =~ ^[0-9]+$ ]] || ! [[ "$END_PERCENTILE" =~ ^[0-9]+$ ]]; then
85+
echo "Error: Percentiles must be integers"
86+
exit 1
87+
fi
88+
89+
if [ "$START_PERCENTILE" -ge "$END_PERCENTILE" ]; then
90+
echo "Error: Start percentile must be less than end percentile"
91+
exit 1
92+
fi
93+
94+
if [ "$START_PERCENTILE" -lt 0 ] || [ "$END_PERCENTILE" -gt 100 ]; then
95+
echo "Error: Percentiles must be between 0 and 100"
96+
exit 1
97+
fi
98+
7299
echo "Using agent LLM config: $AGENT_LLM_CONFIG"
73100
echo "Using environment LLM config: $ENV_LLM_CONFIG"
74101
echo "Outputs path: $OUTPUTS_PATH"
75102
echo "Server hostname: $SERVER_HOSTNAME"
76103
echo "Version: $VERSION"
104+
echo "Start Percentile: $START_PERCENTILE"
105+
echo "End Percentile: $END_PERCENTILE"
77106

78107
echo "Downloading tasks.md..."
79108
rm -f tasks.md
80109
wget https://github.com/TheAgentCompany/TheAgentCompany/releases/download/${VERSION}/tasks.md
81110

111+
total_lines=$(cat tasks.md | grep "ghcr.io/theagentcompany" | wc -l)
112+
if [ "$total_lines" -ne 175 ]; then
113+
echo "Error: Expected 175 tasks in tasks.md but found $total_lines lines"
114+
exit 1
115+
fi
116+
117+
# Calculate line numbers based on percentiles
118+
start_line=$(echo "scale=0; ($total_lines * $START_PERCENTILE / 100) + 1" | bc)
119+
end_line=$(echo "scale=0; $total_lines * $END_PERCENTILE / 100" | bc)
120+
121+
echo "Using tasks No. $start_line to $end_line (inclusive) out of 1-175 tasks"
122+
123+
# Create a temporary file with just the desired range
124+
temp_file="tasks_${START_PERCENTILE}_${END_PERCENTILE}.md"
125+
sed -n "${start_line},${end_line}p" tasks.md > "$temp_file"
126+
82127
while IFS= read -r task_image; do
83128
docker pull $task_image
84129

@@ -108,8 +153,8 @@ while IFS= read -r task_image; do
108153
docker images "ghcr.io/all-hands-ai/runtime" -q | xargs -r docker rmi -f
109154
docker volume prune -f
110155
docker system prune -f
111-
done < tasks.md
156+
done < "$temp_file"
112157

113-
rm tasks.md
158+
rm tasks.md "$temp_file"
114159

115160
echo "All evaluation completed successfully!"

0 commit comments

Comments
 (0)