@zhijianma/studio 1.0.10
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.
- package/LICENSE +202 -0
- package/README.md +158 -0
- package/bin/cli.js +7 -0
- package/dist/app/friday/args.py +65 -0
- package/dist/app/friday/hook.py +52 -0
- package/dist/app/friday/main.py +164 -0
- package/dist/app/friday/model.py +124 -0
- package/dist/app/friday/tool/agentscope_tools.py +159 -0
- package/dist/app/friday/tool/utils.py +161 -0
- package/dist/app/friday/utils/common.py +28 -0
- package/dist/app/friday/utils/connect.py +63 -0
- package/dist/app/friday/utils/constants.py +8 -0
- package/dist/app/requirements.txt +1 -0
- package/dist/public/assets/001-aaron-Bb4ZO8rt.js +1 -0
- package/dist/public/assets/001-little girl-CnyQBZ0k.js +1 -0
- package/dist/public/assets/001-man-16-BO6NLPD_.js +1 -0
- package/dist/public/assets/002-avatar-C3FPnFjo.js +1 -0
- package/dist/public/assets/002-man-15-DfiiX2xR.js +1 -0
- package/dist/public/assets/002-old man-D4L-hA2l.js +1 -0
- package/dist/public/assets/003-avatar-UMXD80xE.js +1 -0
- package/dist/public/assets/003-cat-Cgyj1qJU.js +1 -0
- package/dist/public/assets/003-woman-20-Dy0WdjIG.js +1 -0
- package/dist/public/assets/004-avatar-D6Aw4tpO.js +1 -0
- package/dist/public/assets/004-dog-DUajs1ZO.js +1 -0
- package/dist/public/assets/004-woman-19-D5go5okE.js +1 -0
- package/dist/public/assets/005-avatar-NNQ3sWMe.js +1 -0
- package/dist/public/assets/005-child-SN-FoL0R.js +1 -0
- package/dist/public/assets/005-woman-18-AedSRg8a.js +1 -0
- package/dist/public/assets/006-avatar-FD8IUNL_.js +1 -0
- package/dist/public/assets/006-grandpa-T90IdpYr.js +1 -0
- package/dist/public/assets/006-man-14-DuMA-IZ-.js +1 -0
- package/dist/public/assets/007-avatar-eSQZtpkg.js +1 -0
- package/dist/public/assets/007-grandson-DV7UWhrR.js +1 -0
- package/dist/public/assets/007-man-13-owFTee2M.js +1 -0
- package/dist/public/assets/008-avatar-B9Rcm8D2.js +1 -0
- package/dist/public/assets/008-grandmother-1-BrQNVu9I.js +1 -0
- package/dist/public/assets/008-teenager-ClYxB7sG.js +1 -0
- package/dist/public/assets/009-avatar-DNSTEyOZ.js +1 -0
- package/dist/public/assets/009-grandfather-1-CPOn7LN0.js +1 -0
- package/dist/public/assets/009-grandmother-BAW_dEQC.js +1 -0
- package/dist/public/assets/010-avatar-CRXWH-A0.js +1 -0
- package/dist/public/assets/010-boy-1-C21LhAEr.js +1 -0
- package/dist/public/assets/011-woman-17-CI0UoPMR.js +1 -0
- package/dist/public/assets/012-avatar-BO5j-gGw.js +1 -0
- package/dist/public/assets/012-boy-T-hL8z9d.js +1 -0
- package/dist/public/assets/012-niece-M-tDMWMW.js +1 -0
- package/dist/public/assets/013-avatar-BTyOVKVo.js +1 -0
- package/dist/public/assets/013-granddaughter-D4VonRL-.js +1 -0
- package/dist/public/assets/013-woman-16-CuR7_ppw.js +1 -0
- package/dist/public/assets/014-avatar-DAW_Hvos.js +1 -0
- package/dist/public/assets/014-man-k8AXOF1Q.js +1 -0
- package/dist/public/assets/014-nurse-DnVigtmM.js +1 -0
- package/dist/public/assets/015-avatar-AxHR3j7h.js +1 -0
- package/dist/public/assets/015-woman-15-rDPwBxxc.js +1 -0
- package/dist/public/assets/015-woman-B71QRPrr.js +1 -0
- package/dist/public/assets/016-avatar-BVbMUisT.js +1 -0
- package/dist/public/assets/016-boy-BV_jzAu3.js +1 -0
- package/dist/public/assets/016-woman-14-D08zoPt9.js +1 -0
- package/dist/public/assets/017-gaming-BEpEpa1H.js +1 -0
- package/dist/public/assets/017-superpower-9xQAqiKN.js +1 -0
- package/dist/public/assets/017-uncle-EB1lmqAo.js +1 -0
- package/dist/public/assets/017-woman-13-BFsTAnGR.js +1 -0
- package/dist/public/assets/018-avatar-CnCLJXqW.js +1 -0
- package/dist/public/assets/018-young-QpIX6g3z.js +1 -0
- package/dist/public/assets/019-gaming-Dz5tR0Te.js +1 -0
- package/dist/public/assets/019-man-12-DiRb1dri.js +1 -0
- package/dist/public/assets/019-nephew-tXAgA9cr.js +1 -0
- package/dist/public/assets/020-avatar-Djtnu7jj.js +1 -0
- package/dist/public/assets/020-man-11-BNIZQyX4.js +1 -0
- package/dist/public/assets/020-young woman-BzklF8tq.js +1 -0
- package/dist/public/assets/021-aunt-CX9ikaTy.js +1 -0
- package/dist/public/assets/021-avatar-DP2sODK2.js +1 -0
- package/dist/public/assets/021-superhero-CIWREXp0.js +1 -0
- package/dist/public/assets/021-wizard-Dc9X50m_.js +1 -0
- package/dist/public/assets/021-woman-12-n9ipJK5z.js +1 -0
- package/dist/public/assets/022-father-B1_-ZTn1.js +1 -0
- package/dist/public/assets/022-woman-11-BUCsm06E.js +1 -0
- package/dist/public/assets/023-avatar-TeJ6vGqs.js +1 -0
- package/dist/public/assets/023-ghost-BYvGsa7H.js +1 -0
- package/dist/public/assets/023-man-10-Dfii-GE1.js +1 -0
- package/dist/public/assets/023-uncle-DoAMe1Iy.js +1 -0
- package/dist/public/assets/024-gaming-5ovd4aeT.js +1 -0
- package/dist/public/assets/024-man-9-CEenp_2W.js +1 -0
- package/dist/public/assets/024-prince-Fx3eCiNX.js +1 -0
- package/dist/public/assets/024-uncle-B6tqhqxU.js +1 -0
- package/dist/public/assets/025-gaming-CdlTp3Ub.js +1 -0
- package/dist/public/assets/025-man-8-Cfp6jNt4.js +1 -0
- package/dist/public/assets/025-man-BxhR-XTO.js +1 -0
- package/dist/public/assets/025-princess-Di5TdSnG.js +1 -0
- package/dist/public/assets/026-avatar-DojOPRVd.js +1 -0
- package/dist/public/assets/026-dad-CHaoMWM5.js +1 -0
- package/dist/public/assets/026-owl-Dl-UtZM8.js +1 -0
- package/dist/public/assets/026-woman-10-CywXJiaj.js +1 -0
- package/dist/public/assets/027-avatar-CrEyLmOb.js +1 -0
- package/dist/public/assets/027-girl-Box_GaMO.js +1 -0
- package/dist/public/assets/028-gaming-CmOZ2uGp.js +1 -0
- package/dist/public/assets/028-mom-tEacX7K4.js +1 -0
- package/dist/public/assets/028-woman-9-C1oq4sFk.js +1 -0
- package/dist/public/assets/029-boy-CVg6oMuZ.js +1 -0
- package/dist/public/assets/029-man-7-C4eeEeTQ.js +1 -0
- package/dist/public/assets/030-elf-C8vikAvx.js +1 -0
- package/dist/public/assets/030-gaming-ufCRMN7S.js +1 -0
- package/dist/public/assets/030-granddaughter-DVCp3D8k.js +1 -0
- package/dist/public/assets/030-woman-8-Bv_tRQci.js +1 -0
- package/dist/public/assets/031-avatar-D0u5HVaC.js +1 -0
- package/dist/public/assets/031-grandpa-jKj5oB8I.js +1 -0
- package/dist/public/assets/031-superhero-DfSkK-j2.js +1 -0
- package/dist/public/assets/031-woman-7-DJHfCbTS.js +1 -0
- package/dist/public/assets/032-avatar-BvY6LKIZ.js +1 -0
- package/dist/public/assets/032-grandson-DIjRxDr-.js +1 -0
- package/dist/public/assets/032-man-6-CU7pJmmt.js +1 -0
- package/dist/public/assets/033-avatar-Dviobgw8.js +1 -0
- package/dist/public/assets/033-elf-CTAEJgfN.js +1 -0
- package/dist/public/assets/033-grandfather-BCXPgoJj.js +1 -0
- package/dist/public/assets/033-man-5-wgMylvNO.js +1 -0
- package/dist/public/assets/034-avatar-BqtUHT3_.js +1 -0
- package/dist/public/assets/034-little girl-CrgnV25d.js +1 -0
- package/dist/public/assets/034-man-4-DJdzfcSi.js +1 -0
- package/dist/public/assets/035-gaming-Bp8xnJp_.js +1 -0
- package/dist/public/assets/035-mother-Ccg5FDO8.js +1 -0
- package/dist/public/assets/036-avatar-q6pZKQVf.js +1 -0
- package/dist/public/assets/036-father-DzpzeKJJ.js +1 -0
- package/dist/public/assets/036-goblin-vDsj4aP0.js +1 -0
- package/dist/public/assets/036-grandmother-BI_Fl_aR.js +1 -0
- package/dist/public/assets/037-avatar-CmfvVc7v.js +1 -0
- package/dist/public/assets/037-grandfather-Dtp4XH-s.js +1 -0
- package/dist/public/assets/037-sister-BQv83Uhf.js +1 -0
- package/dist/public/assets/038-gaming-UtXFtv5k.js +1 -0
- package/dist/public/assets/038-girl-Cwg5Rv36.js +1 -0
- package/dist/public/assets/038-gnome-HbogTmVa.js +1 -0
- package/dist/public/assets/038-woman-6-B7jMwsP0.js +1 -0
- package/dist/public/assets/039-avatar-Bb3kVg4l.js +1 -0
- package/dist/public/assets/039-man-3-BSjLnoLV.js +1 -0
- package/dist/public/assets/039-student-CIi32WG9.js +1 -0
- package/dist/public/assets/040-aunt-B5XQH_sJ.js +1 -0
- package/dist/public/assets/040-gaming-CzTjib4v.js +1 -0
- package/dist/public/assets/040-vampire-UFzaHu5c.js +1 -0
- package/dist/public/assets/040-woman-5-Byal-gfX.js +1 -0
- package/dist/public/assets/041-avatar-CPQN2PvT.js +1 -0
- package/dist/public/assets/041-little boy-DUZFMrmJ.js +1 -0
- package/dist/public/assets/041-queen-CqFzW3uO.js +1 -0
- package/dist/public/assets/041-woman-4-CKi_Q-ns.js +1 -0
- package/dist/public/assets/042-avatar-BatY-WQG.js +1 -0
- package/dist/public/assets/042-cyclops-DAxxBVqG.js +1 -0
- package/dist/public/assets/042-man-omzAnpu1.js +1 -0
- package/dist/public/assets/042-woman-3-2Ki1Qz3j.js +1 -0
- package/dist/public/assets/043-avatar-DN026abg.js +1 -0
- package/dist/public/assets/043-child-D8_xXkcm.js +1 -0
- package/dist/public/assets/043-genie-DK78Ykl6.js +1 -0
- package/dist/public/assets/043-woman-2-DMnB0A-0.js +1 -0
- package/dist/public/assets/044-avatar-Bz2FAXUw.js +1 -0
- package/dist/public/assets/044-avatar-DzDIyuj0.js +1 -0
- package/dist/public/assets/044-fairy-BT73odE0.js +1 -0
- package/dist/public/assets/044-sister-CtNPPHh-.js +1 -0
- package/dist/public/assets/045-avatar-DgiFAlxj.js +1 -0
- package/dist/public/assets/045-man-2-BZPavI2b.js +1 -0
- package/dist/public/assets/045-young-B39gytpm.js +1 -0
- package/dist/public/assets/046-avatar-ClHeZPOV.js +1 -0
- package/dist/public/assets/046-brother-BSvJBKnA.js +1 -0
- package/dist/public/assets/046-witch-CVjM2-iJ.js +1 -0
- package/dist/public/assets/046-woman-1-CHWuzLfU.js +1 -0
- package/dist/public/assets/047-avatar-DM01i1ZC.js +1 -0
- package/dist/public/assets/047-king-knA4oWNa.js +1 -0
- package/dist/public/assets/047-man-1-DRWdGzL5.js +1 -0
- package/dist/public/assets/048-father-B0wiM2h6.js +1 -0
- package/dist/public/assets/048-gaming-D7s83-h3.js +1 -0
- package/dist/public/assets/048-girl-CxGcfLgU.js +1 -0
- package/dist/public/assets/049-avatar-BfGDVwlO.js +1 -0
- package/dist/public/assets/049-little boy-Bu5mmsUf.js +1 -0
- package/dist/public/assets/049-man-B3xcAso3.js +1 -0
- package/dist/public/assets/050-avatar-itJOA0dd.js +1 -0
- package/dist/public/assets/050-boy-DEIcVyYT.js +1 -0
- package/dist/public/assets/050-knight-KRUkfXDS.js +1 -0
- package/dist/public/assets/051-avatar-fISL-mLU.js +1 -0
- package/dist/public/assets/052-avatar-BYrM0aPD.js +1 -0
- package/dist/public/assets/053-avatar-B-rnufvm.js +1 -0
- package/dist/public/assets/054-avatar-B7rwS7Qv.js +1 -0
- package/dist/public/assets/055-gaming-DqUOmMvT.js +1 -0
- package/dist/public/assets/056-avatar-D1lb7KL9.js +1 -0
- package/dist/public/assets/057-avatar-Df7NRaJW.js +1 -0
- package/dist/public/assets/058-avatar-C8zso2zk.js +1 -0
- package/dist/public/assets/059-avatar-zEhHpOcr.js +1 -0
- package/dist/public/assets/060-avatar-DkNabW8M.js +1 -0
- package/dist/public/assets/index-CWvY7i3l.css +1 -0
- package/dist/public/assets/index-Zxr-JuKD.js +820 -0
- package/dist/public/index.html +14 -0
- package/dist/public/logo.svg +42 -0
- package/dist/server/src/dao/FridayAppMessage.js +103 -0
- package/dist/server/src/dao/InputRequest.js +99 -0
- package/dist/server/src/dao/Message.js +42 -0
- package/dist/server/src/dao/Reply.js +96 -0
- package/dist/server/src/dao/Run.js +395 -0
- package/dist/server/src/dao/Trace.js +643 -0
- package/dist/server/src/database.js +54 -0
- package/dist/server/src/index.js +211 -0
- package/dist/server/src/migrations/1730000000000-AddMessageReplyForeignKey.js +216 -0
- package/dist/server/src/migrations/1740000000000-MigrateSpanTable.js +638 -0
- package/dist/server/src/migrations/index.js +19 -0
- package/dist/server/src/models/FridayApp.js +69 -0
- package/dist/server/src/models/FridayAppView.js +94 -0
- package/dist/server/src/models/InputRequest.js +41 -0
- package/dist/server/src/models/Message.js +39 -0
- package/dist/server/src/models/ModelInvocationView.js +127 -0
- package/dist/server/src/models/Reply.js +50 -0
- package/dist/server/src/models/Run.js +63 -0
- package/dist/server/src/models/RunView.js +111 -0
- package/dist/server/src/models/Trace.js +154 -0
- package/dist/server/src/otel/grpc-server.js +154 -0
- package/dist/server/src/otel/opentelemetry/proto/collector/trace/v1/trace_service.js +309 -0
- package/dist/server/src/otel/opentelemetry/proto/common/v1/common.js +747 -0
- package/dist/server/src/otel/opentelemetry/proto/resource/v1/resource.js +170 -0
- package/dist/server/src/otel/opentelemetry/proto/trace/v1/trace.js +1134 -0
- package/dist/server/src/otel/processor.js +395 -0
- package/dist/server/src/otel/router.js +128 -0
- package/dist/server/src/services/ReplyingStateManager.js +21 -0
- package/dist/server/src/trpc/router.js +385 -0
- package/dist/server/src/trpc/socket.js +589 -0
- package/dist/server/src/utils/index.js +17 -0
- package/dist/server/src/utils/processUtils.js +27 -0
- package/dist/shared/src/config/client.js +6 -0
- package/dist/shared/src/config/common.js +32 -0
- package/dist/shared/src/config/friday.js +168 -0
- package/dist/shared/src/config/index.js +19 -0
- package/dist/shared/src/config/server.js +104 -0
- package/dist/shared/src/index.js +18 -0
- package/dist/shared/src/types/index.js +20 -0
- package/dist/shared/src/types/messageForm.js +25 -0
- package/dist/shared/src/types/trace.js +20 -0
- package/dist/shared/src/types/trpc.js +98 -0
- package/dist/shared/src/types/usage.js +7 -0
- package/dist/shared/src/utils/banner.js +74 -0
- package/dist/shared/src/utils/objectUtils.js +74 -0
- package/dist/shared/src/utils/terminal.js +30 -0
- package/dist/shared/src/utils/timeUtils.js +86 -0
- package/package.json +89 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2024 Alibaba
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img
|
|
3
|
+
src="https://img.alicdn.com/imgextra/i1/O1CN01nTg6w21NqT5qFKH1u_!!6000000001621-55-tps-550-550.svg"
|
|
4
|
+
alt="AgentScope Logo"
|
|
5
|
+
width="200"
|
|
6
|
+
/>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
<h2 align="center">AgentScope Studio: Development-Oriented Visualization Toolkit</h2>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://arxiv.org/abs/2402.14034">
|
|
13
|
+
<img
|
|
14
|
+
src="https://img.shields.io/badge/cs.MA-2402.14034-B31C1C?logo=arxiv&logoColor=B31C1C"
|
|
15
|
+
alt="arxiv"
|
|
16
|
+
/>
|
|
17
|
+
</a>
|
|
18
|
+
<a href="https://www.npmjs.com/package/@agentscope/studio">
|
|
19
|
+
<img
|
|
20
|
+
src="https://img.shields.io/badge/dynamic/json?url=https://registry.npmjs.org/%40agentscope%2Fstudio&query=$.%27dist-tags%27.latest&prefix=v&logo=npm&label=version"
|
|
21
|
+
alt="npm"
|
|
22
|
+
/>
|
|
23
|
+
</a>
|
|
24
|
+
<a href="./LICENSE">
|
|
25
|
+
<img
|
|
26
|
+
src="https://img.shields.io/badge/license-Apache--2.0-black"
|
|
27
|
+
alt="license"
|
|
28
|
+
/>
|
|
29
|
+
</a>
|
|
30
|
+
<a href="https://agentscope.io/">
|
|
31
|
+
<img
|
|
32
|
+
src="https://img.shields.io/badge/Tracing-OpenTelemetry-blue?logo=look&logoColor=green&color=dark-green"
|
|
33
|
+
alt="tracing"
|
|
34
|
+
/>
|
|
35
|
+
</a>
|
|
36
|
+
<a href="https://agentscope.io/">
|
|
37
|
+
<img
|
|
38
|
+
src="https://img.shields.io/badge/Evaluation-Agent-blue?logo=look&color=red"
|
|
39
|
+
alt="evaluation"
|
|
40
|
+
/>
|
|
41
|
+
</a>
|
|
42
|
+
<a href="https://agentscope.io/">
|
|
43
|
+
<img
|
|
44
|
+
src="https://img.shields.io/badge/Built--in_Copilot-Friday-blue?logo=look&color=cyan"
|
|
45
|
+
alt="friday"
|
|
46
|
+
/>
|
|
47
|
+
</a>
|
|
48
|
+
</p>
|
|
49
|
+
|
|
50
|
+
AgentScope Studio is a powerful **local visualization toolkit** designed for developers working with [AgentScope](https://github.com/agentscope-ai/agentscope). It provides a **transparent**, **simple**, and **fun** way to develop, debug, and evaluate agent-based applications.
|
|
51
|
+
|
|
52
|
+
## Key Features
|
|
53
|
+
|
|
54
|
+
- **Project Management**: Organize and manage your AgentScope projects with Projects and Runs
|
|
55
|
+
- **Runtime Visualization**: Chatbot-style interface for real-time agent interaction
|
|
56
|
+
- **Tracing**: OpenTelemetry-based trace visualization for LLM calls, token usage, and agent invocations
|
|
57
|
+
- **Agent Evaluation**: Evaluation-oriented analysis from a statistical perspective
|
|
58
|
+
- **Built-in Copilot (Friday)**: A development assistant, playground for rapid secondary development, and integration hub for advanced features
|
|
59
|
+
|
|
60
|
+
<p align="center">
|
|
61
|
+
<img
|
|
62
|
+
src="https://img.alicdn.com/imgextra/i1/O1CN01PG2MdF1Zc44A1QM6N_!!6000000003214-1-tps-1971-1080.gif"
|
|
63
|
+
width="49%"
|
|
64
|
+
alt="home"
|
|
65
|
+
/>
|
|
66
|
+
<img
|
|
67
|
+
src="https://img.alicdn.com/imgextra/i2/O1CN01pGHedL1L4ibmyPeiq_!!6000000001246-1-tps-1971-1080.gif"
|
|
68
|
+
width="49%"
|
|
69
|
+
alt="runtime"
|
|
70
|
+
/>
|
|
71
|
+
<img
|
|
72
|
+
src="https://img.alicdn.com/imgextra/i1/O1CN01HfFhy928SSJAcWQ8c_!!6000000007931-1-tps-1971-1080.gif"
|
|
73
|
+
width="49%"
|
|
74
|
+
alt="traces"
|
|
75
|
+
/>
|
|
76
|
+
<img
|
|
77
|
+
src="https://img.alicdn.com/imgextra/i1/O1CN01vovov821Arms9tEJ1_!!6000000006945-1-tps-1971-1080.gif"
|
|
78
|
+
width="49%"
|
|
79
|
+
alt="friday"
|
|
80
|
+
/>
|
|
81
|
+
</p>
|
|
82
|
+
|
|
83
|
+
## 📢 News
|
|
84
|
+
|
|
85
|
+
- **[2025-08]** AgentScope Studio is now open-sourced! We will continue to improve it and welcome contributions from the community.
|
|
86
|
+
|
|
87
|
+
## 💻 Installation
|
|
88
|
+
|
|
89
|
+
### Prerequisites
|
|
90
|
+
|
|
91
|
+
- **Node.js >= 20.0.0**
|
|
92
|
+
- **npm >= 10.0.0**
|
|
93
|
+
|
|
94
|
+
> **💡 Tip**: If you're using [nvm](https://github.com/nvm-sh/nvm), you can run `nvm use` to automatically switch to the required Node.js version.
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# How to check your version
|
|
98
|
+
node --version # Should show v20.x.x or higher
|
|
99
|
+
npm --version # Should show 10.x.x or higher
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### From NPM (Recommended)
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
npm install -g @agentscope/studio
|
|
106
|
+
|
|
107
|
+
# Start AgentScope Studio
|
|
108
|
+
as_studio
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### From Source
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
git clone https://github.com/agentscope-ai/agentscope-studio
|
|
115
|
+
cd agentscope-studio
|
|
116
|
+
npm install
|
|
117
|
+
|
|
118
|
+
# Start in development mode
|
|
119
|
+
npm run dev
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## 🚀 QuickStart
|
|
123
|
+
|
|
124
|
+
To connect AgentScope applications, you need to set the `studio_url` field in the `AgentScope` initializer as follows:
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
import agentscope
|
|
128
|
+
|
|
129
|
+
agentscope.init(
|
|
130
|
+
# ...
|
|
131
|
+
studio_url="http://localhost:3000"
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
# ...
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## 📚 Documentation
|
|
138
|
+
|
|
139
|
+
For more details, please refer to our documentation:
|
|
140
|
+
|
|
141
|
+
- [Overview](./docs/tutorial/en/tutorial/overview.md) - What is AgentScope Studio and how it works
|
|
142
|
+
- [Quick Start](./docs/tutorial/en/tutorial/quick_start.md) - Installation and configuration guide
|
|
143
|
+
- [Project Management](./docs/tutorial/en/develop/project.md) - Managing projects and runs
|
|
144
|
+
- [Tracing](./docs/tutorial/en/develop/tracing.md) - OpenTelemetry integration and semantic conventions
|
|
145
|
+
- [Friday](./docs/tutorial/en/agent/friday.md) - Built-in Copilot guide
|
|
146
|
+
- [Contributing](./docs/tutorial/en/tutorial/contributing.md) - How to contribute
|
|
147
|
+
|
|
148
|
+
## ⚖️ License
|
|
149
|
+
|
|
150
|
+
AgentScope Studio is released under [Apache License 2.0](./LICENSE).
|
|
151
|
+
|
|
152
|
+
## ✨ Contributors
|
|
153
|
+
|
|
154
|
+
All thanks to our contributors:
|
|
155
|
+
|
|
156
|
+
<a href="https://github.com/agentscope-ai/agentscope-studio/graphs/contributors">
|
|
157
|
+
<img src="https://contrib.rocks/image?repo=agentscope-ai/agentscope-studio&max=999&columns=12&anon=1" />
|
|
158
|
+
</a>
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
import json
|
|
3
|
+
from argparse import ArgumentParser, Namespace
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def json_type(value: str) -> dict:
|
|
7
|
+
"""Parse a JSON string into a dictionary."""
|
|
8
|
+
if not value or value == "":
|
|
9
|
+
return {}
|
|
10
|
+
try:
|
|
11
|
+
result = json.loads(value)
|
|
12
|
+
if not isinstance(result, dict):
|
|
13
|
+
raise ValueError("JSON must be an object/dictionary")
|
|
14
|
+
return result
|
|
15
|
+
except json.JSONDecodeError as e:
|
|
16
|
+
raise ValueError(f"Invalid JSON string: {e}")
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def get_args() -> Namespace:
|
|
20
|
+
"""Get the command line arguments for the script."""
|
|
21
|
+
parser = ArgumentParser(description="Arguments for friday")
|
|
22
|
+
parser.add_argument(
|
|
23
|
+
"--query",
|
|
24
|
+
type=str,
|
|
25
|
+
required=True,
|
|
26
|
+
)
|
|
27
|
+
parser.add_argument(
|
|
28
|
+
"--studio_url",
|
|
29
|
+
type=str,
|
|
30
|
+
required=True,
|
|
31
|
+
)
|
|
32
|
+
parser.add_argument(
|
|
33
|
+
"--llmProvider",
|
|
34
|
+
choices=["dashscope", "openai", "anthropic", "gemini", "ollama"],
|
|
35
|
+
required=True,
|
|
36
|
+
)
|
|
37
|
+
parser.add_argument(
|
|
38
|
+
"--modelName",
|
|
39
|
+
type=str,
|
|
40
|
+
required=True,
|
|
41
|
+
)
|
|
42
|
+
parser.add_argument(
|
|
43
|
+
"--apiKey",
|
|
44
|
+
type=str,
|
|
45
|
+
required=True,
|
|
46
|
+
)
|
|
47
|
+
parser.add_argument(
|
|
48
|
+
"--writePermission",
|
|
49
|
+
type=bool,
|
|
50
|
+
required=True,
|
|
51
|
+
)
|
|
52
|
+
parser.add_argument(
|
|
53
|
+
"--clientKwargs",
|
|
54
|
+
type=json_type,
|
|
55
|
+
default={},
|
|
56
|
+
help="A JSON string representing a dictionary of keyword arguments to pass to the LLM client.",
|
|
57
|
+
)
|
|
58
|
+
parser.add_argument(
|
|
59
|
+
"--generateKwargs",
|
|
60
|
+
type=json_type,
|
|
61
|
+
default={},
|
|
62
|
+
help="A JSON string representing a dictionary of keyword arguments to pass to the LLM generate method.",
|
|
63
|
+
)
|
|
64
|
+
args = parser.parse_args()
|
|
65
|
+
return args
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""The hooks for the agent"""
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
import requests
|
|
6
|
+
from agentscope.agent import AgentBase
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def studio_pre_print_hook(self: AgentBase, kwargs: dict[str, Any]) -> None:
|
|
10
|
+
"""Forward the message to the studio application interface."""
|
|
11
|
+
msg = kwargs["msg"]
|
|
12
|
+
message_data = msg.to_dict()
|
|
13
|
+
|
|
14
|
+
message_data["content"] = msg.get_content_blocks()
|
|
15
|
+
|
|
16
|
+
n_retry = 0
|
|
17
|
+
while True:
|
|
18
|
+
try:
|
|
19
|
+
res = requests.post(
|
|
20
|
+
f"{studio_pre_print_hook.url}/trpc/pushMessageToFridayApp",
|
|
21
|
+
json={
|
|
22
|
+
"replyId": self._reply_id,
|
|
23
|
+
"msg": message_data,
|
|
24
|
+
},
|
|
25
|
+
)
|
|
26
|
+
res.raise_for_status()
|
|
27
|
+
break
|
|
28
|
+
except Exception as e:
|
|
29
|
+
if n_retry < 3:
|
|
30
|
+
n_retry += 1
|
|
31
|
+
continue
|
|
32
|
+
|
|
33
|
+
raise e from None
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def studio_post_reply_hook(self: AgentBase, *args, **kwargs) -> None:
|
|
37
|
+
"""Send the finished signal to the studio application interface."""
|
|
38
|
+
n_retry = 0
|
|
39
|
+
while True:
|
|
40
|
+
try:
|
|
41
|
+
res = requests.post(
|
|
42
|
+
f"{studio_pre_print_hook.url}/trpc/pushFinishedSignalToFridayApp",
|
|
43
|
+
json={"replyId": self._reply_id}
|
|
44
|
+
)
|
|
45
|
+
res.raise_for_status()
|
|
46
|
+
break
|
|
47
|
+
except Exception as e:
|
|
48
|
+
if n_retry < 3:
|
|
49
|
+
n_retry += 1
|
|
50
|
+
continue
|
|
51
|
+
|
|
52
|
+
raise e from None
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""The main entry point for AgentScope studio application, Friday. It's
|
|
3
|
+
an agent assistant that helps users to deal with their daily tasks locally.
|
|
4
|
+
"""
|
|
5
|
+
import asyncio
|
|
6
|
+
import os
|
|
7
|
+
from datetime import datetime
|
|
8
|
+
|
|
9
|
+
import json5
|
|
10
|
+
from agentscope.agent import ReActAgent
|
|
11
|
+
from agentscope.memory import InMemoryMemory
|
|
12
|
+
from agentscope.message import Msg
|
|
13
|
+
from agentscope.session import JSONSession
|
|
14
|
+
from agentscope.tool import (
|
|
15
|
+
Toolkit,
|
|
16
|
+
execute_python_code,
|
|
17
|
+
execute_shell_command,
|
|
18
|
+
write_text_file,
|
|
19
|
+
insert_text_file,
|
|
20
|
+
view_text_file,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
from hook import (
|
|
24
|
+
studio_pre_print_hook,
|
|
25
|
+
studio_post_reply_hook,
|
|
26
|
+
)
|
|
27
|
+
from args import get_args
|
|
28
|
+
from model import get_model, get_formatter
|
|
29
|
+
from tool.utils import (
|
|
30
|
+
view_agentscope_library,
|
|
31
|
+
view_agentscope_readme,
|
|
32
|
+
view_agentscope_faq,
|
|
33
|
+
)
|
|
34
|
+
from utils.common import get_local_file_path
|
|
35
|
+
from utils.connect import StudioConnect
|
|
36
|
+
from utils.constants import FRIDAY_SESSION_ID
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
async def main():
|
|
40
|
+
args = get_args()
|
|
41
|
+
|
|
42
|
+
studio_pre_print_hook.url = args.studio_url
|
|
43
|
+
|
|
44
|
+
# Forward message to the studio
|
|
45
|
+
ReActAgent.register_class_hook(
|
|
46
|
+
"pre_print",
|
|
47
|
+
"studio_pre_print_hook",
|
|
48
|
+
studio_pre_print_hook
|
|
49
|
+
)
|
|
50
|
+
# Send finished signal after one reply finished
|
|
51
|
+
ReActAgent.register_class_hook(
|
|
52
|
+
"post_reply",
|
|
53
|
+
"studio_post_reply_hook",
|
|
54
|
+
studio_post_reply_hook
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
# Init agent
|
|
58
|
+
toolkit = Toolkit()
|
|
59
|
+
|
|
60
|
+
# Basic tools
|
|
61
|
+
toolkit.register_tool_function(execute_python_code)
|
|
62
|
+
toolkit.register_tool_function(execute_shell_command)
|
|
63
|
+
toolkit.register_tool_function(view_text_file)
|
|
64
|
+
toolkit.register_tool_function(insert_text_file)
|
|
65
|
+
if args.writePermission:
|
|
66
|
+
toolkit.register_tool_function(write_text_file)
|
|
67
|
+
|
|
68
|
+
# AgentScope tool group
|
|
69
|
+
toolkit.create_tool_group(
|
|
70
|
+
group_name="agentscope_tools",
|
|
71
|
+
description="The AgentScope library related tools that will provide a brief summary and notes about AgentScope in your system prompt, as well as a series of tools to retrieve AgentScope related information.",
|
|
72
|
+
notes="""# AgentScope Expertise
|
|
73
|
+
## Answer Generation Guidelines
|
|
74
|
+
The solution/code to the user query may already exist in the AgentScope resources, your duty is to show it to the user rather than coding from scratch. Search the following resources in this order:
|
|
75
|
+
1. FAQ using `view_agentscope_faq` tool
|
|
76
|
+
2. README using `view_agentscope_readme` tool
|
|
77
|
+
3. Examples using `execute_shell_command` with command `ls -l` in examples directory (AgentScope has many pre-built examples and they are very helpful)
|
|
78
|
+
4. Python library using `view_agentscope_library` tool in top-down manner (top-module → submodule → specific class/function)
|
|
79
|
+
5. Source code using `view_text_file` tool"""
|
|
80
|
+
)
|
|
81
|
+
toolkit.register_tool_function(
|
|
82
|
+
view_agentscope_library, group_name="agentscope_tools"
|
|
83
|
+
)
|
|
84
|
+
toolkit.register_tool_function(
|
|
85
|
+
view_agentscope_readme, group_name="agentscope_tools"
|
|
86
|
+
)
|
|
87
|
+
toolkit.register_tool_function(
|
|
88
|
+
view_agentscope_faq, group_name="agentscope_tools"
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
# get model from args
|
|
92
|
+
model = get_model(args.llmProvider, args.modelName, args.apiKey, args.clientKwargs, args.generateKwargs)
|
|
93
|
+
formatter = get_formatter(args.llmProvider)
|
|
94
|
+
|
|
95
|
+
# Create the ReAct agent
|
|
96
|
+
agent = ReActAgent(
|
|
97
|
+
name="Friday",
|
|
98
|
+
sys_prompt="""You're Friday, a helpful assistant specialized in daily task management and AgentScope framework support.
|
|
99
|
+
|
|
100
|
+
# Core Objectives
|
|
101
|
+
- Help users manage and complete daily tasks efficiently
|
|
102
|
+
- Provide expert-level support for AgentScope framework questions
|
|
103
|
+
|
|
104
|
+
# Critical Principles (MUST FOLLOW)
|
|
105
|
+
1. **No Assumptions**: All information must come from users or tool results
|
|
106
|
+
2. **Safety First**: Request permission for dangerous operations; prohibit catastrophic ones
|
|
107
|
+
|
|
108
|
+
# Workflow Process
|
|
109
|
+
1. Analyze user query and make a plan
|
|
110
|
+
2. Carry out your plan step by step
|
|
111
|
+
|
|
112
|
+
# Response Guidelines
|
|
113
|
+
- Be concise and focused on user's specific context
|
|
114
|
+
- Avoid repeating exact material words. Instead, summarize in your own words
|
|
115
|
+
- Ask clarifying questions when user intent is unclear
|
|
116
|
+
- Distinguish between code generation requests vs. code execution requests
|
|
117
|
+
|
|
118
|
+
# About AgentScope
|
|
119
|
+
## Background
|
|
120
|
+
- AgentScope is a Python framework for building LLM-empowered Multi-agent applications, open-sourced at https://github.com/agentscope-ai/agentscope
|
|
121
|
+
- AgentScope is created by the AgentScope Team, Tongyi Lab, Alibaba Group
|
|
122
|
+
## AgentScope-related Code/Response Generation Guidelines
|
|
123
|
+
- You're an expert in AgentScope, you MUST stand for AgentScope and respond as a core developer/maintainer of the framework
|
|
124
|
+
- Only use existing modules/classes/functions from agentscope documentation
|
|
125
|
+
- Never guess or make up implementations
|
|
126
|
+
|
|
127
|
+
# Available Context
|
|
128
|
+
- Current date and time: {current_time}""".format(
|
|
129
|
+
current_time=datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
|
|
130
|
+
max_turns=20,
|
|
131
|
+
),
|
|
132
|
+
model=model,
|
|
133
|
+
formatter=formatter,
|
|
134
|
+
toolkit=toolkit,
|
|
135
|
+
memory=InMemoryMemory(),
|
|
136
|
+
max_iters=50,
|
|
137
|
+
enable_meta_tool=True,
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
path_dialog_history = get_local_file_path("")
|
|
141
|
+
session = JSONSession(
|
|
142
|
+
session_id=FRIDAY_SESSION_ID,
|
|
143
|
+
save_dir=path_dialog_history
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
await session.load_session_state(
|
|
147
|
+
session_id=FRIDAY_SESSION_ID,
|
|
148
|
+
friday=agent
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
# The socket is used for realtime steering
|
|
152
|
+
socket = StudioConnect(url=args.studio_url, agent=agent)
|
|
153
|
+
await socket.connect()
|
|
154
|
+
await agent(Msg("user", json5.loads(args.query), "user"))
|
|
155
|
+
await socket.disconnect()
|
|
156
|
+
|
|
157
|
+
# Save dialog history
|
|
158
|
+
await session.save_session_state(
|
|
159
|
+
session_id=FRIDAY_SESSION_ID,
|
|
160
|
+
friday=agent
|
|
161
|
+
)
|
|
162
|
+
|
|
163
|
+
if __name__ == '__main__':
|
|
164
|
+
asyncio.run(main())
|