A task processing method, wherein the method comprises: when a first device determines that an available computing resource of the first device is less than a computing resource required by a to-be-executed artificial intelligence AI task group, selecting at least one second device from valid devices in a first area, wherein the first area is an area that uses the first device as a center and a valid communication distance of the first device as a radius, a valid device in the first area is a collaborative computing device that is in the first area and that is connected to the first device, and the AI task group comprises at least one AI task; sending, by the first device, a task in the to-be-executed AI task group to each of the at least one second device, wherein if the to-be-executed AI task group comprises at least two AI tasks, the sent task is some of the at least two AI tasks, or if the to-be-executed AI task group comprises one AI task, the sent task is some subtasks of the one AI task; and receiving, by the first device, an execution result of the sent task from the at least one second device, wherein the valid communication distance of the first device is a maximum distance between a device sending a signal and the first device when strength of the signal received by the first device is greater than or equal to preset strength, characterized in that the at least one second device is a device of the valid devices in the first area, whose communication latency between the device and the first device is less than or equal to a preset latency; the at least one second device is a device at a first preset location in a first sequence, and the first sequence is a sequence obtained by arranging the valid devices in the first area in ascending order or descending order of communication latencies between the valid devices and the first device; the at least one second device is a device of the valid devices in the first area, whose stay duration in the first area is greater than or equal to preset duration; or the at least one second device is a device at a second preset location in a second sequence, and the second sequence is a sequence obtained by arranging the valid devices in the first area in ascending order or descending order of stay duration in the first area. when a first device determines that an available computing resource of the first device is less than a computing resource required by a to-be-executed artificial intelligence AI task group, selecting at least one second device from valid devices in a first area, wherein the first area is an area that uses the first device as a center and a valid communication distance of the first device as a radius, a valid device in the first area is a collaborative computing device that is in the first area and that is connected to the first device, and the AI task group comprises at least one AI task; sending, by the first device, a task in the to-be-executed AI task group to each of the at least one second device, wherein if the to-be-executed AI task group comprises at least two AI tasks, the sent task is some of the at least two AI tasks, or if the to-be-executed AI task group comprises one AI task, the sent task is some subtasks of the one AI task; and receiving, by the first device, an execution result of the sent task from the at least one second device, wherein the valid communication distance of the first device is a maximum distance between a device sending a signal and the first device when strength of the signal received by the first device is greater than or equal to preset strength, characterized in that the at least one second device is a device of the valid devices in the first area, whose communication latency between the device and the first device is less than or equal to a preset latency; the at least one second device is a device at a first preset location in a first sequence, and the first sequence is a sequence obtained by arranging the valid devices in the first area in ascending order or descending order of communication latencies between the valid devices and the first device; the at least one second device is a device of the valid devices in the first area, whose stay duration in the first area is greater than or equal to preset duration; or the at least one second device is a device at a second preset location in a second sequence, and the second sequence is a sequence obtained by arranging the valid devices in the first area in ascending order or descending order of stay duration in the first area.