-
Notifications
You must be signed in to change notification settings - Fork 12
feat: MuJoCo simulation backend — AgentTool with 35 actions #85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cagataycali
wants to merge
37
commits into
strands-labs:main
Choose a base branch
from
cagataycali:feat/mujoco-backend
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
ef77e3e
fix(assets): change debug to warning for missing download module (C9)
cagataycali 5717d21
fix(simulation): log cleanup errors in __del__ instead of silencing (…
cagataycali 38949dd
refactor(simulation): optional methods raise NotImplementedError (C19)
cagataycali a813f23
fix(model-registry): log asset manager availability state (C26)
cagataycali 536d438
refactor(model-registry): move lazy imports to top-level try/except (…
cagataycali af2a857
fix(factory): add overwrite protection to register_backend (C22, C23,…
cagataycali 65299a6
refactor(simulation): rename SimulationBackend to SimEngine (C15)
cagataycali 43fd024
fix(simulation): remove mujoco references not in this PR (C13, C14)
cagataycali 9c14376
fix(model-registry): reorder resolution — local assets before default…
cagataycali 6292187
refactor(assets): thin __init__.py, move logic to manager.py (C3, C4,…
cagataycali 8229ce1
refactor(assets): consolidate to STRANDS_ASSETS_DIR, deprecate STRAND…
cagataycali a609002
feat(simulation): add models dataclasses and download_assets tool
cagataycali fe39ec9
refactor(model-registry): simplify and document search paths (C25)
cagataycali cd19f47
docs(simulation): document required vs optional methods, improve rend…
cagataycali 27e969f
docs: add environment variables and cache directory sections to READM…
cagataycali 16e9f4b
docs(simulation): clarify get_observation/send_action/run_policy as f…
cagataycali 2217260
style: apply ruff formatting to all PR files
cagataycali 75705e6
refactor: drop STRANDS_URDF_DIR entirely — no deprecation, just remove
cagataycali 21857d5
style: fix ruff formatting in model_registry.py (missing blank line)
cagataycali d91a7b7
fix: resolve 25 mypy errors, remove SimulationBackend alias, fix log …
strands-agent 6f711ee
fix: resolve mypy errors in assets/manager.py and tools/download_asse…
cagataycali 1dafad1
fix: resolve 2 mypy errors — correct type-ignore code, add robot_desc…
cagataycali c6e437b
feat: expand robot registry to 68 robots, add user registration API, …
cagataycali ef75a5d
fix: add [sim] extra with robot_descriptions dependency
cagataycali 55d4044
fix: add orientation, mesh_path to SimEngine.add_object + simplify ra…
cagataycali f391314
feat: MuJoCo simulation backend — AgentTool with 35 actions
cagataycali ded8977
fix: address all review comments — ABC, thread-safety, injection, cle…
cagataycali ada6095
fix: resolve lint errors — import ordering, format, strict param
cagataycali b25663e
fix: acquire _lock around MuJoCo data mutations + sanitize all XML names
cagataycali af9d1f6
ci: add MuJoCo system deps (libosmesa6-dev + MUJOCO_GL=osmesa)
cagataycali 1b759a7
feat: add [sim] extra with mujoco dependency
cagataycali 567fd00
fix: rename [sim] extra to [sim-mujoco] per review
768111d
fix: rebase on simulation-foundation — SimulationBackend→SimEngine, u…
cagataycali 8b7c55d
fix: resolve all mypy errors — mixin overrides, Optional types, impor…
cagataycali 0a8366d
fix: properly fix mypy errors instead of blanket suppression
cagataycali 696b423
fix: zero mypy suppressions — proper type declarations instead of dis…
cagataycali 57eb5d0
feat(sim): use require_optional for imageio in policy_runner
cagataycali File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| """Async-to-sync helper for resolving coroutines in sync contexts.""" | ||
|
|
||
| import asyncio | ||
| import concurrent.futures | ||
|
|
||
| # Module-level executor reused across calls to avoid creating threads at high frequency. | ||
| # A single worker is sufficient — we only need to offload one asyncio.run() at a time. | ||
| _EXECUTOR = concurrent.futures.ThreadPoolExecutor(max_workers=1, thread_name_prefix="strands_async") | ||
|
|
||
|
|
||
| def _resolve_coroutine(coro_or_result): # type: ignore[no-untyped-def] | ||
| """Safely resolve a potentially-async result to a sync value. | ||
|
|
||
| Handles three cases: | ||
| 1. Already a plain value → return as-is | ||
| 2. Coroutine, no running loop → asyncio.run() | ||
| 3. Coroutine, inside running loop → offload to reused thread | ||
|
|
||
| Args: | ||
| coro_or_result: Either a coroutine or an already-resolved value. | ||
|
|
||
| Returns: | ||
| The resolved (sync) value. | ||
| """ | ||
| if not asyncio.iscoroutine(coro_or_result): | ||
| return coro_or_result | ||
| try: | ||
| asyncio.get_running_loop() | ||
cagataycali marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| return _EXECUTOR.submit(asyncio.run, coro_or_result).result() | ||
| except RuntimeError: | ||
| return asyncio.run(coro_or_result) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| """Robot Asset Manager for Strands Robots Simulation. | ||
|
|
||
| Assets are resolved from ``robot_descriptions`` package or downloaded from | ||
| MuJoCo Menagerie GitHub, cached in ``~/.strands_robots/assets/``. | ||
| Override with ``STRANDS_ASSETS_DIR`` env var. | ||
|
|
||
| Implementation lives in ``assets/manager.py`` — this file is thin exports only. | ||
| """ | ||
|
|
||
| from strands_robots.assets.manager import ( | ||
| get_assets_dir, | ||
| get_robot_info, | ||
| get_search_paths, | ||
| list_available_robots, | ||
| resolve_model_dir, | ||
| resolve_model_path, | ||
| ) | ||
| from strands_robots.registry import ( | ||
| format_robot_table, | ||
| get_robot, | ||
| list_aliases, | ||
| list_robots, | ||
| list_robots_by_category, | ||
| ) | ||
| from strands_robots.registry import ( | ||
| resolve_name as resolve_robot_name, | ||
| ) | ||
|
|
||
| __all__ = [ | ||
| "resolve_model_path", | ||
| "resolve_model_dir", | ||
| "resolve_robot_name", | ||
| "get_robot_info", | ||
| "list_available_robots", | ||
| "list_robots_by_category", | ||
| "list_aliases", | ||
| "format_robot_table", | ||
| "get_assets_dir", | ||
| "get_search_paths", | ||
| "get_robot", | ||
| "list_robots", | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| """Download robot model assets — redirects to strands_robots.tools.download_assets. | ||
|
|
||
| The download tool is strands_robots/tools/download_assets.py and downloads to | ||
| ~/.strands_robots/assets/ (user cache) instead of the bundled package dir. | ||
| """ | ||
|
|
||
| from strands_robots.tools.download_assets import ( | ||
| _needs_download, # noqa: F401 | ||
| download_assets, | ||
| download_robots, | ||
| get_user_assets_dir, | ||
| main, | ||
| ) | ||
|
|
||
| __all__ = ["download_assets", "download_robots", "get_user_assets_dir", "main"] | ||
|
|
||
| if __name__ == "__main__": | ||
| main() |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shall we keep
simas a placeholder dependency for later integration with Strands-Robots-Sim? maybe just put "robot_descriptions>=1.11.0,<2.0.0" intosim-mujoco? @cagataycaliThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question. I think moving
robot_descriptionsinto[sim-mujoco]makes sense for now —[sim]alone isn't useful to anyone today and having an empty placeholder extra is confusing.When a second backend arrives (Isaac Sim, PyBullet, etc.), we can extract the shared asset dep into a
[sim]base at that point — easy refactor since it's justpyproject.toml.So the change would be:
And remove the
[sim]extra entirely (plus update[all]to drop it).Will push the fix once confirmed.
🤖 AI agent response. Strands Agents. Feedback welcome!