agentlang 0.10.4 → 0.10.5

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 (111) hide show
  1. package/README.md +22 -9
  2. package/out/extension/main.cjs +250 -250
  3. package/out/extension/main.cjs.map +2 -2
  4. package/out/language/generated/ast.d.ts +2 -12
  5. package/out/language/generated/ast.d.ts.map +1 -1
  6. package/out/language/generated/ast.js +0 -8
  7. package/out/language/generated/ast.js.map +1 -1
  8. package/out/language/generated/grammar.d.ts.map +1 -1
  9. package/out/language/generated/grammar.js +18 -52
  10. package/out/language/generated/grammar.js.map +1 -1
  11. package/out/language/main.cjs +522 -564
  12. package/out/language/main.cjs.map +3 -3
  13. package/out/language/parser.d.ts.map +1 -1
  14. package/out/language/parser.js +10 -3
  15. package/out/language/parser.js.map +1 -1
  16. package/out/runtime/api.d.ts.map +1 -1
  17. package/out/runtime/api.js +0 -14
  18. package/out/runtime/api.js.map +1 -1
  19. package/out/runtime/defs.d.ts +0 -1
  20. package/out/runtime/defs.d.ts.map +1 -1
  21. package/out/runtime/defs.js +1 -2
  22. package/out/runtime/defs.js.map +1 -1
  23. package/out/runtime/embeddings/chunker.d.ts +0 -18
  24. package/out/runtime/embeddings/chunker.d.ts.map +1 -1
  25. package/out/runtime/embeddings/chunker.js +15 -47
  26. package/out/runtime/embeddings/chunker.js.map +1 -1
  27. package/out/runtime/embeddings/openai.d.ts.map +1 -1
  28. package/out/runtime/embeddings/openai.js +11 -22
  29. package/out/runtime/embeddings/openai.js.map +1 -1
  30. package/out/runtime/embeddings/provider.d.ts +0 -1
  31. package/out/runtime/embeddings/provider.d.ts.map +1 -1
  32. package/out/runtime/embeddings/provider.js +1 -20
  33. package/out/runtime/embeddings/provider.js.map +1 -1
  34. package/out/runtime/exec-graph.js +5 -5
  35. package/out/runtime/exec-graph.js.map +1 -1
  36. package/out/runtime/interpreter.d.ts +4 -4
  37. package/out/runtime/interpreter.d.ts.map +1 -1
  38. package/out/runtime/interpreter.js +23 -30
  39. package/out/runtime/interpreter.js.map +1 -1
  40. package/out/runtime/loader.d.ts.map +1 -1
  41. package/out/runtime/loader.js +6 -2
  42. package/out/runtime/loader.js.map +1 -1
  43. package/out/runtime/logger.d.ts.map +1 -1
  44. package/out/runtime/logger.js +1 -8
  45. package/out/runtime/logger.js.map +1 -1
  46. package/out/runtime/module.d.ts +0 -6
  47. package/out/runtime/module.d.ts.map +1 -1
  48. package/out/runtime/module.js +1 -58
  49. package/out/runtime/module.js.map +1 -1
  50. package/out/runtime/modules/ai.d.ts +4 -4
  51. package/out/runtime/modules/ai.d.ts.map +1 -1
  52. package/out/runtime/modules/ai.js +70 -166
  53. package/out/runtime/modules/ai.js.map +1 -1
  54. package/out/runtime/modules/auth.d.ts.map +1 -1
  55. package/out/runtime/modules/auth.js +6 -4
  56. package/out/runtime/modules/auth.js.map +1 -1
  57. package/out/runtime/monitor.d.ts +2 -1
  58. package/out/runtime/monitor.d.ts.map +1 -1
  59. package/out/runtime/monitor.js +5 -1
  60. package/out/runtime/monitor.js.map +1 -1
  61. package/out/runtime/resolvers/sqldb/database.d.ts.map +1 -1
  62. package/out/runtime/resolvers/sqldb/database.js +126 -128
  63. package/out/runtime/resolvers/sqldb/database.js.map +1 -1
  64. package/out/runtime/resolvers/sqldb/impl.d.ts +0 -1
  65. package/out/runtime/resolvers/sqldb/impl.d.ts.map +1 -1
  66. package/out/runtime/resolvers/sqldb/impl.js +0 -3
  67. package/out/runtime/resolvers/sqldb/impl.js.map +1 -1
  68. package/out/runtime/services/documentFetcher.d.ts.map +1 -1
  69. package/out/runtime/services/documentFetcher.js +6 -21
  70. package/out/runtime/services/documentFetcher.js.map +1 -1
  71. package/out/runtime/state.d.ts +0 -14
  72. package/out/runtime/state.d.ts.map +1 -1
  73. package/out/runtime/state.js +0 -28
  74. package/out/runtime/state.js.map +1 -1
  75. package/package.json +19 -19
  76. package/src/language/agentlang.langium +2 -2
  77. package/src/language/generated/ast.ts +2 -12
  78. package/src/language/generated/grammar.ts +18 -52
  79. package/src/language/parser.ts +9 -2
  80. package/src/runtime/api.ts +0 -15
  81. package/src/runtime/defs.ts +1 -2
  82. package/src/runtime/embeddings/chunker.ts +14 -52
  83. package/src/runtime/embeddings/openai.ts +9 -27
  84. package/src/runtime/embeddings/provider.ts +1 -22
  85. package/src/runtime/exec-graph.ts +4 -4
  86. package/src/runtime/interpreter.ts +24 -29
  87. package/src/runtime/loader.ts +10 -2
  88. package/src/runtime/logger.ts +1 -12
  89. package/src/runtime/module.ts +1 -64
  90. package/src/runtime/modules/ai.ts +81 -206
  91. package/src/runtime/modules/auth.ts +6 -4
  92. package/src/runtime/monitor.ts +10 -1
  93. package/src/runtime/resolvers/sqldb/database.ts +130 -142
  94. package/src/runtime/resolvers/sqldb/impl.ts +0 -4
  95. package/src/runtime/services/documentFetcher.ts +6 -21
  96. package/src/runtime/state.ts +0 -29
  97. package/out/runtime/document-retriever.d.ts +0 -24
  98. package/out/runtime/document-retriever.d.ts.map +0 -1
  99. package/out/runtime/document-retriever.js +0 -258
  100. package/out/runtime/document-retriever.js.map +0 -1
  101. package/out/runtime/resolvers/vector/lancedb-store.d.ts +0 -16
  102. package/out/runtime/resolvers/vector/lancedb-store.d.ts.map +0 -1
  103. package/out/runtime/resolvers/vector/lancedb-store.js +0 -159
  104. package/out/runtime/resolvers/vector/lancedb-store.js.map +0 -1
  105. package/out/runtime/resolvers/vector/types.d.ts +0 -32
  106. package/out/runtime/resolvers/vector/types.d.ts.map +0 -1
  107. package/out/runtime/resolvers/vector/types.js +0 -2
  108. package/out/runtime/resolvers/vector/types.js.map +0 -1
  109. package/src/runtime/document-retriever.ts +0 -311
  110. package/src/runtime/resolvers/vector/lancedb-store.ts +0 -187
  111. package/src/runtime/resolvers/vector/types.ts +0 -39
