lybic-guiagents 0.2.2__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of lybic-guiagents might be problematic. Click here for more details.

Files changed (130) hide show
  1. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/PKG-INFO +86 -8
  2. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/README.md +74 -6
  3. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/__init__.py +1 -1
  4. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/agents/Backend/LybicBackend.py +25 -19
  5. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/agents/agent_s.py +292 -97
  6. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/agents/grounding.py +43 -6
  7. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/agents/manager.py +113 -18
  8. lybic_guiagents-0.3.0/gui_agents/agents/stream_manager.py +163 -0
  9. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/agents/worker.py +60 -35
  10. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/cli_app.py +16 -5
  11. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/core/knowledge.py +36 -5
  12. lybic_guiagents-0.3.0/gui_agents/grpc_app.py +784 -0
  13. lybic_guiagents-0.3.0/gui_agents/proto/__init__.py +3 -0
  14. lybic_guiagents-0.3.0/gui_agents/proto/pb/__init__.py +4 -0
  15. lybic_guiagents-0.3.0/gui_agents/tools/model.md +351 -0
  16. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/tools/tools.py +80 -39
  17. lybic_guiagents-0.3.0/gui_agents/tools/tools_config.json +101 -0
  18. lybic_guiagents-0.3.0/gui_agents/tools/tools_config_cn.json +101 -0
  19. lybic_guiagents-0.3.0/gui_agents/tools/tools_config_en.json +101 -0
  20. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/lybic_guiagents.egg-info/PKG-INFO +86 -8
  21. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/lybic_guiagents.egg-info/SOURCES.txt +12 -2
  22. lybic_guiagents-0.3.0/lybic_guiagents.egg-info/entry_points.txt +3 -0
  23. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/lybic_guiagents.egg-info/requires.txt +12 -1
  24. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/pyproject.toml +17 -2
  25. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/setup.py +3 -0
  26. lybic_guiagents-0.3.0/tests/test_api_masking.py +123 -0
  27. lybic_guiagents-0.3.0/tests/test_grpc_config.py +149 -0
  28. lybic_guiagents-0.3.0/tests/test_streaming.py +112 -0
  29. lybic_guiagents-0.2.2/gui_agents/lybic_client/lybic_client.py +0 -88
  30. lybic_guiagents-0.2.2/gui_agents/utils/__init__.py +0 -0
  31. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/LICENSE +0 -0
  32. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/__init__.py +0 -0
  33. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/actions.py +0 -0
  34. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/controllers/__init__.py +0 -0
  35. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/controllers/python.py +0 -0
  36. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/controllers/setup.py +0 -0
  37. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/desktop_env.py +0 -0
  38. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/evaluators/__init__.py +0 -0
  39. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/evaluators/getters/__init__.py +0 -0
  40. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/evaluators/getters/calc.py +0 -0
  41. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/evaluators/getters/chrome.py +0 -0
  42. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/evaluators/getters/file.py +0 -0
  43. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/evaluators/getters/general.py +0 -0
  44. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/evaluators/getters/gimp.py +0 -0
  45. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/evaluators/getters/impress.py +0 -0
  46. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/evaluators/getters/info.py +0 -0
  47. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/evaluators/getters/misc.py +0 -0
  48. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/evaluators/getters/replay.py +0 -0
  49. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/evaluators/getters/vlc.py +0 -0
  50. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/evaluators/getters/vscode.py +0 -0
  51. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/evaluators/metrics/__init__.py +0 -0
  52. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/evaluators/metrics/basic_os.py +0 -0
  53. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/evaluators/metrics/chrome.py +0 -0
  54. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/evaluators/metrics/docs.py +0 -0
  55. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/evaluators/metrics/general.py +0 -0
  56. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/evaluators/metrics/gimp.py +0 -0
  57. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/evaluators/metrics/libreoffice.py +0 -0
  58. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/evaluators/metrics/others.py +0 -0
  59. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/evaluators/metrics/pdf.py +0 -0
  60. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/evaluators/metrics/slides.py +0 -0
  61. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/evaluators/metrics/table.py +0 -0
  62. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/evaluators/metrics/thunderbird.py +0 -0
  63. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/evaluators/metrics/utils.py +0 -0
  64. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/evaluators/metrics/vlc.py +0 -0
  65. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/evaluators/metrics/vscode.py +0 -0
  66. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/providers/__init__.py +0 -0
  67. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/providers/aws/__init__.py +0 -0
  68. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/providers/aws/manager.py +0 -0
  69. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/providers/aws/provider.py +0 -0
  70. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/providers/aws/provider_with_proxy.py +0 -0
  71. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/providers/aws/proxy_pool.py +0 -0
  72. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/providers/azure/__init__.py +0 -0
  73. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/providers/azure/manager.py +0 -0
  74. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/providers/azure/provider.py +0 -0
  75. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/providers/base.py +0 -0
  76. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/providers/gcp/__init__.py +0 -0
  77. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/providers/gcp/manager.py +0 -0
  78. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/providers/gcp/provider.py +0 -0
  79. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/providers/virtualbox/__init__.py +0 -0
  80. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/providers/virtualbox/manager.py +0 -0
  81. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/providers/virtualbox/provider.py +0 -0
  82. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/providers/vmware/__init__.py +0 -0
  83. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/providers/vmware/manager.py +0 -0
  84. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/desktop_env/providers/vmware/provider.py +0 -0
  85. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/agents/Action.py +0 -0
  86. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/agents/Backend/ADBBackend.py +0 -0
  87. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/agents/Backend/Backend.py +0 -0
  88. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/agents/Backend/PyAutoGUIBackend.py +0 -0
  89. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/agents/Backend/PyAutoGUIVMwareBackend.py +0 -0
  90. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/agents/Backend/__init__.py +0 -0
  91. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/agents/__init__.py +0 -0
  92. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/agents/global_state.py +0 -0
  93. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/agents/hardware_interface.py +0 -0
  94. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/agents/translator.py +0 -0
  95. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/core/__init__.py +0 -0
  96. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/core/engine.py +0 -0
  97. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/core/mllm.py +0 -0
  98. {lybic_guiagents-0.2.2/gui_agents/lybic_client → lybic_guiagents-0.3.0/gui_agents/prompts}/__init__.py +0 -0
  99. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/prompts/prompts.py +0 -0
  100. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/service/__init__.py +0 -0
  101. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/service/agent_service.py +0 -0
  102. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/service/api_models.py +0 -0
  103. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/service/config.py +0 -0
  104. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/service/exceptions.py +0 -0
  105. {lybic_guiagents-0.2.2/gui_agents/prompts → lybic_guiagents-0.3.0/gui_agents/store}/__init__.py +0 -0
  106. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/store/registry.py +0 -0
  107. {lybic_guiagents-0.2.2/gui_agents/store → lybic_guiagents-0.3.0/gui_agents/tools}/__init__.py +0 -0
  108. {lybic_guiagents-0.2.2/gui_agents/tools → lybic_guiagents-0.3.0/gui_agents/unit_test}/__init__.py +0 -0
  109. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/unit_test/run_tests.py +0 -0
  110. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/unit_test/test_manager.py +0 -0
  111. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/unit_test/test_worker.py +0 -0
  112. {lybic_guiagents-0.2.2/gui_agents/unit_test → lybic_guiagents-0.3.0/gui_agents/utils}/__init__.py +0 -0
  113. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/utils/analyze_display.py +0 -0
  114. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/utils/common_utils.py +0 -0
  115. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/utils/display_viewer.py +0 -0
  116. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/utils/embedding_manager.py +0 -0
  117. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/gui_agents/utils/image_axis_utils.py +0 -0
  118. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/lybic_guiagents.egg-info/dependency_links.txt +0 -0
  119. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/lybic_guiagents.egg-info/top_level.txt +0 -0
  120. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/setup.cfg +0 -0
  121. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/tests/test_aci.py +0 -0
  122. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/tests/test_app_switching.py +0 -0
  123. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/tests/test_global_instance.py +0 -0
  124. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/tests/test_hardware_interface.py +0 -0
  125. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/tests/test_registry.py +0 -0
  126. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/tests/test_translator.py +0 -0
  127. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/tests/test_uielement_base.py +0 -0
  128. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/tests/test_uielement_linux.py +0 -0
  129. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/tests/test_uielement_macos.py +0 -0
  130. {lybic_guiagents-0.2.2 → lybic_guiagents-0.3.0}/tests/test_uielement_osworld.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lybic-guiagents
