@axiom-lattice/examples-deep_research 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/.env ADDED
@@ -0,0 +1,40 @@
1
+ # Server Configuration
2
+ PORT=4001
3
+ NODE_ENV=development
4
+
5
+ # Supabase Configuration
6
+
7
+ SUPABASE_URL = "https://ldejdqkwvlllycysuvsr.supabase.co"
8
+ SUPABASE_KEY =
9
+ "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImxkZWpkcWt3dmxsbHljeXN1dnNyIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTczNDQxNTQxMCwiZXhwIjoyMDQ5OTkxNDEwfQ.wXCjWe8wuQbb4H1ZlGORDjMlNwmsnhd_aHIGlNEQqm4"
10
+ # LangGraph Configuration
11
+ # LANGGRAPH_API_KEY=your_langgraph_api_key
12
+
13
+ # Webhook Configuration (Optional)
14
+ WEBHOOK_URL=your_webhook_url
15
+
16
+ DASHSCOPE_API_KEY = sk-fc1771ebd6d146b58b7a23cc6c85a257
17
+
18
+
19
+
20
+ DEEPSEEK_API_KEY=sk-83fd32abdac74106a5c35cd208b4b11c
21
+
22
+ DEEPSEEK_API_KEY2=sk-fd6982eb19b34c0a85555f5a95e9b675
23
+
24
+ SILICONCLOUD_API_KEY=sk-omhkuwebiotihbmgthgrcrzzneundgkeqmfrxnkzeldohpfi
25
+
26
+ VOLCENGINE_API_KEY=3c11b06b-3d48-4cce-a1c7-d9e0f5fab80c
27
+ VOLCENGINE_API_KEY2=a0533576-d6ed-4ca4-a308-473cbf7ebd10
28
+
29
+
30
+ TAVILY_API_KEY=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
31
+
32
+ DATABASE_URL=postgresql://postgres.ldejdqkwvlllycysuvsr:jfd4whz@GPF2nqx7zhm@aws-0-ap-southeast-1.pooler.supabase.com:6543/postgres
33
+ QUEUE_NAME=simon_tasks
34
+ REDIS_URL=redis://localhost:6379
35
+ REDIS_PASSWORD=fina
36
+
37
+ LANGSMITH_TRACING=true
38
+ LANGSMITH_ENDPOINT="https://api.smith.langchain.com"
39
+ LANGSMITH_API_KEY="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"
40
+ LANGSMITH_PROJECT="fina"
package/.eslintrc.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "root": true,
3
+ "env": {
4
+ "node": true,
5
+ "es2021": true
6
+ },
7
+ "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
8
+ "parser": "@typescript-eslint/parser",
9
+ "parserOptions": {
10
+ "ecmaVersion": 12,
11
+ "sourceType": "module"
12
+ },
13
+ "plugins": ["@typescript-eslint"],
14
+ "rules": {
15
+ "indent": "off", // 禁用缩进规则
16
+ "linebreak-style": ["warn", "unix"],
17
+ "semi": ["warn", "always"],
18
+ "no-unused-vars": "off",
19
+ "@typescript-eslint/no-unused-vars": ["warn"],
20
+ "@typescript-eslint/no-explicit-any": "off" // 禁用对 any 类型的检查
21
+ }
22
+ }
@@ -0,0 +1,16 @@
1
+
2
+ > @axiom-lattice/examples-deep_research@1.0.10 build /home/runner/work/agentic/agentic/examples/deep_research
3
+ > tsup src/index.ts --format cjs --dts --clean --sourcemap
4
+
5
+ CLI Building entry: src/index.ts
6
+ CLI Using tsconfig: tsconfig.json
7
+ CLI tsup v8.5.0
8
+ CLI Target: es2020
9
+ CLI Cleaning output folder
10
+ CJS Build start
11
+ CJS dist/index.js 10.27 KB
12
+ CJS dist/index.js.map 11.03 KB
13
+ CJS ⚡️ Build success in 60ms
14
+ DTS Build start
15
+ DTS ⚡️ Build success in 4860ms
16
+ DTS dist/index.d.ts 13.00 B
package/Dockerfile ADDED
@@ -0,0 +1,49 @@
1
+ FROM node:20-alpine AS builder
2
+
3
+ WORKDIR /app
4
+
5
+ # 复制package.json和pnpm-lock.yaml
6
+ COPY package.json pnpm-lock.yaml ./
7
+
8
+ # 安装pnpm
9
+ RUN npm install -g pnpm
10
+
11
+ # 安装依赖
12
+ RUN pnpm install
13
+
14
+ # 复制源代码
15
+ COPY . .
16
+
17
+ # 构建应用
18
+ RUN pnpm run build
19
+
20
+ # 生产环境镜像
21
+ FROM node:20-alpine
22
+
23
+ WORKDIR /app
24
+
25
+ # 复制package.json和pnpm-lock.yaml
26
+ COPY package.json pnpm-lock.yaml ./
27
+
28
+ # 安装pnpm
29
+ RUN npm install -g pnpm
30
+
31
+ # 仅安装生产依赖
32
+ RUN pnpm install --prod
33
+
34
+ # 从构建阶段复制编译后的代码
35
+ COPY --from=builder /app/dist ./dist
36
+ COPY --from=builder /app/tsconfig_prod.json ./dist/tsconfig_prod.json
37
+ # 创建日志目录
38
+ RUN mkdir -p /app/logs
39
+
40
+ # 设置环境变量
41
+ ENV NODE_ENV=production
42
+ ENV PORT=3001
43
+
44
+ # 暴露端口
45
+ EXPOSE 3001
46
+
47
+ # 启动应用
48
+ ENV TS_NODE_PROJECT="./dist/tsconfig_prod.json"
49
+ CMD ["node", "-r", "tsconfig-paths/register", "dist/index.js"]
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,2 @@
1
+
2
+ export { }
package/dist/index.js ADDED
@@ -0,0 +1,211 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+
25
+ // src/index.ts
26
+ var import_dotenv = __toESM(require("dotenv"));
27
+ var import_gateway = require("@axiom-lattice/gateway");
28
+ var import_core2 = require("@axiom-lattice/core");
29
+
30
+ // src/agents/research/index.ts
31
+ var import_core = require("@axiom-lattice/core");
32
+ var subResearchPrompt = `You are a dedicated researcher. Your job is to conduct research based on the users questions.
33
+
34
+ Conduct thorough research and then reply to the user with a detailed answer to their question
35
+
36
+ only your FINAL answer will be passed on to the user. They will have NO knowledge of anything except your final message, so your final report should be your final message!`;
37
+ var subCritiquePrompt = `You are a dedicated editor. You are being tasked to critique a report.
38
+
39
+ You can find the report at \`final_report.md\`.
40
+
41
+ You can find the question/topic for this report at \`question.txt\`.
42
+
43
+ The user may ask for specific areas to critique the report in. Respond to the user with a detailed critique of the report. Things that could be improved.
44
+
45
+ You can use the search tool to search for information, if that will help you critique the report
46
+
47
+ Do not write to the \`final_report.md\` yourself.
48
+
49
+ Things to check:
50
+ - Check that each section is appropriately named
51
+ - Check that the report is written as you would find in an essay or a textbook - it should be text heavy, do not let it just be a list of bullet points!
52
+ - Check that the report is comprehensive. If any paragraphs or sections are short, or missing important details, point it out.
53
+ - Check that the article covers key areas of the industry, ensures overall understanding, and does not omit important parts.
54
+ - Check that the article deeply analyzes causes, impacts, and trends, providing valuable insights
55
+ - Check that the article closely follows the research topic and directly answers questions
56
+ - Check that the article has a clear structure, fluent language, and is easy to understand.
57
+ `;
58
+ var researchInstructions = `You are an expert researcher. Your job is to conduct thorough research, and then write a polished report.
59
+
60
+ The first thing you should do is to write the original user question to \`question.txt\` so you have a record of it.
61
+
62
+ Use the research-agent to conduct deep research. It will respond to your questions/topics with a detailed answer.
63
+
64
+ When you think you enough information to write a final report, write it to \`final_report.md\`
65
+
66
+ You can call the critique-agent to get a critique of the final report. After that (if needed) you can do more research and edit the \`final_report.md\`
67
+ You can do this however many times you want until are you satisfied with the result.
68
+
69
+ Only edit the file once at a time (if you call this tool in parallel, there may be conflicts).
70
+
71
+ Here are instructions for writing the final report:
72
+
73
+ <report_instructions>
74
+
75
+ CRITICAL: Make sure the answer is written in the same language as the human messages! If you make a todo plan - you should note in the plan what language the report should be in so you dont forget!
76
+ Note: the language the report should be in is the language the QUESTION is in, not the language/country that the question is ABOUT.
77
+
78
+ Please create a detailed answer to the overall research brief that:
79
+ 1. Is well-organized with proper headings (# for title, ## for sections, ### for subsections)
80
+ 2. Includes specific facts and insights from the research
81
+ 3. References relevant sources using [Title](URL) format
82
+ 4. Provides a balanced, thorough analysis. Be as comprehensive as possible, and include all information that is relevant to the overall research question. People are using you for deep research and will expect detailed, comprehensive answers.
83
+ 5. Includes a "Sources" section at the end with all referenced links
84
+
85
+ You can structure your report in a number of different ways. Here are some examples:
86
+
87
+ To answer a question that asks you to compare two things, you might structure your report like this:
88
+ 1/ intro
89
+ 2/ overview of topic A
90
+ 3/ overview of topic B
91
+ 4/ comparison between A and B
92
+ 5/ conclusion
93
+
94
+ To answer a question that asks you to return a list of things, you might only need a single section which is the entire list.
95
+ 1/ list of things or table of things
96
+ Or, you could choose to make each item in the list a separate section in the report. When asked for lists, you don't need an introduction or conclusion.
97
+ 1/ item 1
98
+ 2/ item 2
99
+ 3/ item 3
100
+
101
+ To answer a question that asks you to summarize a topic, give a report, or give an overview, you might structure your report like this:
102
+ 1/ overview of topic
103
+ 2/ concept 1
104
+ 3/ concept 2
105
+ 4/ concept 3
106
+ 5/ conclusion
107
+
108
+ If you think you can answer the question with a single section, you can do that too!
109
+ 1/ answer
110
+
111
+ REMEMBER: Section is a VERY fluid and loose concept. You can structure your report however you think is best, including in ways that are not listed above!
112
+ Make sure that your sections are cohesive, and make sense for the reader.
113
+
114
+ For each section of the report, do the following:
115
+ - Use simple, clear language
116
+ - Use ## for section title (Markdown format) for each section of the report
117
+ - Do NOT ever refer to yourself as the writer of the report. This should be a professional report without any self-referential language.
118
+ - Do not say what you are doing in the report. Just write the report without any commentary from yourself.
119
+ - Each section should be as long as necessary to deeply answer the question with the information you have gathered. It is expected that sections will be fairly long and verbose. You are writing a deep research report, and users will expect a thorough answer.
120
+ - Use bullet points to list out information when appropriate, but by default, write in paragraph form.
121
+
122
+ REMEMBER:
123
+ The brief and research may be in English, but you need to translate this information to the right language when writing the final answer.
124
+ Make sure the final answer report is in the SAME language as the human messages in the message history.
125
+
126
+ Format the report in clear markdown with proper structure and include source references where appropriate.
127
+
128
+ <Citation Rules>
129
+ - Assign each unique URL a single citation number in your text
130
+ - End with ### Sources that lists each source with corresponding numbers
131
+ - IMPORTANT: Number sources sequentially without gaps (1,2,3,4...) in the final list regardless of which sources you choose
132
+ - Each source should be a separate line item in a list, so that in markdown it is rendered as a list.
133
+ - Example format:
134
+ [1] Source Title: URL
135
+ [2] Source Title: URL
136
+ - Citations are extremely important. Make sure to include these, and pay a lot of attention to getting these right. Users will often use these citations to look into more information.
137
+ </Citation Rules>
138
+ </report_instructions>
139
+
140
+ You have access to a few tools.
141
+
142
+ ## \`internet_search\`
143
+
144
+ Use this to run an internet search for a given query. You can specify the number of results, the topic, and whether raw content should be included.
145
+ `;
146
+ var research_agents = [
147
+ {
148
+ key: "research-agent",
149
+ name: "research-agent",
150
+ type: import_core.AgentType.REACT,
151
+ description: "Used to research more in depth questions. Only give this researcher one topic at a time. Do not pass multiple sub questions to this researcher. Instead, you should break down a large topic into the necessary components, and then call multiple research agents in parallel, one for each sub question.",
152
+ prompt: subResearchPrompt,
153
+ tools: ["internet_search"]
154
+ },
155
+ {
156
+ key: "critique-agent",
157
+ name: "critique-agent",
158
+ type: import_core.AgentType.REACT,
159
+ description: "Used to critique the final report. Give this agent some infomration about how you want it to critique the report.",
160
+ prompt: subCritiquePrompt
161
+ },
162
+ {
163
+ key: "main",
164
+ name: "deep_research_agent",
165
+ description: "Used to research more in depth questions. Only give this researcher one topic at a time. Do not pass multiple sub questions to this researcher. Instead, you should break down a large topic into the necessary components, and then call multiple research agents in parallel, one for each sub question.",
166
+ type: import_core.AgentType.DEEP_AGENT,
167
+ tools: ["internet_search"],
168
+ prompt: researchInstructions,
169
+ subAgents: ["critique-agent", "research-agent"]
170
+ }
171
+ ];
172
+ (0, import_core.registerAgentLattices)(research_agents);
173
+
174
+ // src/index.ts
175
+ var import_path = __toESM(require("path"));
176
+ import_dotenv.default.config({ path: import_path.default.resolve(__dirname, "../.env") });
177
+ (0, import_core2.registerModelLattice)(
178
+ "default",
179
+ // {
180
+ // model: "deepseek-chat",
181
+ // provider: "deepseek",
182
+ // streaming: false,
183
+ // }
184
+ // {
185
+ // model: "deepseek-chat",
186
+ // provider: "deepseek",
187
+ // streaming: false,
188
+ // apiKeyEnvName: "DEEPSEEK_API_KEY2",
189
+ // },
190
+ // {
191
+ // model: "deepseek-v3-250324",
192
+ // provider: "volcengine",
193
+ // streaming: false,
194
+ // },
195
+ {
196
+ model: "kimi-k2-250711",
197
+ provider: "volcengine",
198
+ streaming: true,
199
+ apiKeyEnvName: "VOLCENGINE_API_KEY2"
200
+ }
201
+ // {
202
+ // model: "qwen-plus",
203
+ // provider: "openai",
204
+ // streaming: false,
205
+ // apiKeyEnvName: "DASHSCOPE_API_KEY",
206
+ // baseURL: "https://dashscope.aliyuncs.com/compatible-mode/v1",
207
+ // }
208
+ );
209
+ import_gateway.LatticeGateway.registerLatticeRoutes(import_gateway.LatticeGateway.app);
210
+ import_gateway.LatticeGateway.startAsHttpEndpoint({ port: 4001 });
211
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/agents/research/index.ts"],"sourcesContent":["import dotenv from \"dotenv\";\n\nimport { LatticeGateway } from \"@axiom-lattice/gateway\";\nimport {\n registerCheckpointSaver,\n registerModelLattice,\n} from \"@axiom-lattice/core\";\nimport \"./agents\";\nimport path from \"path\";\n\n// 加载环境变量\ndotenv.config({ path: path.resolve(__dirname, \"../.env\") });\n\n// 注册默认模型Lattice\nregisterModelLattice(\n \"default\",\n // {\n // model: \"deepseek-chat\",\n // provider: \"deepseek\",\n // streaming: false,\n // }\n // {\n // model: \"deepseek-chat\",\n // provider: \"deepseek\",\n // streaming: false,\n // apiKeyEnvName: \"DEEPSEEK_API_KEY2\",\n // },\n // {\n // model: \"deepseek-v3-250324\",\n // provider: \"volcengine\",\n // streaming: false,\n // },\n {\n model: \"kimi-k2-250711\",\n provider: \"volcengine\",\n streaming: true,\n apiKeyEnvName: \"VOLCENGINE_API_KEY2\",\n }\n // {\n // model: \"qwen-plus\",\n // provider: \"openai\",\n // streaming: false,\n // apiKeyEnvName: \"DASHSCOPE_API_KEY\",\n // baseURL: \"https://dashscope.aliyuncs.com/compatible-mode/v1\",\n // }\n);\n\nLatticeGateway.registerLatticeRoutes(LatticeGateway.app);\n\nLatticeGateway.startAsHttpEndpoint({ port: 4001 });\n","/* eslint-disable no-console */\n\nimport {\n registerAgentLattices,\n AgentType,\n AgentConfig,\n} from \"@axiom-lattice/core\";\n\nconst subResearchPrompt = `You are a dedicated researcher. Your job is to conduct research based on the users questions.\n\nConduct thorough research and then reply to the user with a detailed answer to their question\n\nonly your FINAL answer will be passed on to the user. They will have NO knowledge of anything except your final message, so your final report should be your final message!`;\n\nconst subCritiquePrompt = `You are a dedicated editor. You are being tasked to critique a report.\n\nYou can find the report at \\`final_report.md\\`.\n\nYou can find the question/topic for this report at \\`question.txt\\`.\n\nThe user may ask for specific areas to critique the report in. Respond to the user with a detailed critique of the report. Things that could be improved.\n\nYou can use the search tool to search for information, if that will help you critique the report\n\nDo not write to the \\`final_report.md\\` yourself.\n\nThings to check:\n- Check that each section is appropriately named\n- Check that the report is written as you would find in an essay or a textbook - it should be text heavy, do not let it just be a list of bullet points!\n- Check that the report is comprehensive. If any paragraphs or sections are short, or missing important details, point it out.\n- Check that the article covers key areas of the industry, ensures overall understanding, and does not omit important parts.\n- Check that the article deeply analyzes causes, impacts, and trends, providing valuable insights\n- Check that the article closely follows the research topic and directly answers questions\n- Check that the article has a clear structure, fluent language, and is easy to understand.\n`;\n\n// Prompt prefix to steer the agent to be an expert researcher\nconst researchInstructions = `You are an expert researcher. Your job is to conduct thorough research, and then write a polished report.\n\nThe first thing you should do is to write the original user question to \\`question.txt\\` so you have a record of it.\n\nUse the research-agent to conduct deep research. It will respond to your questions/topics with a detailed answer.\n\nWhen you think you enough information to write a final report, write it to \\`final_report.md\\`\n\nYou can call the critique-agent to get a critique of the final report. After that (if needed) you can do more research and edit the \\`final_report.md\\`\nYou can do this however many times you want until are you satisfied with the result.\n\nOnly edit the file once at a time (if you call this tool in parallel, there may be conflicts).\n\nHere are instructions for writing the final report:\n\n<report_instructions>\n\nCRITICAL: Make sure the answer is written in the same language as the human messages! If you make a todo plan - you should note in the plan what language the report should be in so you dont forget!\nNote: the language the report should be in is the language the QUESTION is in, not the language/country that the question is ABOUT.\n\nPlease create a detailed answer to the overall research brief that:\n1. Is well-organized with proper headings (# for title, ## for sections, ### for subsections)\n2. Includes specific facts and insights from the research\n3. References relevant sources using [Title](URL) format\n4. Provides a balanced, thorough analysis. Be as comprehensive as possible, and include all information that is relevant to the overall research question. People are using you for deep research and will expect detailed, comprehensive answers.\n5. Includes a \"Sources\" section at the end with all referenced links\n\nYou can structure your report in a number of different ways. Here are some examples:\n\nTo answer a question that asks you to compare two things, you might structure your report like this:\n1/ intro\n2/ overview of topic A\n3/ overview of topic B\n4/ comparison between A and B\n5/ conclusion\n\nTo answer a question that asks you to return a list of things, you might only need a single section which is the entire list.\n1/ list of things or table of things\nOr, you could choose to make each item in the list a separate section in the report. When asked for lists, you don't need an introduction or conclusion.\n1/ item 1\n2/ item 2\n3/ item 3\n\nTo answer a question that asks you to summarize a topic, give a report, or give an overview, you might structure your report like this:\n1/ overview of topic\n2/ concept 1\n3/ concept 2\n4/ concept 3\n5/ conclusion\n\nIf you think you can answer the question with a single section, you can do that too!\n1/ answer\n\nREMEMBER: Section is a VERY fluid and loose concept. You can structure your report however you think is best, including in ways that are not listed above!\nMake sure that your sections are cohesive, and make sense for the reader.\n\nFor each section of the report, do the following:\n- Use simple, clear language\n- Use ## for section title (Markdown format) for each section of the report\n- Do NOT ever refer to yourself as the writer of the report. This should be a professional report without any self-referential language.\n- Do not say what you are doing in the report. Just write the report without any commentary from yourself.\n- Each section should be as long as necessary to deeply answer the question with the information you have gathered. It is expected that sections will be fairly long and verbose. You are writing a deep research report, and users will expect a thorough answer.\n- Use bullet points to list out information when appropriate, but by default, write in paragraph form.\n\nREMEMBER:\nThe brief and research may be in English, but you need to translate this information to the right language when writing the final answer.\nMake sure the final answer report is in the SAME language as the human messages in the message history.\n\nFormat the report in clear markdown with proper structure and include source references where appropriate.\n\n<Citation Rules>\n- Assign each unique URL a single citation number in your text\n- End with ### Sources that lists each source with corresponding numbers\n- IMPORTANT: Number sources sequentially without gaps (1,2,3,4...) in the final list regardless of which sources you choose\n- Each source should be a separate line item in a list, so that in markdown it is rendered as a list.\n- Example format:\n [1] Source Title: URL\n [2] Source Title: URL\n- Citations are extremely important. Make sure to include these, and pay a lot of attention to getting these right. Users will often use these citations to look into more information.\n</Citation Rules>\n</report_instructions>\n\nYou have access to a few tools.\n\n## \\`internet_search\\`\n\nUse this to run an internet search for a given query. You can specify the number of results, the topic, and whether raw content should be included.\n`;\n\nconst research_agents: AgentConfig[] = [\n {\n key: \"research-agent\",\n name: \"research-agent\",\n type: AgentType.REACT,\n description:\n \"Used to research more in depth questions. Only give this researcher one topic at a time. Do not pass multiple sub questions to this researcher. Instead, you should break down a large topic into the necessary components, and then call multiple research agents in parallel, one for each sub question.\",\n prompt: subResearchPrompt,\n tools: [\"internet_search\"],\n },\n {\n key: \"critique-agent\",\n name: \"critique-agent\",\n type: AgentType.REACT,\n description:\n \"Used to critique the final report. Give this agent some infomration about how you want it to critique the report.\",\n prompt: subCritiquePrompt,\n },\n {\n key: \"main\",\n name: \"deep_research_agent\",\n description:\n \"Used to research more in depth questions. Only give this researcher one topic at a time. Do not pass multiple sub questions to this researcher. Instead, you should break down a large topic into the necessary components, and then call multiple research agents in parallel, one for each sub question.\",\n type: AgentType.DEEP_AGENT,\n tools: [\"internet_search\"],\n prompt: researchInstructions,\n subAgents: [\"critique-agent\", \"research-agent\"],\n },\n];\n\nregisterAgentLattices(research_agents);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oBAAmB;AAEnB,qBAA+B;AAC/B,IAAAA,eAGO;;;ACJP,kBAIO;AAEP,IAAM,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAM1B,IAAM,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAuB1B,IAAM,uBAAuB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAyF7B,IAAM,kBAAiC;AAAA,EACrC;AAAA,IACE,KAAK;AAAA,IACL,MAAM;AAAA,IACN,MAAM,sBAAU;AAAA,IAChB,aACE;AAAA,IACF,QAAQ;AAAA,IACR,OAAO,CAAC,iBAAiB;AAAA,EAC3B;AAAA,EACA;AAAA,IACE,KAAK;AAAA,IACL,MAAM;AAAA,IACN,MAAM,sBAAU;AAAA,IAChB,aACE;AAAA,IACF,QAAQ;AAAA,EACV;AAAA,EACA;AAAA,IACE,KAAK;AAAA,IACL,MAAM;AAAA,IACN,aACE;AAAA,IACF,MAAM,sBAAU;AAAA,IAChB,OAAO,CAAC,iBAAiB;AAAA,IACzB,QAAQ;AAAA,IACR,WAAW,CAAC,kBAAkB,gBAAgB;AAAA,EAChD;AACF;AAAA,IAEA,mCAAsB,eAAe;;;ADpJrC,kBAAiB;AAGjB,cAAAC,QAAO,OAAO,EAAE,MAAM,YAAAC,QAAK,QAAQ,WAAW,SAAS,EAAE,CAAC;AAAA,IAG1D;AAAA,EACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBA;AAAA,IACE,OAAO;AAAA,IACP,UAAU;AAAA,IACV,WAAW;AAAA,IACX,eAAe;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQF;AAEA,8BAAe,sBAAsB,8BAAe,GAAG;AAEvD,8BAAe,oBAAoB,EAAE,MAAM,KAAK,CAAC;","names":["import_core","dotenv","path"]}
package/jest.config.js ADDED
@@ -0,0 +1,26 @@
1
+ module.exports = {
2
+ preset: "ts-jest",
3
+ testEnvironment: "node",
4
+ roots: ["<rootDir>/src"],
5
+ testMatch: ["**/__tests__/**/*.test.ts", "**/?(*.)+(spec|test).ts"],
6
+ transform: {
7
+ "^.+\\.ts$": [
8
+ "ts-jest",
9
+ {
10
+ isolatedModules: true,
11
+ },
12
+ ],
13
+ },
14
+ moduleNameMapper: {
15
+ "^@/(.*)$": "<rootDir>/src/$1",
16
+ "^@services/(.*)$": "<rootDir>/src/services/$1",
17
+ "^@utils/(.*)$": "<rootDir>/src/utils/$1",
18
+ "^@agents/(.*)$": "<rootDir>/src/agents/$1",
19
+ "^@agent_patterns/(.*)$": "<rootDir>/src/agent_patterns/$1",
20
+ "^@types$": "<rootDir>/src/types/index.ts",
21
+ },
22
+ setupFilesAfterEnv: ["<rootDir>/src/__tests__/setup.ts"],
23
+ collectCoverageFrom: ["src/**/*.ts", "!src/**/*.d.ts", "!src/__tests__/**/*"],
24
+ coverageReporters: ["text", "lcov", "html"],
25
+ testTimeout: 30000,
26
+ };
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@axiom-lattice/examples-deep_research",
3
+ "version": "1.0.10",
4
+ "main": "dist/index.js",
5
+ "keywords": [],
6
+ "author": "",
7
+ "license": "ISC",
8
+ "description": "LangGraph Server for agent-based applications",
9
+ "dependencies": {
10
+ "dotenv": "^16.6.1",
11
+ "uuid": "^9.0.1",
12
+ "zod": "^3.24.2",
13
+ "zod-to-json-schema": "^3.24.3",
14
+ "@axiom-lattice/core": "2.0.0",
15
+ "@axiom-lattice/gateway": "2.0.0"
16
+ },
17
+ "devDependencies": {
18
+ "@types/jest": "^29.5.14",
19
+ "@types/lodash": "^4.17.16",
20
+ "@types/node": "^20.17.23",
21
+ "@types/uuid": "^9.0.8",
22
+ "@typescript-eslint/eslint-plugin": "^7.2.0",
23
+ "@typescript-eslint/parser": "^7.2.0",
24
+ "eslint": "^8.57.0",
25
+ "jest": "^29.7.0",
26
+ "nodemon": "^3.1.9",
27
+ "ts-jest": "^29.4.0",
28
+ "ts-node": "^10.9.2",
29
+ "tsup": "^8.5.0",
30
+ "typescript": "^5.8.2"
31
+ },
32
+ "scripts": {
33
+ "build": "tsup src/index.ts --format cjs --dts --clean --sourcemap",
34
+ "start": "node dist/index.js",
35
+ "dev": "tsup src/index.ts --format cjs --dts --watch --onSuccess \"node dist/index.js\"",
36
+ "dev:nodemon": "nodemon --watch 'src/**/*.ts' --watch '../../packages/core/dist/**/*' --exec 'ts-node' -r tsconfig-paths/register src/index.ts",
37
+ "dev:serve": "tsup src/index.ts --format cjs --dts --watch --serve dist/index.js",
38
+ "dev:inspect": "tsup src/index.ts --format cjs --dts --watch --onSuccess \"node --inspect dist/index.js\"",
39
+ "lint": "tsc --noEmit",
40
+ "test": "jest",
41
+ "test:watch": "jest --watch",
42
+ "test:coverage": "jest --coverage"
43
+ }
44
+ }
@@ -0,0 +1,4 @@
1
+ //import "./todo";
2
+ import "./research";
3
+
4
+ // import "./property_viewing";