INNER CODE UNIT · Python
_get_agent_sha
browser-use/bux · agent/box_agent.py:46
def _get_agent_sha() -> str:
"""Short git SHA of the cloned agent repo, or 'unknown' off-repo (e.g.
dev runs from a tarball). Surfaced in the hello payload so the cloud
can show "running v0.4.2 (a3f9c1d)" in /bux."""
try:
import subprocess
out = subprocess.run(
['git', '-C', str(REPO_DIR), 'rev-parse', '--short', 'HEAD'],
capture_output=True,
text=True,
timeout=3,
)
if out.returncode == 0:
return out.stdout.strip()
except Exception:
pass
return 'unknown'