3
- Version: 0.2.2
3
+ Version: 0.3.0
4
4
  Summary: An open-source agentic framework that enables AI to use computers like humans and can provide a multi-agent runtime environment as an infrastructure capability
5
5
  Author: Lybic Development Team
6
6
  Author-email: Lybic Development Team <lybic@tingyutech.com>
@@ -23,13 +23,21 @@ Requires-Dist: boto3
23
23
  Requires-Dist: scikit-learn
24
24
  Requires-Dist: tiktoken
25
25
  Requires-Dist: pydantic
26
- Requires-Dist: lybic>=0.7.3
26
+ Requires-Dist: lybic<1.0.0,>=0.8.0b2
27
+ Requires-Dist: grpcio
28
+ Requires-Dist: grpcio-tools>=1.71.2
27
29
  Requires-Dist: pyobjc; platform_system == "Darwin"
28
30
  Requires-Dist: oa_atomacos; platform_system == "Darwin"
29
31
  Requires-Dist: pywinauto; platform_system == "Windows"
30
32
  Requires-Dist: pywin32; platform_system == "Windows"
33
+ Requires-Dist: pytest>=8.4.2
34
+ Requires-Dist: protobuf>=5.29.5
35
+ Requires-Dist: googleapis-common-protos>=1.70.0
31
36
  Provides-Extra: dev
