Skip to content

Conversation

@yangchen73
Copy link
Collaborator

Description

This PR migrates EmbodiAgent, a LLM-based agent system for autonomous robot task execution in EmbodiChain. The system enables robots to perceive, plan, code, execute, and validate complex manipulation tasks through a closed-loop control cycle, which is developed by https://github.com/Jasonxu1225 .

Key Features

Three specialized agents working in coordination:

  • TaskAgent: High-level reasoning and task decomposition from visual observations
  • CodeAgent: Translates natural language plans into executable Python code using atomic actions
  • ValidationAgent: Validates task execution and provides feedback for refinement

Key Related Files

  • Core agent implementation: embodichain/agents/hierarchy/
  • Agent environments: embodichain/lab/gym/envs/tasks/tableware/
  • Toolkit interfaces: embodichain/toolkits/interfaces.py
  • Motion generation: embodichain/lab/gym/motion_generation/
  • Documentation: embodichain/agents/README.md

Type of change

  • New feature (non-breaking change which adds functionality)

Screenshots

Pour Water

pour_waterr.mp4

Rearrangement

rearrangement.mp4

Dual Arm Pour Water

pour_water_dual.mp4

Checklist

  • I have run the black . command to format the code base.

  • I have made corresponding changes to the documentation

  • I have added tests that prove my fix is effective or that my feature works

  • Dependencies have been updated, if applicable.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates EmbodiAgent, an LLM-based hierarchical agent system for autonomous robot manipulation. The system consists of three coordinated agents (TaskAgent, CodeAgent, ValidationAgent) that enable robots to perceive, plan, generate executable code, and validate task execution through closed-loop control.

Changes:

  • Added agent system with hierarchy-based task decomposition and code generation
  • Integrated LangChain dependencies (0.2.14, 0.1.22) and ZeroMQ for agent communication
  • Implemented toolkit interfaces for robot action primitives (grasp, place, move, etc.)
  • Added mesh processing utilities and online data generation engine
  • Created new task environments for pour water and rearrangement with agent support

Reviewed changes

Copilot reviewed 74 out of 75 changed files in this pull request and generated 134 comments.

Show a summary per file
File Description
pyproject.toml Added langchain, langchain-openai, zmq, and pycocotools dependencies
embodichain/toolkits/interfaces.py Atomic robot action functions and drive coordination
embodichain/toolkits/processor/ Mesh processing components and entity management
embodichain/lab/gym/envs/tasks/tableware/ New agent-enabled task environments
embodichain/lab/scripts/run_agent.py Main script for agent-based task execution
embodichain/data/data_engine/ Online data generation engine with ZeroMQ communication
embodichain/database/agent_prompt/ Prompt templates and examples for LLM agents

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +60 to +62
self.remove_componenet(AxisAlignedBoundingBox)
if self.has_component(OrientedBoundingBox):
self.remove_componenet(OrientedBoundingBox)
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method name "remove_componenet" contains a typo. It should be "remove_component" (missing the second 't'). This inconsistency may lead to confusion when the correct spelling "remove_component" is defined at line 143, creating two different method names for what appears to be the same operation.

Copilot uses AI. Check for mistakes.
Comment on lines +150 to +157
elif self.method == "svd":
is_success, mesh_o3dt = cad_standardlize_obb(
mesh_o3d,
is_use_mesh_clean=False,
is_cad_eliminate_symmetry=True,
symmetry_axis=self.symmetry_axis,
is_larger_positive=self.is_larger_positive,
)
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the SVD case (line 151), the code calls "cad_standardlize_obb" instead of "cad_standardlize_svd". This appears to be a copy-paste error where both the "obb" and "svd" method options call the same function, making the method parameter ineffective. The SVD case should likely call a different function or this conditional block should be refactored.

Copilot uses AI. Check for mistakes.
Comment on lines +94 to +97
return (
abs(spoon_y - spoon_place_target_y) <= tolerance
or abs(fork_y - fork_place_target_y) <= tolerance
)
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The validation logic appears inverted. The condition "abs(spoon_y - spoon_place_target_y) <= tolerance or abs(fork_y - fork_place_target_y) <= tolerance" uses OR, meaning the task is considered successful if EITHER object is correctly placed. However, based on the task description, both objects should be correctly positioned for success. The condition should use AND instead of OR.

Copilot uses AI. Check for mistakes.
Comment on lines +27 to +34
# def reset(self, env_ids: Sequence[int] | None = None) -> None:
# r"""Resets the manager term.

# Args:
# env_ids: The environment ids. Defaults to None, in which case
# all environments are considered.
# """
# pass
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment appears to contain commented-out code.

Copilot uses AI. Check for mistakes.
Comment on lines +37 to +46
# def process_actions(self, actions: torch.Tensor):
# r"""Processes the actions sent to the environment.

# Note:
# This function is called once per environment step by the manager.

# Args:
# actions: The actions to process.
# """
# raise NotImplementedError
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment appears to contain commented-out code.

Copilot uses AI. Check for mistakes.


@dataclass(eq=False)
class SpatializationComponenet(EntityComponent):
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The class 'SpatializationComponenet' does not override 'eq', but adds the new attribute location.
The class 'SpatializationComponenet' does not override 'eq', but adds the new attribute rotation.

Copilot uses AI. Check for mistakes.
self.queue.remove(shm_name["name"])
try:
shm = shared_memory.SharedMemory(shm_name["name"])
except:
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except block directly handles BaseException.

Copilot uses AI. Check for mistakes.
rot_matrix = start_pose[:3, :3].T @ end_pose[:3, :3]
angle = rotation_matrix_to_angle(rot_matrix)
total_angle += angle
except Exception:
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'except' clause does nothing but pass and there is no explanatory comment.

Copilot uses AI. Check for mistakes.
data = CompressedVideoHDF5(file_path, chunks=None).safe_filter(
data, step_id
)
except Exception:
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'except' clause does nothing but pass and there is no explanatory comment.

Copilot uses AI. Check for mistakes.
state_max = np.max(states, axis=0)
state_min = np.min(states, axis=0)
else:
state_max = np.maximum(state_max, np.max(states, axis=0))
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This statement is unreachable.

Copilot uses AI. Check for mistakes.
@yuecideng yuecideng added gym robot learning env and its related features agent Features related to agentic system labels Jan 21, 2026
@@ -0,0 +1,5 @@
# ----------------------------------------------------------------------------
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the correct license

@@ -0,0 +1,5 @@
# ----------------------------------------------------------------------------
# Copyright (c) 2021-2025 DexForce Technology Co., Ltd.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use lerobot format for now. And remove the hdf5 data recordor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent Features related to agentic system gym robot learning env and its related features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants