@crewai-ts/core 0.1.12 → 0.1.13

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 (2) hide show
  1. package/README.md +174 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,174 @@
1
+ # @crewai-ts/core
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@crewai-ts/core.svg)](https://www.npmjs.com/package/@crewai-ts/core)
4
+ [![types](https://img.shields.io/npm/types/@crewai-ts/core.svg)](https://www.npmjs.com/package/@crewai-ts/core)
5
+
6
+ An **unofficial** TypeScript port of [CrewAI](https://github.com/crewAIInc/crewAI) for building multi-agent workflows with agents, tasks, crews, flows, memory, knowledge, tools, checkpoints, and streaming.
7
+
8
+ This project is not affiliated with, endorsed by, or maintained by crewAI, Inc.
9
+
10
+ ## Install
11
+
12
+ ```sh
13
+ npm install @crewai-ts/core
14
+ ```
15
+
16
+ Requirements:
17
+
18
+ - Node.js 22 or later
19
+ - ESM and CommonJS projects are both supported
20
+ - Type declarations are included
21
+
22
+ ## Quick Start
23
+
24
+ ```ts
25
+ import { Agent, Crew, Process, Task } from "@crewai-ts/core";
26
+
27
+ const researcher = new Agent({
28
+ role: "Researcher",
29
+ goal: "Find useful implementation details",
30
+ backstory: "A careful technical analyst.",
31
+ llm: (messages) => `researched: ${messages.at(-1)?.content ?? ""}`,
32
+ });
33
+
34
+ const task = new Task({
35
+ description: "Research {topic}",
36
+ expectedOutput: "A concise implementation brief",
37
+ agent: researcher,
38
+ });
39
+
40
+ const crew = new Crew({
41
+ agents: [researcher],
42
+ tasks: [task],
43
+ process: Process.sequential,
44
+ });
45
+
46
+ const result = await crew.kickoff({
47
+ inputs: { topic: "CrewAI with TypeScript" },
48
+ });
49
+
50
+ console.log(result.raw);
51
+ ```
52
+
53
+ ## Decorator Style
54
+
55
+ ```ts
56
+ import { Agent, Crew, Process, Task, agent, crew, task } from "@crewai-ts/core";
57
+
58
+ class ResearchCrew {
59
+ @agent
60
+ researcher() {
61
+ return new Agent({
62
+ role: "Researcher",
63
+ goal: "Find facts",
64
+ backstory: "Careful analyst",
65
+ llm: (messages) => `result: ${messages.at(-1)?.content ?? ""}`,
66
+ });
67
+ }
68
+
69
+ @task
70
+ researchTask() {
71
+ return new Task({
72
+ description: "Research {topic}",
73
+ expectedOutput: "A concise brief",
74
+ agent: this.researcher(),
75
+ });
76
+ }
77
+
78
+ @crew
79
+ crew() {
80
+ return new Crew({
81
+ agents: [this.researcher()],
82
+ tasks: [this.researchTask()],
83
+ process: Process.sequential,
84
+ });
85
+ }
86
+ }
87
+
88
+ const result = await new ResearchCrew().crew().kickoff({
89
+ inputs: { topic: "CrewAI" },
90
+ });
91
+ ```
92
+
93
+ ## LLM Providers
94
+
95
+ Pass a function LLM directly:
96
+
97
+ ```ts
98
+ const llm = (messages: Array<{ content?: string }>) => {
99
+ return `answer: ${messages.at(-1)?.content ?? ""}`;
100
+ };
101
+ ```
102
+
103
+ Or register a named provider:
104
+
105
+ ```ts
106
+ import { Agent, registerLLMProvider } from "@crewai-ts/core";
107
+
108
+ registerLLMProvider("demo/provider", () => ({
109
+ call: async (messages) => `provider result: ${messages.at(-1)?.content ?? ""}`,
110
+ }));
111
+
112
+ const agent = new Agent({
113
+ role: "Assistant",
114
+ goal: "Use a registered provider",
115
+ backstory: "A deterministic assistant.",
116
+ llm: "demo/provider",
117
+ });
118
+ ```
119
+
120
+ ## Tools
121
+
122
+ ```ts
123
+ import { Agent, StructuredTool, Task } from "@crewai-ts/core";
124
+
125
+ const search = new StructuredTool({
126
+ name: "search",
127
+ description: "Search internal notes",
128
+ schema: {
129
+ type: "object",
130
+ properties: {
131
+ query: { type: "string" },
132
+ },
133
+ required: ["query"],
134
+ },
135
+ func: async ({ query }) => `result for ${query}`,
136
+ });
137
+
138
+ const researcher = new Agent({
139
+ role: "Researcher",
140
+ goal: "Use tools when useful",
141
+ backstory: "Tool-using analyst.",
142
+ tools: [search],
143
+ llm: () => ({ toolName: "search", arguments: { query: "CrewAI" } }),
144
+ });
145
+
146
+ const task = new Task({
147
+ description: "Search for CrewAI information",
148
+ expectedOutput: "Search result",
149
+ agent: researcher,
150
+ });
151
+ ```
152
+
153
+ ## Features
154
+
155
+ - `Agent`, `Task`, `ConditionalTask`, `Crew`, `TaskOutput`, and `CrewOutput`
156
+ - Sequential and hierarchical process support
157
+ - Crew kickoff, batch kickoff, replay, planning, and usage metrics
158
+ - Standard TypeScript decorators: `@agent`, `@task`, `@crew`, `@beforeKickoff`, `@afterKickoff`
159
+ - Tool calling with `BaseTool` and `StructuredTool`
160
+ - Memory and knowledge sources
161
+ - JSON and SQLite checkpoint providers
162
+ - Flow APIs with `@start`, `@listen`, `@router`, `and_`, and `or_`
163
+ - Human input providers and task guardrails
164
+ - Streaming crew and flow output helpers
165
+ - Python-style snake_case compatibility aliases for common CrewAI entry points
166
+
167
+ ## Related Packages
168
+
169
+ - `@crewai-ts/nestjs`: NestJS dependency-injection integration
170
+ - `@crewai-ts/cli`: CLI helpers for CrewAI-style TypeScript projects
171
+
172
+ ## License
173
+
174
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crewai-ts/core",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "Unofficial TypeScript port of CrewAI (not affiliated with crewAI, Inc.).",
5
5
  "private": false,
6
6
  "keywords": [