@@ -65,31 +65,46 @@ graph LR
65
65
```
66
66
</Step >
67
67
<Step title = " Create File" >
68
- Create ` app.js ` file
68
+ Create ` app.ts ` file
69
69
70
70
## Code Example
71
71
72
72
<CodeGroup >
73
73
``` javascript Single Agent
74
- const { Agent } = require (' praisonai' );
75
- const agent = new Agent ({ instructions: ' You are a helpful AI assistant' });
76
- agent .start (' Write a movie script about a robot in Mars' );
74
+ import { Agent } from ' praisonai' ;
75
+
76
+ const agent = new Agent ({
77
+ instructions: ` You are a creative writer who writes short stories with emojis.` ,
78
+ name: " StoryWriter"
79
+ });
80
+
81
+ agent .start (" Write a story about a time traveler" )
77
82
```
78
83
79
84
``` javascript Multi Agents
80
- const { Agent , PraisonAIAgents } = require ( ' praisonai' ) ;
85
+ import { Agent , PraisonAIAgents } from ' praisonai' ;
81
86
82
- const researchAgent = new Agent ({ instructions: ' Research about AI' });
83
- const summariseAgent = new Agent ({ instructions: ' Summarise research agent\' s findings' });
87
+ const storyAgent = new Agent ({
88
+ instructions: " Generate a very short story (2-3 sentences) about artificial intelligence with emojis." ,
89
+ name: " StoryAgent"
90
+ });
84
91
85
- const agents = new PraisonAIAgents ({ agents: [researchAgent, summariseAgent] });
86
- agents .start ();
92
+ const summaryAgent = new Agent ({
93
+ instructions: " Summarize the provided AI story in one sentence with emojis." ,
94
+ name: " SummaryAgent"
95
+ });
96
+
97
+ const agents = new PraisonAIAgents ({
98
+ agents: [storyAgent, summaryAgent]
99
+ });
100
+
101
+ agents .start ()
87
102
```
88
103
</CodeGroup >
89
104
</Step >
90
105
<Step title = " Run Script" >
91
106
``` bash
92
- node app.js
107
+ npx ts- node app.ts
93
108
```
94
109
</Step >
95
110
</Steps >
@@ -103,7 +118,7 @@ agents.start();
103
118
Create and run a single agent to perform a specific task:
104
119
105
120
``` typescript
106
- import { Agent } from ' ../../src/agent/simple ' ;
121
+ import { Agent } from ' praisonai ' ;
107
122
108
123
// Single agent example - Science Explainer
109
124
const agent = new Agent ({
@@ -129,7 +144,7 @@ agent.start("Why is the sky blue?")
129
144
Create and run multiple agents working together:
130
145
131
146
``` typescript
132
- import { Agent , PraisonAIAgents } from ' ../../src/agent/simple ' ;
147
+ import { Agent , PraisonAIAgents } from ' praisonai ' ;
133
148
134
149
// Create story agent
135
150
const storyAgent = new Agent ({
@@ -168,7 +183,7 @@ agents.start()
168
183
Create agents with specific tasks and dependencies:
169
184
170
185
``` typescript
171
- import { Agent , PraisonAIAgents } from ' ../../src/agent/simple ' ;
186
+ import { Agent , PraisonAIAgents } from ' praisonai ' ;
172
187
173
188
// Create recipe agent
174
189
const recipeAgent = new Agent ({
0 commit comments