open-swarm 0.1.1744936173__py3-none-any.whl → 0.1.1744936297__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.
- {open_swarm-0.1.1744936173.dist-info → open_swarm-0.1.1744936297.dist-info}/METADATA +1 -1
- {open_swarm-0.1.1744936173.dist-info → open_swarm-0.1.1744936297.dist-info}/RECORD +27 -27
- {open_swarm-0.1.1744936173.dist-info → open_swarm-0.1.1744936297.dist-info}/entry_points.txt +1 -0
- swarm/blueprints/digitalbutlers/blueprint_digitalbutlers.py +28 -0
- swarm/blueprints/divine_code/blueprint_divine_code.py +26 -0
- swarm/blueprints/django_chat/blueprint_django_chat.py +15 -4
- swarm/blueprints/echocraft/blueprint_echocraft.py +9 -2
- swarm/blueprints/family_ties/blueprint_family_ties.py +28 -0
- swarm/blueprints/gaggle/blueprint_gaggle.py +117 -15
- swarm/blueprints/monkai_magic/blueprint_monkai_magic.py +10 -0
- swarm/blueprints/nebula_shellz/blueprint_nebula_shellz.py +47 -29
- swarm/blueprints/omniplex/blueprint_omniplex.py +21 -0
- swarm/blueprints/rue_code/blueprint_rue_code.py +24 -25
- swarm/blueprints/suggestion/blueprint_suggestion.py +35 -12
- swarm/consumers.py +19 -0
- swarm/extensions/blueprint/agent_utils.py +1 -1
- swarm/extensions/blueprint/blueprint_base.py +265 -43
- swarm/extensions/blueprint/blueprint_discovery.py +13 -11
- swarm/extensions/blueprint/cli_handler.py +33 -55
- swarm/extensions/blueprint/output_utils.py +78 -0
- swarm/extensions/blueprint/spinner.py +30 -21
- swarm/extensions/cli/cli_args.py +6 -0
- swarm/extensions/config/config_loader.py +4 -1
- swarm/llm/chat_completion.py +31 -1
- swarm/settings.py +6 -7
- {open_swarm-0.1.1744936173.dist-info → open_swarm-0.1.1744936297.dist-info}/WHEEL +0 -0
- {open_swarm-0.1.1744936173.dist-info → open_swarm-0.1.1744936297.dist-info}/licenses/LICENSE +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: open-swarm
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.1744936297
|
4
4
|
Summary: Open Swarm: Orchestrating AI Agent Swarms with Django
|
5
5
|
Project-URL: Homepage, https://github.com/yourusername/open-swarm
|
6
6
|
Project-URL: Documentation, https://github.com/yourusername/open-swarm/blob/main/README.md
|
@@ -1,13 +1,13 @@
|
|
1
1
|
swarm/__init__.py,sha256=aT-yyX84tiZhihp0RAXYTADCo9dhOnmolQVfn4_NQa8,46
|
2
2
|
swarm/apps.py,sha256=up4C3m2JeyXeUcH-wYeReCuiOBVJ6404w9OfaRChLwM,2568
|
3
3
|
swarm/auth.py,sha256=8JIk1VbBvFFwOijEJAsrx6si802ZSMGnErXvmo0izUg,5935
|
4
|
-
swarm/consumers.py,sha256=
|
4
|
+
swarm/consumers.py,sha256=rpPTLqNhxFuvtuPUwLSRpc4H-92yrx7ZtDr77ELR81Y,5996
|
5
5
|
swarm/messages.py,sha256=CwADrjlj-uVmm-so1xIZvN1UkEWdzSn_hu7slfhuS8w,6549
|
6
6
|
swarm/middleware.py,sha256=lPlHbFg9Rm9lUuvg026d4zTDjRMc8bQi0JegpGdqIZQ,3198
|
7
7
|
swarm/models.py,sha256=Ix0WEYYqza2lbOEBNesikRCs3XGUPWmqQyMWzZYUaxM,1494
|
8
8
|
swarm/permissions.py,sha256=iM86fSL1TtgqJzgDkS3Dl82X6Xk7VDHWwdBDfs5RKWc,1671
|
9
9
|
swarm/serializers.py,sha256=4g3G2FdWpSIuLLC_SBKoNITw1b0G83Bxo7YHc-kjsro,4550
|
10
|
-
swarm/settings.py,sha256=
|
10
|
+
swarm/settings.py,sha256=yZzd_v1ux3POX6WPdgH8CQUF_0n5x720Kn8JQvCQgT4,6633
|
11
11
|
swarm/tool_executor.py,sha256=KHM2mTGgbbTgWNN3fbV5c4MDY238OTLwaaqtkczFHFQ,12385
|
12
12
|
swarm/urls.py,sha256=9eRQWsB-Vs3Nmes4mtlZtk_Rvuixf4Y9uwrX9dVQ9Is,3292
|
13
13
|
swarm/util.py,sha256=G4x2hXopHhB7IdGCkUXGoykYWyiICnjxg7wcr-WqL8I,4644
|
@@ -16,56 +16,56 @@ swarm/agent/__init__.py,sha256=YESGu_UXEBxrlQwghodUMN0vmXZDwWMU7DclCUvoklA,104
|
|
16
16
|
swarm/blueprints/README.md,sha256=tsngbSB9N0tILcz_m1OGAjyKZQYlGTN-i5e5asq1GbE,8478
|
17
17
|
swarm/blueprints/chatbot/blueprint_chatbot.py,sha256=a5-gIyDvRtNgbyfviD9Hua9r5NjOQh1lOafIG2a6kiI,7520
|
18
18
|
swarm/blueprints/chatbot/templates/chatbot/chatbot.html,sha256=REFnqNg0EHsXxAUfaCJe1YgOKiV_umBXuC6y8veF5CU,1568
|
19
|
-
swarm/blueprints/digitalbutlers/blueprint_digitalbutlers.py,sha256=
|
19
|
+
swarm/blueprints/digitalbutlers/blueprint_digitalbutlers.py,sha256=bQ0h_oC7TBbwjXhlSDGgjsnePb8cRcCnft2CggZuLY0,11301
|
20
20
|
swarm/blueprints/divine_code/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
21
21
|
swarm/blueprints/divine_code/apps.py,sha256=k615JHdfOuo_GwfVbC7ah8X9OblkAL2XWm9aLBjmMyY,306
|
22
|
-
swarm/blueprints/divine_code/blueprint_divine_code.py,sha256=
|
22
|
+
swarm/blueprints/divine_code/blueprint_divine_code.py,sha256=p4A9RhvBrWy6OKFNWCxKUqQAmkc49xcSh5V0FGiZ50k,14994
|
23
23
|
swarm/blueprints/django_chat/apps.py,sha256=rn1Eu11c4zZ6DYZeFb6AkCDMoM_dcQTzeNwW-IxXpCI,200
|
24
|
-
swarm/blueprints/django_chat/blueprint_django_chat.py,sha256=
|
24
|
+
swarm/blueprints/django_chat/blueprint_django_chat.py,sha256=kaxR7mV6mYW3HQTLO36xpCP2jhbj_sb4VKnMgE9GiWo,3716
|
25
25
|
swarm/blueprints/django_chat/urls.py,sha256=TTTF3pgymvCYbuxpwi4WRBPv8ftQNH4pEoURT8sEVAg,147
|
26
26
|
swarm/blueprints/django_chat/views.py,sha256=MUKjXXjXsq8jMZtAb4RR9g2mEYrwFemN6Bqxpeyi7p4,1299
|
27
27
|
swarm/blueprints/django_chat/templates/django_chat/django_chat_webpage.html,sha256=wAEOI4Wg0JJ8drXaOcr2Pel6lW3JSHmyIpbocLS5tI8,1649
|
28
|
-
swarm/blueprints/echocraft/blueprint_echocraft.py,sha256=
|
28
|
+
swarm/blueprints/echocraft/blueprint_echocraft.py,sha256=Bv9ceqPQgPtWDHtmZejJn9YyXPJOA4uUwXnQpBcG52g,3145
|
29
29
|
swarm/blueprints/family_ties/apps.py,sha256=EjV7AxDNsLM4gsLr_qMEiLAVbERuo1ZsdU9vPtOEYAY,287
|
30
|
-
swarm/blueprints/family_ties/blueprint_family_ties.py,sha256=
|
30
|
+
swarm/blueprints/family_ties/blueprint_family_ties.py,sha256=Pkqgf7oF5Ag8YddeeLbGPreb4r1YdGSYSsOQmZ18VIM,9462
|
31
31
|
swarm/blueprints/family_ties/models.py,sha256=C3_okdVVYuu9xOpoKRsaLoGrM2775cS_cU4UKYAkJ9s,903
|
32
32
|
swarm/blueprints/family_ties/serializers.py,sha256=kH3T6OgXjF534bO3gfAUr6GpXZ5Jx0BQkK58nvuEcqA,325
|
33
33
|
swarm/blueprints/family_ties/settings.py,sha256=5zcVsq7ny3GLWcJnOplZW4fMFNtyC3ba0ZOESRD2gh4,425
|
34
34
|
swarm/blueprints/family_ties/urls.py,sha256=awRZHb1gb1p3I6YZzfKMGSydd6kYPTLgax2jZ1ocS4U,294
|
35
35
|
swarm/blueprints/family_ties/views.py,sha256=FbPkDNlFEixtRFbSpkr51IyJ28FRkXa1W5xyO_KeXH0,1081
|
36
36
|
swarm/blueprints/flock/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
37
|
-
swarm/blueprints/gaggle/blueprint_gaggle.py,sha256=
|
37
|
+
swarm/blueprints/gaggle/blueprint_gaggle.py,sha256=4H_eJQEzmw56IiadhMa8dYqHeiY9ubJiK5ziffo01Zs,14151
|
38
38
|
swarm/blueprints/mcp_demo/blueprint_mcp_demo.py,sha256=eUu5_BvLwVSdWiEonXWKuN7YgKsqz04JB_KbMPowryc,6599
|
39
39
|
swarm/blueprints/messenger/templates/messenger/messenger.html,sha256=izuFtFn40Gm7M4gSUAUT5CIezjBjmNv2w4_fwSlv7VA,2323
|
40
40
|
swarm/blueprints/mission_improbable/blueprint_mission_improbable.py,sha256=N4Tw0laErP4eCJM103XOaVrqbFNKZRUG1Bpze8g79MI,12753
|
41
|
-
swarm/blueprints/monkai_magic/blueprint_monkai_magic.py,sha256=
|
42
|
-
swarm/blueprints/nebula_shellz/blueprint_nebula_shellz.py,sha256=
|
43
|
-
swarm/blueprints/omniplex/blueprint_omniplex.py,sha256=
|
41
|
+
swarm/blueprints/monkai_magic/blueprint_monkai_magic.py,sha256=cx2hPbYcttOcvC4jfb6tExSUKiL4GMOHxuqzLtuSlso,14235
|
42
|
+
swarm/blueprints/nebula_shellz/blueprint_nebula_shellz.py,sha256=d_b-5doQVLUMfoFMLeQfumVl09hr91JkuGTonLtrqi4,9917
|
43
|
+
swarm/blueprints/omniplex/blueprint_omniplex.py,sha256=wbxTux_98dFjUSjzJNIhLDJMNlVfAfSUmlJjTJ9VQFs,12670
|
44
44
|
swarm/blueprints/rue_code/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
45
|
-
swarm/blueprints/rue_code/blueprint_rue_code.py,sha256=
|
46
|
-
swarm/blueprints/suggestion/blueprint_suggestion.py,sha256=
|
45
|
+
swarm/blueprints/rue_code/blueprint_rue_code.py,sha256=28Eb_SDsvlnDC3SLNYHrKBpD6izTz53U-jqfZ6nqpto,15417
|
46
|
+
swarm/blueprints/suggestion/blueprint_suggestion.py,sha256=hB7SWedDcc97LzVK56qEe7IufK_p5Ze-9H5TxXREGsE,7112
|
47
47
|
swarm/blueprints/unapologetic_press/blueprint_unapologetic_press.py,sha256=e1-HpSHNp1PJAcb3-6sI1kE7KeJRQ2lGTUJPXYjvaY4,17648
|
48
48
|
swarm/blueprints/whiskeytango_foxtrot/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
49
49
|
swarm/blueprints/whiskeytango_foxtrot/apps.py,sha256=V1QKvyb2Vz-EtDNhhNe4tw2W9LYhNDuiaIq_fAU4ilw,334
|
50
50
|
swarm/blueprints/whiskeytango_foxtrot/blueprint_whiskeytango_foxtrot.py,sha256=ithMeMjU6bMeX1AeaSBX22yRmu9yizfafGD4sjykoeo,14301
|
51
51
|
swarm/extensions/__init__.py,sha256=SadbzfxckByaaqzuKPfXMvqmj45-dcMlavlfQYhGnzE,56
|
52
52
|
swarm/extensions/blueprint/__init__.py,sha256=VHSlq8q3AeclMsp63f8RXc3vhcZyzHH0uEaYV6AW-ZI,1841
|
53
|
-
swarm/extensions/blueprint/agent_utils.py,sha256=
|
54
|
-
swarm/extensions/blueprint/blueprint_base.py,sha256=
|
55
|
-
swarm/extensions/blueprint/blueprint_discovery.py,sha256=
|
53
|
+
swarm/extensions/blueprint/agent_utils.py,sha256=exKnbJEm1VRL270x6XqQXHtJhqD8ogY3ZBIGZO_tYUE,552
|
54
|
+
swarm/extensions/blueprint/blueprint_base.py,sha256=GI1vFcrU2oZpDpqnzWEZNe9O0jJpTfOXuAvmBfWYOcg,15435
|
55
|
+
swarm/extensions/blueprint/blueprint_discovery.py,sha256=v9lJeFDvPI919NzFjaCvmFBix5n0ceeL9y2JWGr_uLw,5720
|
56
56
|
swarm/extensions/blueprint/blueprint_utils.py,sha256=Ef_pu-RYomqzFjMg6LOSPSdbYFCbYXjEoSvK1OT49Eo,702
|
57
|
-
swarm/extensions/blueprint/cli_handler.py,sha256=
|
57
|
+
swarm/extensions/blueprint/cli_handler.py,sha256=kbF9G7sR5b5oD_t3rUijILZIog4hVMc-kR_ohWK0Mw0,8338
|
58
58
|
swarm/extensions/blueprint/common_utils.py,sha256=jeKcN3lMdrpOYWIpErH3L5am13jHjaImpVvk2b0mps4,462
|
59
59
|
swarm/extensions/blueprint/config_loader.py,sha256=ldQGtv4tXeDJzL2GCylDxykZxYBo4ALFY2kS0jZ79Eo,5652
|
60
60
|
swarm/extensions/blueprint/django_utils.py,sha256=ObtkmF1JW4H2OEYa7vC6ussUsMBtDsZTTVeHGHI-GOQ,17457
|
61
61
|
swarm/extensions/blueprint/interactive_mode.py,sha256=vGmMuAgC93TLjMi2RkXQ2FkWfIUblyOTFGHmVdGKLSQ,4572
|
62
|
-
swarm/extensions/blueprint/output_utils.py,sha256=
|
62
|
+
swarm/extensions/blueprint/output_utils.py,sha256=HGpXIujoJNM5nCCzXH0Upog_ctw5BuftmMBiPujh-ZM,7139
|
63
63
|
swarm/extensions/blueprint/runnable_blueprint.py,sha256=1MywZ54vUysLVtYmwCbcDYQmQnoZffCHgsArbe-VKe8,1813
|
64
|
-
swarm/extensions/blueprint/spinner.py,sha256=
|
64
|
+
swarm/extensions/blueprint/spinner.py,sha256=9lyjzLnQBdEBy_dXr6N6I7nxx6KfrNp7wf44sQN06GU,3756
|
65
65
|
swarm/extensions/blueprint/modes/rest_mode.py,sha256=KZuB_j2NfomER7CmlsLBqRipU3DymKY-9RpoGilMH0I,1357
|
66
66
|
swarm/extensions/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
67
67
|
swarm/extensions/cli/blueprint_runner.py,sha256=CG6XfOiDWuc84I_qefBpkwxEs7JcIbvNJqce9jBYUxo,9158
|
68
|
-
swarm/extensions/cli/cli_args.py,sha256=
|
68
|
+
swarm/extensions/cli/cli_args.py,sha256=z7jzrOFx8eBNW1N9ilKK07zN6VsTbjyLPp19tbmq9c8,3239
|
69
69
|
swarm/extensions/cli/interactive_shell.py,sha256=ocHBP975uqJU5LQyM2IiMVW5lQ387lgYHe3sme9ucX4,1322
|
70
70
|
swarm/extensions/cli/main.py,sha256=NnmovA7h1Rj1eDQVYe9AN6-eraIbIclHesNVmQPjdk4,1002
|
71
71
|
swarm/extensions/cli/selection.py,sha256=etdG6hJFgnLuvD_sVJvXg8qFcgjzCjyL-vYyxWcU0TI,2002
|
@@ -80,7 +80,7 @@ swarm/extensions/cli/commands/validate_envvars.py,sha256=7-BDPYzV7wsga7kOggHNuCs
|
|
80
80
|
swarm/extensions/cli/utils/discover_commands.py,sha256=aJdU3kSmLlpBxzGdfOA88AaCwpknHSD2cE0piCHZRUY,1053
|
81
81
|
swarm/extensions/cli/utils/env_setup.py,sha256=k7QxRjzIGx5HC6RVZP9QSaaXEKMkcKCewD66u0e7qfE,496
|
82
82
|
swarm/extensions/config/__init__.py,sha256=WjmGxMU5k3S40TNQxTfByYcT2YAchq_5gzXFWDLrLzU,141
|
83
|
-
swarm/extensions/config/config_loader.py,sha256=
|
83
|
+
swarm/extensions/config/config_loader.py,sha256=q-zO8qnKudCfoVOKYak5RXbvozMYTygLtVgU4BGYPi4,4992
|
84
84
|
swarm/extensions/config/config_manager.py,sha256=bBT-NGbRdsXoJ-lxZM5kjAf5FvVVGRVdbbCQJiCX1_0,9951
|
85
85
|
swarm/extensions/config/server_config.py,sha256=iBlQOaFQmkEPNLmVpAQvXlSWhTsu-YMIjEf-H-7QfUU,1882
|
86
86
|
swarm/extensions/config/setup_wizard.py,sha256=yAZ7MOgc8ZGti2kjZ72G6QLFBI0lbhXAa7Wi7SeXDYo,4567
|
@@ -92,7 +92,7 @@ swarm/extensions/launchers/build_swarm_wrapper.py,sha256=c_9oR3To4M2cZyc1uYSiysH
|
|
92
92
|
swarm/extensions/launchers/swarm_api.py,sha256=f8olTI5JVdayp923etVQWsP8WRquPG5Mw3Q40ItN6kY,2877
|
93
93
|
swarm/extensions/launchers/swarm_cli.py,sha256=dlvMq2HvUI2XlADuTzM8kpeedPkqzKB6k0oy7z2V_p0,9747
|
94
94
|
swarm/extensions/launchers/swarm_wrapper.py,sha256=3K58yqPN4Ct0c7zfSDKRIGdL1Q7WOBXmAVHXT-aaPj4,1004
|
95
|
-
swarm/llm/chat_completion.py,sha256=
|
95
|
+
swarm/llm/chat_completion.py,sha256=KR5ibJFZPBDKNuNIdlpushw6bcOVoY-jDeP-NJX4Qeg,9134
|
96
96
|
swarm/management/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
97
97
|
swarm/management/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
98
98
|
swarm/management/commands/runserver.py,sha256=MQJxuV_4le4u_4RJu25OyiDgcEOyIB9StQ2U8xrkTOA,2621
|
@@ -252,8 +252,8 @@ swarm/views/message_views.py,sha256=sDUnXyqKXC8WwIIMAlWf00s2_a2T9c75Na5FvYMJwBM,
|
|
252
252
|
swarm/views/model_views.py,sha256=aAbU4AZmrOTaPeKMWtoKK7FPYHdaN3Zbx55JfKzYTRY,2937
|
253
253
|
swarm/views/utils.py,sha256=geX3Z5ZDKFYyXYBMilc-4qgOSjhujK3AfRtvbXgFpXk,3643
|
254
254
|
swarm/views/web_views.py,sha256=ExQQeJpZ8CkLZQC_pXKOOmdnEy2qR3wEBP4LLp27DPU,7404
|
255
|
-
open_swarm-0.1.
|
256
|
-
open_swarm-0.1.
|
257
|
-
open_swarm-0.1.
|
258
|
-
open_swarm-0.1.
|
259
|
-
open_swarm-0.1.
|
255
|
+
open_swarm-0.1.1744936297.dist-info/METADATA,sha256=38QBqb2NpLSiOFTNCNdi-17EQnX3Z_9tPFP4fu6jWRw,13678
|
256
|
+
open_swarm-0.1.1744936297.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
257
|
+
open_swarm-0.1.1744936297.dist-info/entry_points.txt,sha256=fo28d0_zJrytRsh8QqkdlWQT_9lyAwYUx1WuSTDI3HM,177
|
258
|
+
open_swarm-0.1.1744936297.dist-info/licenses/LICENSE,sha256=BU9bwRlnOt_JDIb6OT55Q4leLZx9RArDLTFnlDIrBEI,1062
|
259
|
+
open_swarm-0.1.1744936297.dist-info/RECORD,,
|
@@ -8,6 +8,8 @@ project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..
|
|
8
8
|
src_path = os.path.join(project_root, 'src')
|
9
9
|
if src_path not in sys.path: sys.path.insert(0, src_path)
|
10
10
|
|
11
|
+
from typing import Optional
|
12
|
+
from pathlib import Path
|
11
13
|
try:
|
12
14
|
from agents import Agent, Tool, function_tool, Runner # Added Runner
|
13
15
|
from agents.mcp import MCPServer
|
@@ -61,6 +63,9 @@ gutenberg_instructions = (
|
|
61
63
|
|
62
64
|
# --- Define the Blueprint ---
|
63
65
|
class DigitalButlersBlueprint(BlueprintBase):
|
66
|
+
def __init__(self, blueprint_id: str, config_path: Optional[Path] = None, **kwargs):
|
67
|
+
super().__init__(blueprint_id, config_path=config_path, **kwargs)
|
68
|
+
|
64
69
|
"""Blueprint for private web search and home automation using a team of digital butlers."""
|
65
70
|
metadata: ClassVar[Dict[str, Any]] = {
|
66
71
|
"name": "DigitalButlersBlueprint",
|
@@ -178,6 +183,29 @@ class DigitalButlersBlueprint(BlueprintBase):
|
|
178
183
|
logger.debug("Digital Butlers team created: Jeeves (Coordinator), Mycroft (Search), Gutenberg (Home).")
|
179
184
|
return jeeves_agent # Jeeves is the entry point
|
180
185
|
|
186
|
+
async def run(self, messages: List[Dict[str, Any]], **kwargs) -> Any:
|
187
|
+
"""Main execution entry point for the DigitalButlers blueprint."""
|
188
|
+
logger.info("DigitalButlersBlueprint run method called.")
|
189
|
+
instruction = messages[-1].get("content", "") if messages else ""
|
190
|
+
async for chunk in self._run_non_interactive(instruction, **kwargs):
|
191
|
+
yield chunk
|
192
|
+
logger.info("DigitalButlersBlueprint run method finished.")
|
193
|
+
|
194
|
+
async def _run_non_interactive(self, instruction: str, **kwargs) -> Any:
|
195
|
+
logger.info(f"Running DigitalButlers non-interactively with instruction: '{instruction[:100]}...'")
|
196
|
+
mcp_servers = kwargs.get("mcp_servers", [])
|
197
|
+
agent = self.create_starting_agent(mcp_servers=mcp_servers)
|
198
|
+
# Use Runner.run as a classmethod for portability
|
199
|
+
from agents import Runner
|
200
|
+
import os
|
201
|
+
model_name = os.getenv("LITELLM_MODEL") or os.getenv("DEFAULT_LLM") or "gpt-3.5-turbo"
|
202
|
+
try:
|
203
|
+
for chunk in Runner.run(agent, instruction):
|
204
|
+
yield chunk
|
205
|
+
except Exception as e:
|
206
|
+
logger.error(f"Error during non-interactive run: {e}", exc_info=True)
|
207
|
+
yield {"messages": [{"role": "assistant", "content": f"An error occurred: {e}"}]}
|
208
|
+
|
181
209
|
# Standard Python entry point
|
182
210
|
if __name__ == "__main__":
|
183
211
|
DigitalButlersBlueprint.main()
|
@@ -8,6 +8,8 @@ project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..
|
|
8
8
|
src_path = os.path.join(project_root, 'src')
|
9
9
|
if src_path not in sys.path: sys.path.insert(0, src_path)
|
10
10
|
|
11
|
+
from typing import Optional
|
12
|
+
from pathlib import Path
|
11
13
|
try:
|
12
14
|
from agents import Agent, Tool, function_tool, Runner
|
13
15
|
from agents.mcp import MCPServer
|
@@ -107,6 +109,9 @@ Available MCP Tools (if provided): sequential-thinking, filesystem.
|
|
107
109
|
|
108
110
|
# --- Define the Blueprint ---
|
109
111
|
class DivineOpsBlueprint(BlueprintBase):
|
112
|
+
def __init__(self, blueprint_id: str, config_path: Optional[Path] = None, **kwargs):
|
113
|
+
super().__init__(blueprint_id, config_path=config_path, **kwargs)
|
114
|
+
|
110
115
|
""" Divine Ops: Streamlined Software Dev & Sysadmin Team Blueprint using openai-agents """
|
111
116
|
metadata: ClassVar[Dict[str, Any]] = {
|
112
117
|
"name": "DivineOpsBlueprint",
|
@@ -214,6 +219,27 @@ class DivineOpsBlueprint(BlueprintBase):
|
|
214
219
|
logger.debug("Divine Ops Team (Zeus & Pantheon) created successfully. Zeus is starting agent.")
|
215
220
|
return zeus_agent
|
216
221
|
|
222
|
+
async def run(self, messages: List[Dict[str, Any]], **kwargs) -> Any:
|
223
|
+
"""Main execution entry point for the DivineOps blueprint."""
|
224
|
+
logger.info("DivineOpsBlueprint run method called.")
|
225
|
+
instruction = messages[-1].get("content", "") if messages else ""
|
226
|
+
async for chunk in self._run_non_interactive(instruction, **kwargs):
|
227
|
+
yield chunk
|
228
|
+
logger.info("DivineOpsBlueprint run method finished.")
|
229
|
+
|
230
|
+
async def _run_non_interactive(self, instruction: str, **kwargs) -> Any:
|
231
|
+
logger.info(f"Running DivineOps non-interactively with instruction: '{instruction[:100]}...'")
|
232
|
+
mcp_servers = kwargs.get("mcp_servers", [])
|
233
|
+
agent = self.create_starting_agent(mcp_servers=mcp_servers)
|
234
|
+
runner = Runner(agent=agent)
|
235
|
+
try:
|
236
|
+
final_result = await runner.run(instruction)
|
237
|
+
logger.info(f"Non-interactive run finished. Final Output: {final_result.final_output}")
|
238
|
+
yield { "messages": [ {"role": "assistant", "content": final_result.final_output} ] }
|
239
|
+
except Exception as e:
|
240
|
+
logger.error(f"Error during non-interactive run: {e}", exc_info=True)
|
241
|
+
yield { "messages": [ {"role": "assistant", "content": f"An error occurred: {e}"} ] }
|
242
|
+
|
217
243
|
# Standard Python entry point
|
218
244
|
if __name__ == "__main__":
|
219
245
|
DivineOpsBlueprint.main()
|
@@ -10,11 +10,22 @@ import sys
|
|
10
10
|
import os
|
11
11
|
from typing import Dict, Any, List
|
12
12
|
|
13
|
+
# --- Logging Setup ---
|
14
|
+
def setup_logging():
|
15
|
+
import argparse
|
16
|
+
parser = argparse.ArgumentParser(add_help=False)
|
17
|
+
parser.add_argument('--debug', action='store_true', help='Enable debug logging')
|
18
|
+
args, _ = parser.parse_known_args()
|
19
|
+
loglevel = os.environ.get('LOGLEVEL', None)
|
20
|
+
if args.debug or os.environ.get('SWARM_DEBUG', '0') == '1' or (loglevel and loglevel.upper() == 'DEBUG'):
|
21
|
+
logging.basicConfig(level=logging.DEBUG)
|
22
|
+
else:
|
23
|
+
logging.basicConfig(level=logging.INFO)
|
24
|
+
return args
|
25
|
+
|
26
|
+
args = setup_logging()
|
27
|
+
|
13
28
|
logger = logging.getLogger(__name__)
|
14
|
-
logger.setLevel(logging.DEBUG)
|
15
|
-
handler = logging.StreamHandler(sys.stderr)
|
16
|
-
handler.setFormatter(logging.Formatter("[%(asctime)s] [%(levelname)s] %(name)s:%(lineno)d - %(message)s"))
|
17
|
-
logger.addHandler(handler)
|
18
29
|
|
19
30
|
# Reject CLI execution immediately
|
20
31
|
if __name__ == "__main__":
|
@@ -1,6 +1,7 @@
|
|
1
|
-
|
2
1
|
# --- Content for src/swarm/blueprints/echocraft/blueprint_echocraft.py ---
|
3
2
|
import logging
|
3
|
+
from typing import Optional
|
4
|
+
from pathlib import Path
|
4
5
|
from typing import List, Dict, Any, AsyncGenerator
|
5
6
|
import uuid # Import uuid to generate IDs
|
6
7
|
import time # Import time for timestamp
|
@@ -10,6 +11,9 @@ from swarm.extensions.blueprint.blueprint_base import BlueprintBase
|
|
10
11
|
logger = logging.getLogger(__name__)
|
11
12
|
|
12
13
|
class EchoCraftBlueprint(BlueprintBase):
|
14
|
+
def __init__(self, blueprint_id: str, config_path: Optional[Path] = None, **kwargs):
|
15
|
+
super().__init__(blueprint_id, config_path=config_path, **kwargs)
|
16
|
+
|
13
17
|
"""
|
14
18
|
A simple blueprint that echoes the last user message.
|
15
19
|
Used for testing and demonstrating basic blueprint structure.
|
@@ -27,6 +31,10 @@ class EchoCraftBlueprint(BlueprintBase):
|
|
27
31
|
"""
|
28
32
|
logger.info(f"EchoCraftBlueprint run called with {len(messages)} messages.")
|
29
33
|
|
34
|
+
# Ensure LLM profile is initialized for test compatibility
|
35
|
+
if self._llm_profile_name is None:
|
36
|
+
self._llm_profile_name = self.config.get("llm_profile", "default")
|
37
|
+
|
30
38
|
last_user_message_content = "No user message found."
|
31
39
|
for msg in reversed(messages):
|
32
40
|
if msg.get("role") == "user":
|
@@ -68,4 +76,3 @@ class EchoCraftBlueprint(BlueprintBase):
|
|
68
76
|
# --- End formatting change ---
|
69
77
|
|
70
78
|
logger.info("EchoCraftBlueprint run finished.")
|
71
|
-
|
@@ -8,6 +8,8 @@ project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..
|
|
8
8
|
src_path = os.path.join(project_root, 'src')
|
9
9
|
if src_path not in sys.path: sys.path.insert(0, src_path)
|
10
10
|
|
11
|
+
from typing import Optional
|
12
|
+
from pathlib import Path
|
11
13
|
try:
|
12
14
|
from agents import Agent, Tool, function_tool, Runner
|
13
15
|
from agents.mcp import MCPServer
|
@@ -53,6 +55,9 @@ brian_instructions = (
|
|
53
55
|
|
54
56
|
# --- Define the Blueprint ---
|
55
57
|
class FamilyTiesBlueprint(BlueprintBase):
|
58
|
+
def __init__(self, blueprint_id: str, config_path: Optional[Path] = None, **kwargs):
|
59
|
+
super().__init__(blueprint_id, config_path=config_path, **kwargs)
|
60
|
+
|
56
61
|
"""Manages WordPress content with a Peter/Brian agent team using the `server-wp-mcp` server."""
|
57
62
|
metadata: ClassVar[Dict[str, Any]] = {
|
58
63
|
"name": "FamilyTiesBlueprint", # Standardized name
|
@@ -148,5 +153,28 @@ class FamilyTiesBlueprint(BlueprintBase):
|
|
148
153
|
logger.debug("Agents created: PeterGrifton (Coordinator), BrianGrifton (WordPress Manager).")
|
149
154
|
return peter_agent # Peter is the entry point
|
150
155
|
|
156
|
+
async def run(self, messages: List[Dict[str, Any]], **kwargs) -> Any:
|
157
|
+
"""Main execution entry point for the FamilyTies blueprint."""
|
158
|
+
logger.info("FamilyTiesBlueprint run method called.")
|
159
|
+
instruction = messages[-1].get("content", "") if messages else ""
|
160
|
+
async for chunk in self._run_non_interactive(instruction, **kwargs):
|
161
|
+
yield chunk
|
162
|
+
logger.info("FamilyTiesBlueprint run method finished.")
|
163
|
+
|
164
|
+
async def _run_non_interactive(self, instruction: str, **kwargs) -> Any:
|
165
|
+
logger.info(f"Running FamilyTies non-interactively with instruction: '{instruction[:100]}...'")
|
166
|
+
mcp_servers = kwargs.get("mcp_servers", [])
|
167
|
+
agent = self.create_starting_agent(mcp_servers=mcp_servers)
|
168
|
+
# Use Runner.run as a classmethod for portability
|
169
|
+
from agents import Runner
|
170
|
+
import os
|
171
|
+
model_name = os.getenv("LITELLM_MODEL") or os.getenv("DEFAULT_LLM") or "gpt-3.5-turbo"
|
172
|
+
try:
|
173
|
+
for chunk in Runner.run(agent, instruction):
|
174
|
+
yield chunk
|
175
|
+
except Exception as e:
|
176
|
+
logger.error(f"Error during non-interactive run: {e}", exc_info=True)
|
177
|
+
yield {"messages": [{"role": "assistant", "content": f"An error occurred: {e}"}]}
|
178
|
+
|
151
179
|
if __name__ == "__main__":
|
152
180
|
FamilyTiesBlueprint.main()
|
@@ -1,6 +1,26 @@
|
|
1
1
|
import logging
|
2
|
-
|
2
|
+
logging.basicConfig(level=logging.INFO, format='[%(levelname)s] %(name)s: %(message)s')
|
3
|
+
import os
|
3
4
|
import sys
|
5
|
+
|
6
|
+
# --- Universal Logging Reset ---
|
7
|
+
def force_info_logging():
|
8
|
+
root = logging.getLogger()
|
9
|
+
for handler in root.handlers[:]:
|
10
|
+
root.removeHandler(handler)
|
11
|
+
loglevel = os.environ.get('LOGLEVEL', None)
|
12
|
+
debug_env = os.environ.get('SWARM_DEBUG', '0') == '1'
|
13
|
+
debug_arg = '--debug' in sys.argv
|
14
|
+
if debug_arg or debug_env or (loglevel and loglevel.upper() == 'DEBUG'):
|
15
|
+
level = logging.DEBUG
|
16
|
+
else:
|
17
|
+
level = logging.INFO
|
18
|
+
logging.basicConfig(level=level, format='[%(levelname)s] %(name)s: %(message)s')
|
19
|
+
root.setLevel(level)
|
20
|
+
|
21
|
+
force_info_logging()
|
22
|
+
|
23
|
+
import argparse
|
4
24
|
from typing import List, Dict, Any, Optional, ClassVar
|
5
25
|
|
6
26
|
# Ensure src is in path for BlueprintBase import (if needed, adjust path)
|
@@ -8,6 +28,8 @@ project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..
|
|
8
28
|
src_path = os.path.join(project_root, 'src')
|
9
29
|
if src_path not in sys.path: sys.path.insert(0, src_path)
|
10
30
|
|
31
|
+
from typing import Optional
|
32
|
+
from pathlib import Path
|
11
33
|
try:
|
12
34
|
from agents import Agent, Tool, function_tool, Runner
|
13
35
|
from agents.mcp import MCPServer
|
@@ -21,39 +43,66 @@ except ImportError as e:
|
|
21
43
|
print(f"sys.path: {sys.path}")
|
22
44
|
sys.exit(1)
|
23
45
|
|
46
|
+
import argparse
|
47
|
+
|
48
|
+
# --- Logging Setup ---
|
49
|
+
def setup_logging():
|
50
|
+
parser = argparse.ArgumentParser(add_help=False)
|
51
|
+
parser.add_argument('--debug', action='store_true', help='Enable debug logging')
|
52
|
+
args, _ = parser.parse_known_args()
|
53
|
+
loglevel = os.environ.get('LOGLEVEL', None)
|
54
|
+
if args.debug or os.environ.get('SWARM_DEBUG', '0') == '1' or (loglevel and loglevel.upper() == 'DEBUG'):
|
55
|
+
logging.basicConfig(level=logging.DEBUG)
|
56
|
+
else:
|
57
|
+
logging.basicConfig(level=logging.INFO)
|
58
|
+
return args
|
59
|
+
|
60
|
+
args = setup_logging()
|
61
|
+
|
24
62
|
logger = logging.getLogger(__name__)
|
25
63
|
|
26
64
|
# --- Tools ---
|
27
|
-
|
28
|
-
|
29
|
-
"""Generates a basic story outline based on a topic."""
|
30
|
-
logger.info(f"Tool: Generating outline for: {topic}") # Keep INFO for tool exec start
|
31
|
-
# In a real scenario, this might involve more logic or an LLM call.
|
32
|
-
# Adding slight variation for clarity
|
65
|
+
def _create_story_outline(topic: str) -> str:
|
66
|
+
logger.info(f"Tool: Generating outline for: {topic}")
|
33
67
|
outline = f"Story Outline for '{topic}':\n1. Beginning: Introduce characters and setting.\n2. Middle: Develop conflict and rising action.\n3. Climax: The peak of the conflict.\n4. End: Resolution and aftermath."
|
34
68
|
logger.debug(f"Generated outline: {outline}")
|
35
69
|
return outline
|
36
70
|
|
37
71
|
@function_tool
|
38
|
-
def
|
39
|
-
"""
|
40
|
-
|
41
|
-
|
72
|
+
def create_story_outline(topic: str) -> str:
|
73
|
+
"""Generates a basic story outline based on a topic."""
|
74
|
+
return _create_story_outline(topic)
|
75
|
+
|
76
|
+
def _write_story_part(part_name: str, outline: str, previous_parts: str) -> str:
|
77
|
+
logger.info(f"Tool: Writing story part: {part_name}")
|
42
78
|
content = f"## {part_name}\n\nThis is the draft content for the '{part_name}' section. It follows:\n'{previous_parts[:100]}...' \nIt should align with the outline:\n'{outline}'"
|
43
79
|
logger.debug(f"Generated content for {part_name}: {content[:100]}...")
|
44
80
|
return content
|
45
81
|
|
46
82
|
@function_tool
|
47
|
-
def
|
48
|
-
"""
|
49
|
-
|
50
|
-
|
83
|
+
def write_story_part(part_name: str, outline: str, previous_parts: str) -> str:
|
84
|
+
"""Writes a specific part of the story using the outline and previous context."""
|
85
|
+
return _write_story_part(part_name, outline, previous_parts)
|
86
|
+
|
87
|
+
def _edit_story(full_story: str, edit_instructions: str) -> str:
|
88
|
+
logger.info(f"Tool: Editing story with instructions: {edit_instructions}")
|
51
89
|
edited_content = f"*** Edited Story Draft ***\n(Based on instructions: '{edit_instructions}')\n\n{full_story}\n\n[Editor's Notes: Minor tweaks applied for flow.]"
|
52
90
|
logger.debug("Editing complete.")
|
53
91
|
return edited_content
|
54
92
|
|
93
|
+
@function_tool
|
94
|
+
def edit_story(full_story: str, edit_instructions: str) -> str:
|
95
|
+
"""Edits the complete story based on instructions."""
|
96
|
+
return _edit_story(full_story, edit_instructions)
|
97
|
+
|
55
98
|
# --- Blueprint Definition ---
|
99
|
+
from rich.console import Console
|
100
|
+
from rich.panel import Panel
|
101
|
+
|
56
102
|
class GaggleBlueprint(BlueprintBase):
|
103
|
+
def __init__(self, blueprint_id: str, config_path: Optional[Path] = None, **kwargs):
|
104
|
+
super().__init__(blueprint_id, config_path=config_path, **kwargs)
|
105
|
+
|
57
106
|
"""A multi-agent blueprint using a Coordinator, Planner, Writer, and Editor for collaborative story writing."""
|
58
107
|
metadata: ClassVar[Dict[str, Any]] = {
|
59
108
|
"name": "GaggleBlueprint",
|
@@ -70,6 +119,23 @@ class GaggleBlueprint(BlueprintBase):
|
|
70
119
|
_openai_client_cache: Dict[str, AsyncOpenAI] = {}
|
71
120
|
_model_instance_cache: Dict[str, Model] = {}
|
72
121
|
|
122
|
+
def display_splash_screen(self, animated: bool = False):
|
123
|
+
console = Console()
|
124
|
+
splash = r'''
|
125
|
+
[bold magenta]
|
126
|
+
____ _ _ ____ _ _
|
127
|
+
/ ___| __ _ _ __ __ _| | ___| |__ / ___|| |_ __ _ _ __| |_ ___
|
128
|
+
| | _ / _` | '_ \ / _` | |/ _ \ '_ \ \___ \| __/ _` | '__| __/ _ \
|
129
|
+
| |_| | (_| | | | | (_| | | __/ | | | ___) | || (_| | | | || __/
|
130
|
+
\____|\__,_|_| |_|\__, |_|\___|_| |_|____/ \__\__,_|_| \__\___|
|
131
|
+
|___/
|
132
|
+
[/bold magenta]
|
133
|
+
[white]Collaborative Story Writing Blueprint[/white]
|
134
|
+
'''
|
135
|
+
panel = Panel(splash, title="[bold magenta]Gaggle Blueprint[/]", border_style="magenta", expand=False)
|
136
|
+
console.print(panel)
|
137
|
+
console.print() # Blank line for spacing
|
138
|
+
|
73
139
|
# --- Model Instantiation Helper --- (Standard helper)
|
74
140
|
def _get_model_instance(self, profile_name: str) -> Model:
|
75
141
|
"""Retrieves or creates an LLM Model instance."""
|
@@ -180,5 +246,41 @@ class GaggleBlueprint(BlueprintBase):
|
|
180
246
|
logger.debug("Gaggle Story Writing Team created. Coordinator is the starting agent.")
|
181
247
|
return coordinator_agent
|
182
248
|
|
249
|
+
async def run(self, messages: List[Dict[str, str]]):
|
250
|
+
"""
|
251
|
+
Run the Gaggle blueprint agentic workflow.
|
252
|
+
Accepts a list of messages (e.g., task prompt from CLI) and yields output chunks.
|
253
|
+
"""
|
254
|
+
# For demonstration, this will run the collaborative story workflow
|
255
|
+
topic = None
|
256
|
+
for msg in messages:
|
257
|
+
if msg.get("role") == "user":
|
258
|
+
topic = msg.get("content")
|
259
|
+
break
|
260
|
+
if not topic:
|
261
|
+
yield {"messages": [{"role": "system", "content": "No topic provided."}]}
|
262
|
+
return
|
263
|
+
# Step 1: Planner creates outline
|
264
|
+
outline = _create_story_outline(topic)
|
265
|
+
yield {"messages": [{"role": "planner", "content": outline}]}
|
266
|
+
# Step 2: Writer writes story parts (simulate parts)
|
267
|
+
story_parts = []
|
268
|
+
for part in ["Beginning", "Middle", "Climax", "End"]:
|
269
|
+
part_text = _write_story_part(part, outline, "\n".join(story_parts))
|
270
|
+
story_parts.append(part_text)
|
271
|
+
yield {"messages": [{"role": "writer", "content": part_text}]}
|
272
|
+
# Step 3: Editor edits the full story
|
273
|
+
full_story = "\n\n".join(story_parts)
|
274
|
+
edited = _edit_story(full_story, "Polish for flow and clarity.")
|
275
|
+
yield {"messages": [{"role": "editor", "content": edited}]}
|
276
|
+
|
277
|
+
async def _run_non_interactive(self, instruction: str, **kwargs):
|
278
|
+
"""Adapter for CLI non-interactive execution, yields results from the public run method. Accepts **kwargs for compatibility."""
|
279
|
+
messages = [{"role": "user", "content": instruction}]
|
280
|
+
async for chunk in self.run(messages, **kwargs):
|
281
|
+
yield chunk
|
282
|
+
|
283
|
+
|
284
|
+
|
183
285
|
if __name__ == "__main__":
|
184
286
|
GaggleBlueprint.main()
|
@@ -116,6 +116,16 @@ def vercel_cli(command: str) -> str:
|
|
116
116
|
|
117
117
|
|
118
118
|
# --- Define the Blueprint ---
|
119
|
+
# === OpenAI GPT-4.1 Prompt Engineering Guide ===
|
120
|
+
# See: https://github.com/openai/openai-cookbook/blob/main/examples/gpt4-1_prompting_guide.ipynb
|
121
|
+
#
|
122
|
+
# Agentic System Prompt Example (recommended for cloud ops agents):
|
123
|
+
SYS_PROMPT_AGENTIC = """
|
124
|
+
You are an agent - please keep going until the user’s query is completely resolved, before ending your turn and yielding back to the user. Only terminate your turn when you are sure that the problem is solved.
|
125
|
+
If you are not sure about file content or codebase structure pertaining to the user’s request, use your tools to read files and gather the relevant information: do NOT guess or make up an answer.
|
126
|
+
You MUST plan extensively before each function call, and reflect extensively on the outcomes of the previous function calls. DO NOT do this entire process by making function calls only, as this can impair your ability to solve the problem and think insightfully.
|
127
|
+
"""
|
128
|
+
|
119
129
|
class MonkaiMagicBlueprint(BlueprintBase):
|
120
130
|
"""Blueprint for a cloud operations team inspired by *Monkai Magic*."""
|
121
131
|
metadata: ClassVar[Dict[str, Any]] = {
|