32
37
  Requires-Dist: pytest; extra == "dev"
38
+ Provides-Extra: grpc
39
+ Requires-Dist: grpcio; extra == "grpc"
40
+ Requires-Dist: grpcio-tools>=1.71.2; extra == "grpc"
33
41
  Provides-Extra: vmware-and-evaluation
34
42
  Requires-Dist: python-pptx; extra == "vmware-and-evaluation"
35
43
  Requires-Dist: odfpy; extra == "vmware-and-evaluation"
@@ -148,6 +156,8 @@ Requires-Dist: pyobjc; platform_system == "Darwin" and extra == "all"
148
156
  Requires-Dist: oa_atomacos; platform_system == "Darwin" and extra == "all"
149
157
  Requires-Dist: pywinauto; platform_system == "Windows" and extra == "all"
150
158
  Requires-Dist: pywin32; platform_system == "Windows" and extra == "all"
159
+ Requires-Dist: grpcio; extra == "all"
160
+ Requires-Dist: grpcio-tools>=1.71.2; extra == "all"
151
161
  Dynamic: author
152
162
  Dynamic: license-file
153
163
  Dynamic: requires-python
@@ -372,6 +382,13 @@ python gui_agents/cli_app.py --backend pyautogui --mode fast
372
382
  > [!WARNING]
373
383
  > The agent will directly control your computer with `--backend pyautogui`. Please use with care.
374
384
 
385
+ ### Docker
386
+ You can also run Lybic GUI Agent using Docker. This is an example of how to run it with the `lybic` backend:
387
+ ```sh
388
+ docker run --rm -it --env-file gui_agents/.env agenticlybic/guiagent --backend lybic
389
+ ```
390
+ > **Note**: This command starts the agent in interactive mode. The `--env-file` flag points to the environment file. Please ensure the path is correct.
391
+
375
392
  ### Lybic Sandbox Configuration
376
393
 
