langwatch 0.3.0-prerelease.1 → 0.3.0-prerelease.2

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.
Files changed (184) hide show
  1. package/dist/chunk-4BZATFKJ.mjs +181 -0
  2. package/dist/chunk-4BZATFKJ.mjs.map +1 -0
  3. package/dist/chunk-CSC3CMIT.mjs +118 -0
  4. package/dist/chunk-CSC3CMIT.mjs.map +1 -0
  5. package/dist/chunk-F63YKTXA.mjs +47 -0
  6. package/dist/chunk-F63YKTXA.mjs.map +1 -0
  7. package/dist/chunk-G3AUABT7.js +4 -0
  8. package/dist/chunk-G3AUABT7.js.map +1 -0
  9. package/dist/chunk-HPC6Z7J4.js +118 -0
  10. package/dist/chunk-HPC6Z7J4.js.map +1 -0
  11. package/dist/chunk-KGDAENGD.js +50 -0
  12. package/dist/chunk-KGDAENGD.js.map +1 -0
  13. package/dist/chunk-LD74LVRU.js +47 -0
  14. package/dist/chunk-LD74LVRU.js.map +1 -0
  15. package/dist/chunk-OM7VY3XT.mjs +4 -0
  16. package/dist/chunk-OM7VY3XT.mjs.map +1 -0
  17. package/dist/chunk-PCQVQ7SB.js +45 -0
  18. package/dist/chunk-PCQVQ7SB.js.map +1 -0
  19. package/dist/chunk-PMBEK6YE.mjs +424 -0
  20. package/dist/chunk-PMBEK6YE.mjs.map +1 -0
  21. package/dist/chunk-PR3JDWC3.mjs +50 -0
  22. package/dist/chunk-PR3JDWC3.mjs.map +1 -0
  23. package/dist/chunk-PTJ6AAI7.js +360 -0
  24. package/dist/chunk-PTJ6AAI7.js.map +1 -0
  25. package/dist/chunk-QEWDG5QE.mjs +45 -0
  26. package/dist/chunk-QEWDG5QE.mjs.map +1 -0
  27. package/dist/chunk-REUCVT7A.mjs +39 -0
  28. package/dist/chunk-REUCVT7A.mjs.map +1 -0
  29. package/dist/chunk-SVJ7SCGB.js +424 -0
  30. package/dist/chunk-SVJ7SCGB.js.map +1 -0
  31. package/dist/chunk-VJSOCNPA.js +181 -0
  32. package/dist/chunk-VJSOCNPA.js.map +1 -0
  33. package/dist/chunk-WM2GRSRW.js +39 -0
  34. package/dist/chunk-WM2GRSRW.js.map +1 -0
  35. package/dist/chunk-Z5J5UI5E.mjs +360 -0
  36. package/dist/chunk-Z5J5UI5E.mjs.map +1 -0
  37. package/dist/client-B2HqIKg6.d.ts +51 -0
  38. package/dist/client-XyCqclCi.d.mts +51 -0
  39. package/dist/client-browser.d.mts +8 -0
  40. package/dist/client-browser.d.ts +8 -0
  41. package/dist/client-browser.js +83 -0
  42. package/dist/client-browser.js.map +1 -0
  43. package/dist/client-browser.mjs +83 -0
  44. package/dist/client-browser.mjs.map +1 -0
  45. package/dist/client-node.d.mts +8 -0
  46. package/dist/client-node.d.ts +8 -0
  47. package/dist/client-node.js +90 -0
  48. package/dist/client-node.js.map +1 -0
  49. package/dist/client-node.mjs +90 -0
  50. package/dist/client-node.mjs.map +1 -0
  51. package/dist/evaluation/index.d.mts +897 -0
  52. package/dist/evaluation/index.d.ts +897 -0
  53. package/dist/evaluation/index.js +13 -0
  54. package/dist/evaluation/index.js.map +1 -0
  55. package/dist/evaluation/index.mjs +13 -0
  56. package/dist/evaluation/index.mjs.map +1 -0
  57. package/dist/filterable-batch-span-processor-zO5kcjBY.d.mts +64 -0
  58. package/dist/filterable-batch-span-processor-zO5kcjBY.d.ts +64 -0
  59. package/dist/index.d.mts +48 -0
  60. package/{src/observability/exporters/langwatch-exporter.ts → dist/index.d.ts} +13 -18
  61. package/dist/index.js +30 -0
  62. package/dist/index.js.map +1 -0
  63. package/dist/index.mjs +30 -0
  64. package/dist/index.mjs.map +1 -0
  65. package/dist/observability/index.d.mts +260 -0
  66. package/dist/observability/index.d.ts +260 -0
  67. package/dist/observability/index.js +20 -0
  68. package/dist/observability/index.js.map +1 -0
  69. package/dist/observability/index.mjs +20 -0
  70. package/dist/observability/index.mjs.map +1 -0
  71. package/dist/observability/instrumentation/langchain/index.d.mts +40 -0
  72. package/dist/observability/instrumentation/langchain/index.d.ts +40 -0
  73. package/dist/observability/instrumentation/langchain/index.js +666 -0
  74. package/dist/observability/instrumentation/langchain/index.js.map +1 -0
  75. package/dist/observability/instrumentation/langchain/index.mjs +666 -0
  76. package/dist/observability/instrumentation/langchain/index.mjs.map +1 -0
  77. package/dist/prompt/index.d.mts +10 -0
  78. package/dist/prompt/index.d.ts +10 -0
  79. package/dist/prompt/index.js +18 -0
  80. package/dist/prompt/index.js.map +1 -0
  81. package/dist/prompt/index.mjs +18 -0
  82. package/dist/prompt/index.mjs.map +1 -0
  83. package/dist/prompt-BXJWdbQp.d.mts +1967 -0
  84. package/dist/prompt-BXJWdbQp.d.ts +1967 -0
  85. package/dist/record-evaluation-CmxMXa-3.d.mts +25 -0
  86. package/dist/record-evaluation-CmxMXa-3.d.ts +25 -0
  87. package/dist/trace-D-bZOuqb.d.mts +622 -0
  88. package/dist/trace-G2312klE.d.ts +622 -0
  89. package/package.json +9 -4
  90. package/.editorconfig +0 -16
  91. package/.eslintrc.cjs +0 -37
  92. package/copy-types.sh +0 -28
  93. package/examples/langchain/.env.example +0 -2
  94. package/examples/langchain/README.md +0 -42
  95. package/examples/langchain/package-lock.json +0 -2930
  96. package/examples/langchain/package.json +0 -27
  97. package/examples/langchain/src/cli-markdown.d.ts +0 -137
  98. package/examples/langchain/src/index.ts +0 -109
  99. package/examples/langchain/tsconfig.json +0 -25
  100. package/examples/langgraph/.env.example +0 -2
  101. package/examples/langgraph/README.md +0 -42
  102. package/examples/langgraph/package-lock.json +0 -3031
  103. package/examples/langgraph/package.json +0 -28
  104. package/examples/langgraph/src/cli-markdown.d.ts +0 -137
  105. package/examples/langgraph/src/index.ts +0 -196
  106. package/examples/langgraph/tsconfig.json +0 -25
  107. package/examples/mastra/.env.example +0 -2
  108. package/examples/mastra/README.md +0 -57
  109. package/examples/mastra/package-lock.json +0 -5296
  110. package/examples/mastra/package.json +0 -32
  111. package/examples/mastra/src/cli-markdown.d.ts +0 -137
  112. package/examples/mastra/src/index.ts +0 -120
  113. package/examples/mastra/src/mastra/agents/weather-agent.ts +0 -30
  114. package/examples/mastra/src/mastra/index.ts +0 -21
  115. package/examples/mastra/src/mastra/tools/weather-tool.ts +0 -102
  116. package/examples/mastra/tsconfig.json +0 -25
  117. package/examples/vercel-ai/.env.example +0 -2
  118. package/examples/vercel-ai/README.md +0 -38
  119. package/examples/vercel-ai/package-lock.json +0 -2571
  120. package/examples/vercel-ai/package.json +0 -27
  121. package/examples/vercel-ai/src/cli-markdown.d.ts +0 -137
  122. package/examples/vercel-ai/src/index.ts +0 -110
  123. package/examples/vercel-ai/src/instrumentation.ts +0 -9
  124. package/examples/vercel-ai/tsconfig.json +0 -25
  125. package/src/__tests__/client-browser.test.ts +0 -92
  126. package/src/__tests__/client-node.test.ts +0 -76
  127. package/src/__tests__/client.test.ts +0 -71
  128. package/src/__tests__/integration/client-browser.test.ts +0 -46
  129. package/src/__tests__/integration/client-node.test.ts +0 -46
  130. package/src/client-browser.ts +0 -70
  131. package/src/client-node.ts +0 -82
  132. package/src/client-shared.ts +0 -72
  133. package/src/client.ts +0 -119
  134. package/src/evaluation/__tests__/record-evaluation.test.ts +0 -112
  135. package/src/evaluation/__tests__/run-evaluation.test.ts +0 -171
  136. package/src/evaluation/index.ts +0 -2
  137. package/src/evaluation/record-evaluation.ts +0 -101
  138. package/src/evaluation/run-evaluation.ts +0 -133
  139. package/src/evaluation/tracer.ts +0 -3
  140. package/src/evaluation/types.ts +0 -23
  141. package/src/index.ts +0 -13
  142. package/src/internal/api/__tests__/errors.test.ts +0 -98
  143. package/src/internal/api/client.ts +0 -30
  144. package/src/internal/api/errors.ts +0 -32
  145. package/src/internal/generated/openapi/.gitkeep +0 -0
  146. package/src/internal/generated/types/.gitkeep +0 -0
  147. package/src/observability/__tests__/integration/base.test.ts +0 -74
  148. package/src/observability/__tests__/integration/browser-setup-ordering.test.ts +0 -60
  149. package/src/observability/__tests__/integration/complex-nested-spans.test.ts +0 -29
  150. package/src/observability/__tests__/integration/error-handling.test.ts +0 -24
  151. package/src/observability/__tests__/integration/langwatch-disabled-otel.test.ts +0 -24
  152. package/src/observability/__tests__/integration/langwatch-first-then-vercel.test.ts +0 -24
  153. package/src/observability/__tests__/integration/multiple-setup-attempts.test.ts +0 -27
  154. package/src/observability/__tests__/integration/otel-ordering.test.ts +0 -27
  155. package/src/observability/__tests__/integration/vercel-configurations.test.ts +0 -20
  156. package/src/observability/__tests__/integration/vercel-first-then-langwatch.test.ts +0 -27
  157. package/src/observability/__tests__/span.test.ts +0 -214
  158. package/src/observability/__tests__/trace.test.ts +0 -180
  159. package/src/observability/exporters/index.ts +0 -1
  160. package/src/observability/index.ts +0 -4
  161. package/src/observability/instrumentation/langchain/__tests__/integration/langchain-chatbot.test.ts +0 -112
  162. package/src/observability/instrumentation/langchain/__tests__/langchain.test.ts +0 -284
  163. package/src/observability/instrumentation/langchain/index.ts +0 -624
  164. package/src/observability/processors/__tests__/filterable-batch-span-exporter.test.ts +0 -98
  165. package/src/observability/processors/filterable-batch-span-processor.ts +0 -99
  166. package/src/observability/processors/index.ts +0 -1
  167. package/src/observability/semconv/attributes.ts +0 -185
  168. package/src/observability/semconv/events.ts +0 -42
  169. package/src/observability/semconv/index.ts +0 -16
  170. package/src/observability/semconv/values.ts +0 -159
  171. package/src/observability/span.ts +0 -728
  172. package/src/observability/trace.ts +0 -301
  173. package/src/prompt/__tests__/prompt.test.ts +0 -139
  174. package/src/prompt/get-prompt-version.ts +0 -49
  175. package/src/prompt/get-prompt.ts +0 -44
  176. package/src/prompt/index.ts +0 -3
  177. package/src/prompt/prompt.ts +0 -133
  178. package/src/prompt/service.ts +0 -221
  179. package/src/prompt/tracer.ts +0 -3
  180. package/src/prompt/types.ts +0 -0
  181. package/ts-to-zod.config.js +0 -35
  182. package/tsconfig.json +0 -26
  183. package/tsup.config.ts +0 -20
  184. package/vitest.config.ts +0 -9
