cua-agent 0.4.0b4__py3-none-any.whl → 0.4.2__py3-none-any.whl

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 cua-agent might be problematic. Click here for more details.

@@ -14,9 +14,12 @@ from gradio.components.chatbot import MetadataDict
14
14
 
15
15
  from .app import (
16
16
  load_settings, save_settings, create_agent, get_model_string,
17
- get_ollama_models, GradioChatScreenshotHandler, global_agent, global_computer
17
+ get_ollama_models, global_agent, global_computer
18
18
  )
19
19
 
20
+ # Global messages array to maintain conversation history
21
+ global_messages = []
22
+
20
23
 
21
24
  def create_gradio_ui() -> gr.Blocks:
22
25
  """Create a Gradio UI for the Computer-Use Agent."""
@@ -571,15 +574,17 @@ if __name__ == "__main__":
571
574
  yield history
572
575
  return
573
576
 
574
- # Create message list for agent
575
- messages = [{"role": "user", "content": last_user_message}]
576
-
577
+ # Add user message to global history
578
+ global global_messages
579
+ global_messages.append({"role": "user", "content": last_user_message})
580
+
577
581
  # Stream responses from the agent
578
- async for result in global_agent.run(messages):
579
- print(f"DEBUG - Agent response ------- START")
580
- from pprint import pprint
581
- pprint(result)
582
- print(f"DEBUG - Agent response ------- END")
582
+ async for result in global_agent.run(global_messages):
583
+ global_messages += result.get("output", [])
584
+ # print(f"DEBUG - Agent response ------- START")
585
+ # from pprint import pprint
586
+ # pprint(result)
587
+ # print(f"DEBUG - Agent response ------- END")
583
588
 
584
589
  # Process the result output
585
590
  for item in result.get("output", []):
@@ -619,6 +624,14 @@ if __name__ == "__main__":
619
624
  content=f"📤 Function output:\n```\n{output}\n```",
620
625
  metadata={"title": "Function Output"}
621
626
  ))
627
+ elif item.get("type") == "computer_call_output":
628
+ output = item.get("output", {}).get("image_url", "")
629
+ image_markdown = f"![Computer output]({output})"
630
+ history.append(gr.ChatMessage(
631
+ role="assistant",
632
+ content=image_markdown,
633
+ metadata={"title": "🖥️ Computer Output"}
634
+ ))
622
635
 
623
636
  yield history
624
637
 
@@ -661,7 +674,12 @@ if __name__ == "__main__":
661
674
  )
662
675
 
663
676
  # Clear button functionality
664
- clear.click(lambda: None, None, chatbot_history, queue=False)
677
+ def clear_chat():
678
+ global global_messages
679
+ global_messages.clear()
680
+ return None
681
+
682
+ clear.click(clear_chat, None, chatbot_history, queue=False)
665
683
 
666
684
  # Connect cancel button