377
394
  The simplest way to configure Lybic Sandbox is still to edit the `.env` file and add your API keys, as mentioned in the [API Key Configuration](#api-key-configuration) section.
@@ -392,15 +409,19 @@ LYBIC_MAX_LIFE_SECONDS=3600
392
409
 
393
410
  ### Use as a service
394
411
 
395
- After installing lybic-guiagents, you can run it as a service.
412
+ You can interact with the agent programmatically either by importing it as a Python library or by running it as a gRPC service.
413
+
414
+ #### As a Python Library
415
+
416
+ After installing `lybic-guiagents`, you can import and use its components directly in your Python code.
396
417
 
397
418
  Main Components:
398
- - AgentService: High-level service interface (recommended for most users)
399
- - AgentS2, AgentSFast: Core agent implementations
400
- - HardwareInterface: Hardware abstraction layer
401
- - ServiceConfig: Configuration management
419
+ - `AgentService`: High-level service interface (recommended for most users).
420
+ - `AgentS2`, `AgentSFast`: Core agent implementations.
421
+ - `HardwareInterface`: Hardware abstraction layer for controlling the GUI.
422
+ - `ServiceConfig`: Configuration management.
402
423
 
403
- Quick Start:
424
+ **Quick Start:**
404
425
 
405
426
  ```python
406
427
  from gui_agents import AgentService
@@ -409,6 +430,63 @@ result = service.execute_task("Take a screenshot")
409
430
  print(f"Task completed: {result.status}")
410
431
  ```
411
432
 
433
+ #### As a gRPC Service
434
+
435
+ You can also run the agent as a standalone gRPC service, which is ideal for distributed architectures or integrating with applications written in other languages.
436
+
437
+ **1. Running the gRPC Server**
438
+
439
+ First, run the gRPC server using Docker. This command overrides the default CLI entrypoint and starts the gRPC service on port 50051.
440
+
441
+ ```sh
442
+ docker run --rm -it -p 50051:50051 --env-file gui_agents/.env agenticlybic/guiagent /app/.venv/bin/lybic-guiagent-grpc
443
+ ```
444
+ > **Note**: The `-p 50051:50051` flag maps the container's gRPC port to your host machine.
445
+
446
+ **2. Python Client Example**
447
+
448
+ Once the service is running, you can interact with it using a gRPC client. Here is a Python example of how to send an instruction to the agent and stream its progress.
449
+
450
+ First, ensure you have the necessary gRPC libraries and generated protobuf stubs:
451
+ ```sh
452
+ # Install gRPC tools
453
+ pip install grpcio grpcio-tools
454
+
455
+ # Generate stubs from the .proto file
456
+ python -m grpc_tools.protoc -Igui_agents/proto --python_out=gui_agents/proto/pb --grpc_python_out=gui_agents/proto/pb --pyi_out=gui_agents/proto/pb gui_agents/proto/agent.proto
457
+ ```
458
+
459
+ Then, you can use the following script to communicate with the agent:
460
+
461
+ ```python
462
+ import asyncio
463
+ import grpc
464
+ from gui_agents.proto.pb import agent_pb2, agent_pb2_grpc
465
+
466
+ async def run_agent_instruction():
467
+ # Connect to the gRPC server
468
+ async with grpc.aio.insecure_channel('localhost:50051') as channel:
469
+ # Create a stub for the Agent service
470
+ stub = agent_pb2_grpc.AgentStub(channel)
471
+
472
+ # Create a request to run an instruction
473
+ request = agent_pb2.RunAgentInstructionRequest(
474
+ instruction="Open a calculator and compute 1 + 1"
475
+ )
476
+
477
+ print(f"Sending instruction: '{request.instruction}'")
478
+
479
+ # Call the RunAgentInstruction RPC and iterate over the stream of responses
480
+ try:
481
+ async for response in stub.RunAgentInstruction(request):
482
+ print(f"[{response.stage}] {response.message}")
483
+ except grpc.aio.AioRpcError as e:
484
+ print(f"An error occurred: {e.details()}")
485
+
486
+ if __name__ == '__main__':
487
+ asyncio.run(run_agent_instruction())
488
+ ```
489
+
412
490
  ### VMware Configuration
413
491
 
414
492
  To use PyAutoGUI with VMware, you need to install [VMware Workstation Pro](https://www.vmware.com/products/desktop-hypervisor/workstation-and-fusion) (on Windows) and create a virtual machine.
@@ -218,6 +218,13 @@ python gui_agents/cli_app.py --backend pyautogui --mode fast
218
218
  > [!WARNING]
219
219
  > The agent will directly control your computer with `--backend pyautogui`. Please use with care.
220
220
 
221
+ ### Docker
222
+ You can also run Lybic GUI Agent using Docker. This is an example of how to run it with the `lybic` backend:
223
+ ```sh
224
+ docker run --rm -it --env-file gui_agents/.env agenticlybic/guiagent --backend lybic
225
+ ```
226
+ > **Note**: This command starts the agent in interactive mode. The `--env-file` flag points to the environment file. Please ensure the path is correct.
227
+
221
228
  ### Lybic Sandbox Configuration
222
229
 
223
230
  The simplest way to configure Lybic Sandbox is still to edit the `.env` file and add your API keys, as mentioned in the [API Key Configuration](#api-key-configuration) section.
@@ -238,15 +245,19 @@ LYBIC_MAX_LIFE_SECONDS=3600
238
245
 
239
246
  ### Use as a service
240
247
 
241
- After installing lybic-guiagents, you can run it as a service.
248
+ You can interact with the agent programmatically either by importing it as a Python library or by running it as a gRPC service.
249
+
250
+ #### As a Python Library
251
+
252
+ After installing `lybic-guiagents`, you can import and use its components directly in your Python code.
242
253
 
243
254
  Main Components:
244
- - AgentService: High-level service interface (recommended for most users)
245
- - AgentS2, AgentSFast: Core agent implementations
246
- - HardwareInterface: Hardware abstraction layer
247
- - ServiceConfig: Configuration management
255
+ - `AgentService`: High-level service interface (recommended for most users).
256
+ - `AgentS2`, `AgentSFast`: Core agent implementations.
257
+ - `HardwareInterface`: Hardware abstraction layer for controlling the GUI.
258
+ - `ServiceConfig`: Configuration management.
248
259
 
249
- Quick Start:
260
+ **Quick Start:**
250
261
 
251
262
  ```python
252
263
  from gui_agents import AgentService
@@ -255,6 +266,63 @@ result = service.execute_task("Take a screenshot")
255
266
  print(f"Task completed: {result.status}")
256
267
  ```
257
268
 
269
+ #### As a gRPC Service
270
+
271
+ You can also run the agent as a standalone gRPC service, which is ideal for distributed architectures or integrating with applications written in other languages.
272
+
273
+ **1. Running the gRPC Server**
274
+
275
+ First, run the gRPC server using Docker. This command overrides the default CLI entrypoint and starts the gRPC service on port 50051.
276
+
277
+ ```sh
278
+ docker run --rm -it -p 50051:50051 --env-file gui_agents/.env agenticlybic/guiagent /app/.venv/bin/lybic-guiagent-grpc
279
+ ```
280
+ > **Note**: The `-p 50051:50051` flag maps the container's gRPC port to your host machine.
281
+
282
+ **2. Python Client Example**
283
+
284
+ Once the service is running, you can interact with it using a gRPC client. Here is a Python example of how to send an instruction to the agent and stream its progress.
285
+
286
+ First, ensure you have the necessary gRPC libraries and generated protobuf stubs:
287
+ ```sh
288
+ # Install gRPC tools
289
+ pip install grpcio grpcio-tools
290
+
291
+ # Generate stubs from the .proto file
292
+ python -m grpc_tools.protoc -Igui_agents/proto --python_out=gui_agents/proto/pb --grpc_python_out=gui_agents/proto/pb --pyi_out=gui_agents/proto/pb gui_agents/proto/agent.proto
293
+ ```
294
+
295
+ Then, you can use the following script to communicate with the agent:
296
+
297
+ ```python
298
+ import asyncio
299
+ import grpc
300
+ from gui_agents.proto.pb import agent_pb2, agent_pb2_grpc
301
+
302
+ async def run_agent_instruction():
303
+ # Connect to the gRPC server
304
+ async with grpc.aio.insecure_channel('localhost:50051') as channel:
305
+ # Create a stub for the Agent service
306
+ stub = agent_pb2_grpc.AgentStub(channel)
307
+
308
+ # Create a request to run an instruction
309
+ request = agent_pb2.RunAgentInstructionRequest(
310
+ instruction="Open a calculator and compute 1 + 1"
311
+ )
312
+
313
+ print(f"Sending instruction: '{request.instruction}'")
314
+
315
+ # Call the RunAgentInstruction RPC and iterate over the stream of responses
316
+ try:
317
+ async for response in stub.RunAgentInstruction(request):
318
+ print(f"[{response.stage}] {response.message}")
319
+ except grpc.aio.AioRpcError as e:
320
+ print(f"An error occurred: {e.details()}")
321
+
322
+ if __name__ == '__main__':
323
+ asyncio.run(run_agent_instruction())
324
+ ```
325
+
258
326
  ### VMware Configuration
259
327
 
260
328
  To use PyAutoGUI with VMware, you need to install [VMware Workstation Pro](https://www.vmware.com/products/desktop-hypervisor/workstation-and-fusion) (on Windows) and create a virtual machine.
@@ -37,7 +37,7 @@ from .agents.hardware_interface import HardwareInterface
37
37
  from .store.registry import Registry
38
38
  from .agents.global_state import GlobalState
39
39
 
40
- __version__ = "0.2.2"
40
+ __version__ = "0.3.0"
41
41
 
42
42
  # Primary exports (what users should typically use)
43
43
  __all__ = [
@@ -27,7 +27,7 @@ from gui_agents.agents.Backend.Backend import Backend
27
27
 
28
28
  # 导入官方Lybic SDK
29
29
  try:
30
- from lybic import LybicClient, Sandbox, ComputerUse, dto
30
+ from lybic import LybicClient, Sandbox, ComputerUse, dto, LybicAuth
31
31
  except ImportError:
32
32
  raise ImportError(
33
33
  "Lybic Python SDK not found. Please install it with: pip install --upgrade lybic"
@@ -57,18 +57,22 @@ class LybicBackend(Backend):
57
57
  precreate_sid: str = '',
58
58
  **kwargs):
59
59
  """
60
- 初始化LybicBackend
61
-
62
- Args:
63
- api_key: Lybic API密钥,如果为None则从环境变量LYBIC_API_KEY获取
64
- org_id: Lybic组织ID,如果为None则从环境变量LYBIC_ORG_ID获取
65
- endpoint: API端点,如果为None则从环境变量LYBIC_API_ENDPOINT获取
66
- timeout: API请求超时时间
67
- extra_headers: 额外的HTTP
68
- sandbox_opts: 创建沙盒时的额外选项
69
- max_retries: 最大重试次数
70
- precreate_sid: 预创建的沙盒ID,如果提供则不会创建新沙盒
71
- """
60
+ Initialize the LybicBackend, create and configure the Lybic SDK client, and ensure a sandbox is available.
61
+
62
+ Parameters:
63
+ api_key (Optional[str]): Lybic API key; if None the value is read from the LYBIC_API_KEY environment variable.
64
+ org_id (Optional[str]): Lybic organization ID; if None the value is read from the LYBIC_ORG_ID environment variable.
65
+ endpoint (Optional[str]): API endpoint; if None the value is read from LYBIC_API_ENDPOINT (default "https://api.lybic.cn").
66
+ timeout (int): Request timeout in seconds for the SDK client.
67
+ extra_headers (Optional[Dict[str, str]]): Additional HTTP headers to pass to the SDK via LybicAuth.
68
+ sandbox_opts (Optional[Dict[str, Any]]): Options used when creating a new sandbox; LYBIC_MAX_LIFE_SECONDS is applied as the default for `maxLifeSeconds` if not provided.
69
+ max_retries (int): Maximum number of retry attempts for action execution.
70
+ precreate_sid (str): Pre-created sandbox ID to use; if empty, a new sandbox will be created.
71
+
72
+ Raises:
73
+ ValueError: If neither api_key nor org_id are provided (and not present in the corresponding environment variables).
74
+ RuntimeError: If sandbox creation completes but no sandbox ID can be obtained from the SDK response.
75
+ """
72
76
  self.loop = asyncio.new_event_loop()
73
77
  asyncio.set_event_loop(self.loop)
74
78
 
@@ -84,11 +88,13 @@ class LybicBackend(Backend):
84
88
  # 初始化SDK客户端(仅在有必要参数时)
85
89
  if self.api_key and self.org_id:
86
90
  self.client = LybicClient(
87
- org_id=self.org_id,
88
- api_key=self.api_key,
89
- endpoint=self.endpoint,
91
+ LybicAuth(
92
+ org_id=self.org_id,
93
+ api_key=self.api_key,
94
+ endpoint=self.endpoint,
95
+ extra_headers=self.extra_headers or {}
96
+ ),
90
97
  timeout=self.timeout,
91
- extra_headers=self.extra_headers or {}
92
98
  )
93
99
  else:
94
100
  raise ValueError("LYBIC_API_KEY and LYBIC_ORG_ID are required. Please set them as environment variables or pass them as arguments.")
@@ -185,7 +191,7 @@ class LybicBackend(Backend):
185
191
  type="mouse:click",
186
192
  x=dto.PixelLength(type="px", value=act.x),
187
193
  y=dto.PixelLength(type="px", value=act.y),
188
- button=1 if act.button == 0 else 2, # 0=左键, 1=右键 -> 1=左键, 2=右键
194
+ button=act.button,
189
195
  holdKey=" ".join(act.holdKey) if act.holdKey else ""
190
196
  )
191
197
 
@@ -203,7 +209,7 @@ class LybicBackend(Backend):
203
209
  type="mouse:doubleClick",
204
210
  x=dto.PixelLength(type="px", value=act.x),
205
211
  y=dto.PixelLength(type="px", value=act.y),
206
- button=1 if act.button == 0 else 2,
212
+ button=act.button,
207
213
  holdKey=" ".join(act.holdKey) if act.holdKey else ""
208
214
  )
209
215