package/README.md CHANGED
@@ -1,3 +1,4 @@
1
+
1
2
  <div align="center">
2
3
 
3
4
  <p>
@@ -24,20 +25,18 @@
24
25
  <a href="https://github.com/agentlang-ai/agentlang/tree/main/example"><img src="https://img.shields.io/badge/Examples-Page-yellow?logo=homepage&logoColor=yellow&style=for-the-badge"></a>
25
26
 
26
27
  [![Node Version](https://img.shields.io/badge/node-%3E%3D20.0.0-brightgreen?logo=node.js)](https://nodejs.org) [![CI](https://github.com/agentlang-ai/agentlang/actions/workflows/ci.yml/badge.svg)](https://github.com/agentlang-ai/agentlang/actions/workflows/ci.yml)![License](https://img.shields.io/badge/License-Sustainable%20Use%20v1.0-blue.svg) [![npm downloads](https://img.shields.io/npm/dm/agentlang.svg)](https://www.npmjs.com/package/agentlang)
27
-
28
28
  <hr>
29
29
 
30
30
  ## Agentlang - Team as Code
31
-
32
31
  </div>
33
32
 
34
33
  Agentlang is a declarative DSL (built on TypeScript) for creating AI Agents and full-stack Agentic Apps. With Agentlang, you define, version, run, mentor, and monitor teams of AI agents, along with the app infrastructure they need: data model, workflows, RBAC, integrations, and UI. We refer to this approach - bringing together AI agent development and App development into a single coherent discipline - as Team-as-Code (our riff on IaC).
35
34
 
36
- - **For Devs and Non-Devs:** Code and vibe-code in your IDE, focusing on the business-logic of your app, not wiring. Alternatively, you can build, run, mentor and monitor your AI Team in Studio - our visual-builder (coming soon). Switch back-and-forth between the two modes seamlessly.
35
+ * **For Devs and Non-Devs:** Code and vibe-code in your IDE, focusing on the business-logic of your app, not wiring. Alternatively, you can build, run, mentor and monitor your AI Team in Studio - our visual-builder (coming soon). Switch back-and-forth between the two modes seamlessly.
37
36
 
38
- - **Robust Integrations:** The Agentlang runtime ships with native integrations for LLMs, databases, vector DBs, and auth providers. Our connector architecture is built for the enterprise, with a rapidly growing catalog for systems like Salesforce, ServiceNow, HubSpot, Snowflake, and more. Also, because Agentlang compiles to Node.js (and runs in the browser), you can use any existing JavaScript library out of the box.
37
+ * **Robust Integrations:** The Agentlang runtime ships with native integrations for LLMs, databases, vector DBs, and auth providers. Our connector architecture is built for the enterprise, with a rapidly growing catalog for systems like Salesforce, ServiceNow, HubSpot, Snowflake, and more. Also, because Agentlang compiles to Node.js (and runs in the browser), you can use any existing JavaScript library out of the box.
39
38
 
40
- - **Production-grade**: Under the hood, it’s all modern TypeScript—strong typing, tooling, testing, and CI/CD-friendly workflows—built for enterprise-class reliability, governance, and scale.
39
+ * **Production-grade**: Under the hood, it’s all modern TypeScript—strong typing, tooling, testing, and CI/CD-friendly workflows—built for enterprise-class reliability, governance, and scale.
41
40
 
42
41
  Agentlang introduces two foundational innovations: [Agentic Reliability Modeling](#-agentic-reliability-modeling) and [AgentLang Ontology](#agentlang-ontology)
43
42
 
@@ -102,7 +101,8 @@ flow TicketFlow {
102
101
 
103
102
  agent TicketFlow {
104
103
  llm "gpt4o",
105
- role "You are a network ticket management application. Your job is to triage any ticket passed to you
104
+ role "ticket_manager",
105
+ goal "You are a network ticket management application. Your job is to triage any ticket passed to you
106
106
  and update the ticket with appropriate assigned_to, status and triaging comments.",
107
107
  glossary [
108
108
  {"name": "incident", "meaning": "a problem report", "synonyms": "ticket"},
@@ -133,6 +133,7 @@ workflow ticketInProgress {
133
133
  }
134
134
  ```
135
135
 
136
+
136
137
  ### ✨ First-class AI Agents
137
138
 
138
139
  Agents and many concepts agents use are built-in language constructs.
@@ -140,7 +141,8 @@ Agents and many concepts agents use are built-in language constructs.
140
141
  ```typescript
141
142
  agent TicketFlow {
142
143
  llm "gpt4o",
143
- role "You are a network ticket management agent. Your job is to triage any ticket passed to you and
144
+ role "ticket_manager",
145
+ goal "You are a network ticket management agent. Your job is to triage any ticket passed to you and
144
146
  update the ticket with appropriate assigned_to, status and triaging comments."
145
147
  }
146
148
 
@@ -210,6 +212,7 @@ As the flow executes an agent that specializes in evaluating decision tables wil
210
212
 
211
213
  ```typescript
212
214
  agent salaryHikeAgent {
215
+ role "hr_manager",
213
216
  instruction "Give an employee a salary-hike based on his/her sales performance",
214
217
  tools acme/employee
215
218
  }
@@ -226,6 +229,7 @@ As the `salaryHikeAgent` tries to compute the salary-increment for a particular
226
229
 
227
230
  ```typescript
228
231
  agent salaryHikeAgent {
232
+ role "hr_manager",
229
233
  instruction "Give an employee a salary-hike based on his/her sales performance",
230
234
  tools acme/employee
231
235
  }
@@ -254,6 +258,7 @@ Here, the provided scenario helps the agent to take a well-specified action in t
254
258
 
255
259
  ```typescript
256
260
  agent campaignAnalyzer {
261
+ role "marketing_analyst",
257
262
  instruction "Evaluate and optimize marketing campaign performance based on key performance indicators (KPIs) and assign a performance rating",
258
263
  tools acme/campaign_eval,
259
264
  // ...
@@ -317,6 +322,7 @@ entity Category {
317
322
  relationship PostCategory between(Post, Category)
318
323
 
319
324
  @public agent postEditor {
325
+ role "content_editor",
320
326
  instruction "Create a new blog post based on the outline provided to you.",
321
327
  tools [blog.core/Post]
322
328
  }
@@ -328,8 +334,8 @@ What makes this model special is how seamlessly an agent can interact with it
328
334
 
329
335
  To get started with Agentlang Ontology, please see the [Agentlang Tutorial](https://docs.fractl.io/app) or explore the following example applications:
330
336
 
331
- - [Car Dealership](https://github.com/agentlang-ai/agentlang/tree/main/example/car_dealership)
332
- - [Customer Support System](https://github.com/agentlang-ai/agentlang/tree/main/example/customer_support_system)
337
+ * [Car Dealership](https://github.com/agentlang-ai/agentlang/tree/main/example/car_dealership)
338
+ * [Customer Support System](https://github.com/agentlang-ai/agentlang/tree/main/example/customer_support_system)
333
339
 
334
340
  ## 🚀 Getting Started
335
341
 
@@ -363,7 +369,14 @@ For contributors who want to build and develop Agentlang itself:
363
369
  ```shell
364
370
  # Install dependencies
365
371
  npm install
372
+
373
+ OR
374
+
375
+ # Install pnpm: https://pnpm.io/installation
376
+ # Use pnpm
377
+ pnpm install
366
378
  ```
379
+ **Note**: If pnpm shows build script warnings, run `pnpm approve-builds` and approve esbuild and sqlite3.
367
380
 
368
381
  ### ⚡ Build
369
382