@@ -1,28 +0,0 @@
1
- {
2
- "name": "langgraph-sdk-example",
3
- "description": "",
4
- "main": "index.js",
5
- "scripts": {
6
- "start": "tsc && dotenv -- node dist/index.js",
7
- "build": "tsc",
8
- "test": "echo \"Error: no test specified\" && exit 1"
9
- },
10
- "keywords": [],
11
- "author": "LangWatch",
12
- "type": "module",
13
- "license": "MIT",
14
- "dependencies": {
15
- "@langchain/openai": "^0.6.3",
16
- "@langchain/core": "^0.3.66",
17
- "langchain": "^0.3.30",
18
- "@langchain/langgraph": "^0.4.2",
19
- "@opentelemetry/context-async-hooks": "^2.0.1",
20
- "@opentelemetry/sdk-node": "^0.203.0",
21
- "cli-markdown": "^3.5.1",
22
- "langwatch": "file:../../"
23
- },
24
- "devDependencies": {
25
- "typescript": "^5.9.2",
26
- "dotenv-cli": "^10.0.0"
27
- }
28
- }
@@ -1,137 +0,0 @@
1
- declare module 'cli-markdown' {
2
- export interface CliMarkdownOptions {
3
- /**
4
- * Custom styles for different markdown elements
5
- */
6
- styles?: {
7
- /**
8
- * Style for headings (h1, h2, h3, etc.)
9
- */
10
- heading?: string;
11
- /**
12
- * Style for bold text
13
- */
14
- bold?: string;
15
- /**
16
- * Style for italic text
17
- */
18
- italic?: string;
19
- /**
20
- * Style for code blocks
21
- */
22
- code?: string;
23
- /**
24
- * Style for inline code
25
- */
26
- inlineCode?: string;
27
- /**
28
- * Style for links
29
- */
30
- link?: string;
31
- /**
32
- * Style for lists
33
- */
34
- list?: string;
35
- /**
36
- * Style for blockquotes
37
- */
38
- blockquote?: string;
39
- /**
40
- * Style for horizontal rules
41
- */
42
- hr?: string;
43
- };
44
- /**
45
- * Whether to preserve line breaks
46
- */
47
- preserveLineBreaks?: boolean;
48
- /**
49
- * Custom renderer functions for different markdown elements
50
- */
51
- renderers?: {
52
- /**
53
- * Custom renderer for headings
54
- */
55
- heading?: (text: string, level: number) => string;
56
- /**
57
- * Custom renderer for paragraphs
58
- */
59
- paragraph?: (text: string) => string;
60
- /**
61
- * Custom renderer for lists
62
- */
63
- list?: (items: string[], ordered: boolean) => string;
64
- /**
65
- * Custom renderer for list items
66
- */
67
- listItem?: (text: string, index: number) => string;
68
- /**
69
- * Custom renderer for code blocks
70
- */
71
- code?: (code: string, language?: string) => string;
72
- /**
73
- * Custom renderer for inline code
74
- */
75
- inlineCode?: (code: string) => string;
76
- /**
77
- * Custom renderer for links
78
- */
79
- link?: (text: string, url: string) => string;
80
- /**
81
- * Custom renderer for images
82
- */
83
- image?: (alt: string, url: string) => string;
84
- /**
85
- * Custom renderer for blockquotes
86
- */
87
- blockquote?: (text: string) => string;
88
- /**
89
- * Custom renderer for horizontal rules
90
- */
91
- hr?: () => string;
92
- /**
93
- * Custom renderer for emphasis (bold/italic)
94
- */
95
- emphasis?: (text: string, type: 'bold' | 'italic') => string;
96
- };
97
- /**
98
- * Maximum width for text wrapping
99
- */
100
- maxWidth?: number;
101
- /**
102
- * Whether to enable ANSI color codes
103
- */
104
- colors?: boolean;
105
- /**
106
- * Custom color theme
107
- */
108
- theme?: {
109
- /**
110
- * Color for headings
111
- */
112
- heading?: string;
113
- /**
114
- * Color for links
115
- */
116
- link?: string;
117
- /**
118
- * Color for code
119
- */
120
- code?: string;
121
- /**
122
- * Color for blockquotes
123
- */
124
- blockquote?: string;
125
- };
126
- }
127
-
128
- /**
129
- * Converts markdown text to formatted CLI output
130
- * @param markdown - The markdown text to convert
131
- * @param options - Configuration options for the conversion
132
- * @returns Formatted CLI text
133
- */
134
- function cliMarkdown(markdown: string, options?: CliMarkdownOptions): string;
135
-
136
- export = cliMarkdown;
137
- }
@@ -1,196 +0,0 @@
1
- import { setupLangWatch } from "langwatch/node";
2
- import { LangWatchCallbackHandler } from "langwatch/observability/instrumentation/langchain";
3
- import { getLangWatchTracer } from "langwatch";
4
- import { semconv } from "langwatch/observability";
5
- import { ChatOpenAI } from "@langchain/openai";
6
- import { HumanMessage, SystemMessage } from "@langchain/core/messages";
7
- import * as readline from "readline";
8
- import cliMarkdown from "cli-markdown";
9
-
10
- await setupLangWatch();
11
-
12
- const tracer = getLangWatchTracer("langgraph-sdk-example");
13
-
14
- // Define the state interface for our multi-agent workflow
15
- interface WorkflowState {
16
- userQuery: string;
17
- analysis: string;
18
- recommendation: string;
19
- finalResponse: string;
20
- }
21
-
22
- async function main() {
23
- const threadId = crypto.randomUUID();
24
- const langWatchCallback = new LangWatchCallbackHandler();
25
-
26
- const rl = readline.createInterface({
27
- input: process.stdin,
28
- output: process.stdout,
29
- });
30
-
31
- console.log('šŸ¤– Multi-Agent Workflow started! Type "quit" to exit.');
32
- console.log("This example demonstrates a workflow with:");
33
- console.log("1. Query Analysis Agent");
34
- console.log("2. Recommendation Agent");
35
- console.log("3. Response Synthesis Agent");
36
- console.log("---");
37
-
38
- // Initialize LangChain chat model
39
- const chatModel = new ChatOpenAI({
40
- modelName: "gpt-4o-mini",
41
- temperature: 0.7,
42
- callbacks: [langWatchCallback],
43
- });
44
-
45
- // Agent 1: Query Analysis Agent
46
- const analyzeQuery = async (userQuery: string): Promise<string> => {
47
- const analysisPrompt = new SystemMessage(
48
- "You are an expert at analyzing user queries. Analyze the user's query and provide insights about what they're asking for, their intent, and any specific requirements."
49
- );
50
-
51
- const result = await chatModel.invoke([
52
- analysisPrompt,
53
- new HumanMessage(`Analyze this query: ${userQuery}`)
54
- ]);
55
-
56
- return result.content as string;
57
- };
58
-
59
- // Agent 2: Recommendation Agent
60
- const generateRecommendation = async (userQuery: string, analysis: string): Promise<string> => {
61
- const recommendationPrompt = new SystemMessage(
62
- "You are an expert at providing helpful recommendations. Based on the analysis, provide specific, actionable recommendations."
63
- );
64
-
65
- const result = await chatModel.invoke([
66
- recommendationPrompt,
67
- new HumanMessage(`Based on this analysis: ${analysis}\n\nProvide recommendations for: ${userQuery}`)
68
- ]);
69
-
70
- return result.content as string;
71
- };
72
-
73
- // Agent 3: Response Synthesis Agent
74
- const synthesizeResponse = async (userQuery: string, analysis: string, recommendation: string): Promise<string> => {
75
- const synthesisPrompt = new SystemMessage(
76
- "You are an expert at synthesizing information into clear, helpful responses. Combine the analysis and recommendations into a comprehensive, well-structured response."
77
- );
78
-
79
- const result = await chatModel.invoke([
80
- synthesisPrompt,
81
- new HumanMessage(`Original Query: ${userQuery}\n\nAnalysis: ${analysis}\n\nRecommendations: ${recommendation}\n\nSynthesize this into a comprehensive response.`)
82
- ]);
83
-
84
- return result.content as string;
85
- };
86
-
87
- // Main workflow function
88
- const runWorkflow = async (userQuery: string): Promise<WorkflowState> => {
89
- console.log("šŸ” Step 1: Analyzing query...");
90
- const analysis = await analyzeQuery(userQuery);
91
-
92
- console.log("šŸ’” Step 2: Generating recommendations...");
93
- const recommendation = await generateRecommendation(userQuery, analysis);
94
-
95
- console.log("šŸŽÆ Step 3: Synthesizing final response...");
96
- const finalResponse = await synthesizeResponse(userQuery, analysis, recommendation);
97
-
98
- return {
99
- userQuery,
100
- analysis,
101
- recommendation,
102
- finalResponse,
103
- };
104
- };
105
-
106
- while (true) {
107
- let finish = false;
108
-
109
- await tracer.withActiveSpan("workflow_iteration", {
110
- attributes: {
111
- [semconv.ATTR_LANGWATCH_THREAD_ID]: threadId,
112
- },
113
- }, async (span) => {
114
- try {
115
- // Get user input
116
- const userInput = await new Promise<string>((resolve) => {
117
- rl.question("You: ", resolve);
118
- });
119
-
120
- // Check for exit command
121
- if (
122
- userInput.toLowerCase() === "quit" ||
123
- userInput.toLowerCase() === "exit"
124
- ) {
125
- console.log("šŸ‘‹ Goodbye!");
126
- finish = true;
127
- return;
128
- }
129
-
130
- // Skip empty input
131
- if (!userInput.trim()) {
132
- return;
133
- }
134
-
135
- console.log("šŸ¤– Processing through multi-agent workflow...");
136
-
137
- // Execute the workflow
138
- const result = await runWorkflow(userInput);
139
-
140
- // Display the workflow results
141
- console.log("\nšŸ“Š Workflow Results:");
142
- console.log("---");
143
-
144
- console.log("šŸ” Analysis:");
145
- console.log(cliMarkdown(result.analysis, {
146
- colors: true,
147
- maxWidth: 80,
148
- theme: {
149
- heading: "cyan",
150
- link: "blue",
151
- code: "green",
152
- blockquote: "yellow",
153
- },
154
- }));
155
-
156
- console.log("\nšŸ’” Recommendations:");
157
- console.log(cliMarkdown(result.recommendation, {
158
- colors: true,
159
- maxWidth: 80,
160
- theme: {
161
- heading: "cyan",
162
- link: "blue",
163
- code: "green",
164
- blockquote: "yellow",
165
- },
166
- }));
167
-
168
- console.log("\nšŸŽÆ Final Response:");
169
- console.log(cliMarkdown(result.finalResponse, {
170
- colors: true,
171
- maxWidth: 80,
172
- theme: {
173
- heading: "cyan",
174
- link: "blue",
175
- code: "green",
176
- blockquote: "yellow",
177
- },
178
- }));
179
-
180
- console.log("---");
181
- } catch (error) {
182
- console.error("āŒ Error:", error);
183
- console.log("Please try again.");
184
- }
185
- });
186
-
187
- if (finish) {
188
- break;
189
- }
190
- }
191
-
192
- rl.close();
193
- }
194
-
195
- // Run the multi-agent workflow
196
- main().catch(console.error);
@@ -1,25 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "node16",
5
- "moduleResolution": "node16",
6
- "outDir": "./dist",
7
- "rootDir": "./src",
8
- "strict": true,
9
- "esModuleInterop": true,
10
- "skipLibCheck": true,
11
- "forceConsistentCasingInFileNames": true,
12
- "allowSyntheticDefaultImports": true,
13
- "resolveJsonModule": true,
14
- "declaration": true,
15
- "declarationMap": true,
16
- "sourceMap": true
17
- },
18
- "include": [
19
- "src/**/*"
20
- ],
21
- "exclude": [
22
- "node_modules",
23
- "dist"
24
- ]
25
- }
@@ -1,2 +0,0 @@
1
- LANGWATCH_API_KEY=""
2
- OPENAI_API_KEY=""
@@ -1,57 +0,0 @@
1
- # Mastra Weather Agent Example
2
-
3
- This example demonstrates how to use LangWatch with Mastra to create a weather agent that can provide weather information and suggest activities based on weather conditions.
4
-
5
- ## Features
6
-
7
- - **Weather Agent**: An AI agent that can fetch weather data and suggest activities
8
- - **Weather Tool**: A tool that fetches real-time weather data from Open-Meteo API
9
- - **CLI Chatbox Interface**: Interactive command-line interface for chatting with the weather agent
10
- - **LangWatch Integration**: Full observability and tracing with LangWatch
11
-
12
- ## Getting Started
13
-
14
- 1. Install dependencies:
15
- ```bash
16
- npm install
17
- ```
18
-
19
- 2. Set up your environment variables:
20
- ```bash
21
- cp .env.example .env
22
- # Add your OpenAI API key to .env
23
- ```
24
-
25
- 3. Run the CLI chatbox interface:
26
- ```bash
27
- npm run cli
28
- ```
29
-
30
- 4. Or run the workflow example:
31
- ```bash
32
- npm start
33
- ```
34
-
35
- ## Usage
36
-
37
- ### CLI Chatbox Interface
38
-
39
- The CLI interface allows you to interact with the weather agent in a conversational manner:
40
-
41
- ```bash
42
- npm run cli
43
- ```
44
-
45
- Example conversation:
46
- ```
47
- šŸŒ¤ļø Weather Agent Chatbot started! Type "quit" to exit.
48
- Ask me about weather for any location and I'll help you plan activities!
49
- ---
50
- You: What's the weather like in Paris?
51
- šŸŒ¤ļø Checking weather and planning activities...
52
- [Agent responds with weather information and activity suggestions]
53
- ```
54
-
55
- ### Workflow Example
56
-
57
- The workflow example demonstrates how to use Mastra workflows to fetch weather data and plan activities programmatically.