667
685
  cancel_button.click(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cua-agent
3
- Version: 0.4.0b4
3
+ Version: 0.4.2
4
4
  Summary: CUA (Computer Use) Agent for AI-driven computer interaction
5
5
  Author-Email: TryCua <gh@trycua.com>
6
6
  Requires-Python: >=3.11
@@ -13,7 +13,7 @@ Requires-Dist: pydantic>=2.6.4
13
13
  Requires-Dist: rich>=13.7.1
14
14
  Requires-Dist: python-dotenv>=1.0.1
15
15
  Requires-Dist: cua-computer<0.5.0,>=0.3.0
16
- Requires-Dist: cua-core<0.2.0,>=0.1.0
16
+ Requires-Dist: cua-core<0.2.0,>=0.1.8
17
17
  Requires-Dist: certifi>=2024.2.2
18
18
  Requires-Dist: litellm>=1.74.8
19
19
  Provides-Extra: openai
@@ -0,0 +1,33 @@
1
+ agent/__init__.py,sha256=PfRgVa_aJQL9fK0D1g2r__Kdg3627EigNS31_M8Ivkk,1539
2
+ agent/__main__.py,sha256=lBUe8Niqa5XoCjwFfXyX7GtnUwjjZXC1-j4V9mvUYSc,538
3
+ agent/adapters/__init__.py,sha256=szM2HMten2WkcqXeRnan__-sXjpyS4eyvIW0LXSfj4U,178
4
+ agent/adapters/huggingfacelocal_adapter.py,sha256=dnzzxYCvFiuDdNzsb_1uM-boWv1eS__dWMve_fAnlUc,8038
5
+ agent/agent.py,sha256=Vn7ygehx19It5FarZJ2NwVwNTOtNYtD21x8LEBhlWcE,24609
6
+ agent/callbacks/__init__.py,sha256=yxxBXUqpXQ-jRi_ixJMtmQPxoNRy5Vz1PUBzNNa1Dwg,538
7
+ agent/callbacks/base.py,sha256=UnnnYlh6XCm6HKZZsAPaT_Eyo9LUYLyjyNwF-QRm6Ns,4691
8
+ agent/callbacks/budget_manager.py,sha256=RyKM-7iXQcDotYvrw3eURzeEHEXvQjID-NobtvQWE7k,1832
9
+ agent/callbacks/image_retention.py,sha256=tiuRT5ke9xXTb2eP8Gz-2ITyAMY29LURUH6AbjX3RP8,6165
10
+ agent/callbacks/logging.py,sha256=OOxU97EzrxlnUAtiEnvy9FB7SwCUK90-rdpDFA2Ae4E,10921
11
+ agent/callbacks/pii_anonymization.py,sha256=UKAqNacHG3z92_6uocVzOIl8gJoqyofldCoCmB4UVIE,10268
12
+ agent/callbacks/telemetry.py,sha256=PU7pkK7W1v1xjDN-9gA30lGvn4-WhqK3BPHGW3HpTOc,7497
13
+ agent/callbacks/trajectory_saver.py,sha256=POE8aPT-MBzfW873wr6C7iiVUHtp483KwvLPxC1S3EY,11626
14
+ agent/cli.py,sha256=cTH2RT8tLtISseqrtTSau7g3-ILkFnHkR2BDLaNQVVE,10440
15
+ agent/computer_handler.py,sha256=2gfFBeDk9Vd54x9mOqnswMo8BdjUduLo5I0RbBPLovY,3964
16
+ agent/decorators.py,sha256=bCmcCjP31WEjWg1D91OE2jo7AZTfGa9cNgCnYUvjiyw,2832
17
+ agent/loops/__init__.py,sha256=_qpP_--3ePdFkTZP8qmUEFlBsy6m4h8fj0gGLDKA7zw,217
18
+ agent/loops/anthropic.py,sha256=Za_Qzf4q37CO4QZ0jTnSjHj7RIgaoTLNdrxfPYEysCg,58155
19
+ agent/loops/omniparser.py,sha256=m3bDNQ0Igc_HHVoAbjVNj599uRoC9Eap3DCALg6RZ54,11422
20
+ agent/loops/openai.py,sha256=ArTqadeJY8F9N8ZLKfswlzgHV_54HbWJgLd4l6ele9w,3010
21
+ agent/loops/uitars.py,sha256=L0NYxKoIiMfIHbyomnaiK3ZGLmLv3QMx9nX57GruAk0,26323
22
+ agent/responses.py,sha256=ztSMEz8q4ykQAXF21UyQxkSZ6GeoDMydT5HZqKBPAXg,6660
23
+ agent/telemetry.py,sha256=87ZTyBaT0wEPQn4v76II3g0V3GERuIVbypoX-Ug6FKQ,4786
24
+ agent/types.py,sha256=GiLxIcF7s1XIh_WaY7tjdQPFpdTXb5MWVe_ZUPA0gkY,2364
25
+ agent/ui/__init__.py,sha256=DTZpK85QXscXK2nM9HtpAhVBF13yAamUrtwrQSuV-kM,126
26
+ agent/ui/__main__.py,sha256=vudWXYvGM0aNT5aZ94HPtGW8YXOZ4cLXepHyhUM_k1g,73
27
+ agent/ui/gradio/__init__.py,sha256=yv4Mrfo-Sj2U5sVn_UJHAuwYCezo-5O4ItR2C9jzNko,145
28
+ agent/ui/gradio/app.py,sha256=X7he4jzyFqWJDP1y_M8yfZvfdy6GHNuclLn4k9iIwAw,8824
29
+ agent/ui/gradio/ui_components.py,sha256=WxFE-4wvdEgj7FPLNXUrs118sXJ9vN3kLkZxtto-weo,34474
30
+ cua_agent-0.4.2.dist-info/METADATA,sha256=mWUkghYqwfpH9ElvfMlzG30mNuDdlnKPr8VmNnZalAg,12060
31
+ cua_agent-0.4.2.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
32
+ cua_agent-0.4.2.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
33
+ cua_agent-0.4.2.dist-info/RECORD,,
@@ -1,30 +0,0 @@
1
- agent/__init__.py,sha256=aRumS6zu5IoVToS-fasvIJ7msjE-gufNsMUY-LPAf0Q,356
2
- agent/__main__.py,sha256=lBUe8Niqa5XoCjwFfXyX7GtnUwjjZXC1-j4V9mvUYSc,538
3
- agent/adapters/__init__.py,sha256=szM2HMten2WkcqXeRnan__-sXjpyS4eyvIW0LXSfj4U,178
4
- agent/adapters/huggingfacelocal_adapter.py,sha256=dnzzxYCvFiuDdNzsb_1uM-boWv1eS__dWMve_fAnlUc,8038
5
- agent/agent.py,sha256=tXVnqzwC721UUN57OWEatfoZXFAzaDfrZ0G-EuVK3Ug,24022
6
- agent/callbacks/__init__.py,sha256=SO9NKTrmk4sZ7ZwvWFhTtK9co1FgwubUe3bwkIXYwn0,472
7
- agent/callbacks/base.py,sha256=UnnnYlh6XCm6HKZZsAPaT_Eyo9LUYLyjyNwF-QRm6Ns,4691
8
- agent/callbacks/budget_manager.py,sha256=XNrL1z3pxAZkywy6f8kfbRjDWq2ZvKcpnP2ElC8LBJs,1875
9
- agent/callbacks/image_retention.py,sha256=tiuRT5ke9xXTb2eP8Gz-2ITyAMY29LURUH6AbjX3RP8,6165
10
- agent/callbacks/logging.py,sha256=OOxU97EzrxlnUAtiEnvy9FB7SwCUK90-rdpDFA2Ae4E,10921
11
- agent/callbacks/pii_anonymization.py,sha256=UKAqNacHG3z92_6uocVzOIl8gJoqyofldCoCmB4UVIE,10268
12
- agent/callbacks/trajectory_saver.py,sha256=POE8aPT-MBzfW873wr6C7iiVUHtp483KwvLPxC1S3EY,11626
13
- agent/cli.py,sha256=WZFyhmTbFnA7QgZmqKO5tGoWsKeO12-GVlBab314o9Q,10002
14
- agent/computer_handler.py,sha256=2gfFBeDk9Vd54x9mOqnswMo8BdjUduLo5I0RbBPLovY,3964
15
- agent/decorators.py,sha256=bCmcCjP31WEjWg1D91OE2jo7AZTfGa9cNgCnYUvjiyw,2832
16
- agent/loops/__init__.py,sha256=_qpP_--3ePdFkTZP8qmUEFlBsy6m4h8fj0gGLDKA7zw,217
17
- agent/loops/anthropic.py,sha256=w5s_zvkXdcHt0DgBMYjDQGDMBXK4bPu-SyeIMhA1Rrs,32243
18
- agent/loops/omniparser.py,sha256=m3bDNQ0Igc_HHVoAbjVNj599uRoC9Eap3DCALg6RZ54,11422
19
- agent/loops/openai.py,sha256=ArTqadeJY8F9N8ZLKfswlzgHV_54HbWJgLd4l6ele9w,3010
20
- agent/loops/uitars.py,sha256=L0NYxKoIiMfIHbyomnaiK3ZGLmLv3QMx9nX57GruAk0,26323
21
- agent/responses.py,sha256=8vnCqi21x3gzo59yDmcsA_E_-CyYxIuCwgfQF0PIomg,6867
22
- agent/types.py,sha256=GiLxIcF7s1XIh_WaY7tjdQPFpdTXb5MWVe_ZUPA0gkY,2364
23
- agent/ui/__init__.py,sha256=o7NIpZGFiCTUhgj6eB7gWRRpVhrUAsrOdWnPgbfDgVM,124
24
- agent/ui/gradio/__init__.py,sha256=j3dc1i14daVIDEo-3K1w_v5EyDsHeB3TdgKkuteDivM,143
25
- agent/ui/gradio/app.py,sha256=9i4YzLZRkvPrYKnrl6eDx1mR2QaSSsWgG-YQVlhedX8,8788
26
- agent/ui/gradio/ui_components.py,sha256=IZsYOwn3dwQN8E5-3cFVlLhGlu77I35YhdPY8QxB0Uk,33513
27
- cua_agent-0.4.0b4.dist-info/METADATA,sha256=w5UZTqIVKO8KcaR5FePe9z-iog9a4WWDIwpYDJi4xIQ,12062
28
- cua_agent-0.4.0b4.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
29
- cua_agent-0.4.0b4.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
30
- cua_agent-0.4.0b4.dist-info/RECORD,,