Compare commits

..

1 Commits

Author SHA1 Message Date
sdk-dev f8a2991797 fix(examples): correct repo-root import path in remote-agent/run.py
Test / test (3.12) (pull_request) Waiting to run
Test / test (3.13) (pull_request) Successful in 2m24s
Test / test (3.11) (pull_request) Successful in 2m52s
[Do] Manual ack
sop-checklist / all-items-acked SOP checklist acknowledged by sdk-dev
The local-dev import path was adding sdk/python/ to sys.path, but the
molecule_agent package lives at the repo root, not under sdk/python/.
The dead-code path silently failed (isdir check returned False) so the
script only worked when molecule-ai-sdk was pip-installed. Now uses
os.path.normpath(.. / ..) pointing to the repo root instead.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 10:02:22 +00:00
6 changed files with 13 additions and 22 deletions
+1 -1
View File
@@ -27,7 +27,7 @@ curl -s -X POST http://localhost:8080/workspaces/<UUID>/secrets \
# 3. Run the demo from any machine that can reach the platform: # 3. Run the demo from any machine that can reach the platform:
WORKSPACE_ID=<UUID> PLATFORM_URL=http://localhost:8080 \ WORKSPACE_ID=<UUID> PLATFORM_URL=http://localhost:8080 \
python3 examples/remote-agent/run.py python3 sdk/python/examples/remote-agent/run.py
``` ```
You should see log lines for each of the three phases, and then You should see log lines for each of the three phases, and then
+4 -4
View File
@@ -41,12 +41,12 @@ import os
import sys import sys
# Local-dev import path — when installed via pip the molecule_agent package # Local-dev import path — when installed via pip the molecule_agent package
# resolves normally; when running from the repo checkout we add sdk/python/ # resolves normally; when running from the repo checkout we add the repo root
# to sys.path so you can run `python3 run.py` without a pip install. # to sys.path so you can run `python3 run.py` without a pip install.
_here = os.path.dirname(os.path.abspath(__file__)) _here = os.path.dirname(os.path.abspath(__file__))
_sdk = os.path.join(_here, "..", "..", "sdk", "python") _repo_root = os.path.normpath(os.path.join(_here, "..", ".."))
if os.path.isdir(_sdk) and _sdk not in sys.path: if _repo_root not in sys.path:
sys.path.insert(0, _sdk) sys.path.insert(0, _repo_root)
from molecule_agent import RemoteAgentClient # noqa: E402 from molecule_agent import RemoteAgentClient # noqa: E402
+2 -2
View File
@@ -60,7 +60,7 @@ print(f"loop exited: {terminal}")
``` ```
A runnable demo with full setup walkthrough lives at A runnable demo with full setup walkthrough lives at
[`examples/remote-agent/`](https://git.moleculesai.app/Molecule-AI/molecule-sdk-python/-/tree/main/examples/remote-agent) — the runnable demo with full setup walkthrough. [`sdk/python/examples/remote-agent/`](../examples/remote-agent).
## What the SDK gives you ## What the SDK gives you
@@ -282,5 +282,5 @@ the security benefits of bearer auth until both sides upgrade.
- [`molecule_plugin`](../molecule_plugin) — the *other* SDK in this - [`molecule_plugin`](../molecule_plugin) — the *other* SDK in this
package, for plugin authors. Different audience. package, for plugin authors. Different audience.
- [`examples/remote-agent/run.py`](https://git.moleculesai.app/Molecule-AI/molecule-sdk-python/-/blob/main/examples/remote-agent/run.py) - [`sdk/python/examples/remote-agent/run.py`](../examples/remote-agent/run.py)
— the runnable demo that proves all of the above end-to-end. — the runnable demo that proves all of the above end-to-end.
+1 -1
View File
@@ -20,7 +20,7 @@ Intended usage::
env = client.pull_secrets() # decrypted secrets dict env = client.pull_secrets() # decrypted secrets dict
client.run_heartbeat_loop() # background heartbeat + state-poll client.run_heartbeat_loop() # background heartbeat + state-poll
See ``examples/remote-agent/`` for a runnable demo. See ``sdk/python/examples/remote-agent/`` for a runnable demo.
Design notes: Design notes:
* **No async.** The SDK uses blocking ``requests`` so a remote agent author * **No async.** The SDK uses blocking ``requests`` so a remote agent author
+4 -13
View File
@@ -11,19 +11,10 @@ a Phase 30 endpoint:
* :py:meth:`run_heartbeat_loop` — drives heartbeat + state-poll on a timer, * :py:meth:`run_heartbeat_loop` — drives heartbeat + state-poll on a timer,
returns when the platform reports the workspace paused or deleted. returns when the platform reports the workspace paused or deleted.
The client also exposes two inbound delivery paths for handling platform-initiated No inbound A2A server is bundled here yet — that requires hosting an HTTP
A2A messages: endpoint the platform's proxy can reach, which is network-dependent.
Use :class:`molecule_agent.a2a_server.A2AServer` to add inbound A2A support.
* **Push mode** — :class:`molecule_agent.a2a_server.A2AServer` hosts an HTTP server See that module for usage and the Phase 30.8b contract.
in a background thread; platform pushes inbound A2A as HTTP requests. Use when the
agent has a publicly reachable URL (cloud VM, ngrok tunnel, etc.).
* **Poll mode** — :class:`molecule_agent.inbound.PollDelivery` polls
``GET /workspaces/:id/activity`` on a configurable interval; no public URL required.
The default when no explicit delivery is passed to :py:meth:`run_agent_loop`.
Both feed the same :py:class:`molecule_agent.inbound.MessageHandler` callback.
Reply routing (``/notify`` for canvas users, ``/a2a`` for peer agents) is handled
automatically by :py:meth:`reply`.
""" """
from __future__ import annotations from __future__ import annotations
+1 -1
View File
@@ -26,7 +26,7 @@ Example: a minimal plugin that's installable on Claude Code and DeepAgents
├── claude_code.py # `from molecule_plugin import AgentskillsAdaptor as Adaptor` ├── claude_code.py # `from molecule_plugin import AgentskillsAdaptor as Adaptor`
└── deepagents.py # same one-liner └── deepagents.py # same one-liner
Full docs + cookiecutter template: see the repo root ``README.md``. Full docs + cookiecutter template: see ``sdk/python/README.md``.
""" """
from __future__ import annotations from __future__ import annotations