diff --git a/docs/index.mdx b/docs/index.mdx
index ad45d6f7..06667838 100644
--- a/docs/index.mdx
+++ b/docs/index.mdx
@@ -114,27 +114,53 @@ agents.start()
-
- PraisonAI combines PraisonAI Agents, AutoGen, and CrewAI into a low-code solution for building and managing multi-agent LLM systems, focusing on simplicity, customization, and efficient human-agent collaboration.
-
+ Install the No Code PraisonAI Package:
```bash
- pip install praisonai
+ pip install praisonaiagents
```
+
```bash
- export OPENAI_API_KEY=xxxxxxxxxxxxxxxxxxxxxx
+ export OPENAI_API_KEY=your_openai_key
```
-
- ```bash
- praisonai --auto create a movie script about Robots in Mars
- ```
- This will automatically create required agents and complete the task
+
+ Create `agents.yaml`:
+
+
+ ```yaml Single Agent
+ roles:
+ summarise_agent:
+ instructions: Summarise Photosynthesis
+ ```
+
+ ```yaml Multiple Agents
+ roles:
+ diet_agent:
+ instructions: Give me 5 healthy food recipes
+ blog_agent:
+ instructions: Write a blog post about the food recipes
+ ```
+
+
+You can automatically create `agents.yaml` using:
+```bash
+praisonai --init "your task description"
+```
+
+
+
+
+
+ Execute your config:
+ ```bash
+ praisonai agents.yaml
+ ```
@@ -180,6 +206,68 @@ agents.start();
+
+
+
+
+ ```bash npm
+ npm install praisonai
+ ```
+ ```bash yarn
+ yarn add praisonai
+ ```
+
+
+
+ ```bash
+ export OPENAI_API_KEY=xxxxxxxxxxxxxxxxxxxxxx
+ ```
+
+
+ Create `app.ts` file
+
+ ## Code Example
+
+
+```javascript Single Agent
+import { Agent } from 'praisonai';
+
+const agent = new Agent({
+ instructions: `You are a creative writer who writes short stories with emojis.`,
+ name: "StoryWriter"
+});
+
+agent.start("Write a story about a time traveler")
+```
+
+```javascript Multi Agents
+import { Agent, PraisonAIAgents } from 'praisonai';
+
+const storyAgent = new Agent({
+ instructions: "Generate a very short story (2-3 sentences) about artificial intelligence with emojis.",
+ name: "StoryAgent"
+});
+
+const summaryAgent = new Agent({
+ instructions: "Summarize the provided AI story in one sentence with emojis.",
+ name: "SummaryAgent"
+});
+
+const agents = new PraisonAIAgents({
+ agents: [storyAgent, summaryAgent]
+});
+
+agents.start()
+```
+
+
+
+ ```bash
+ npx ts-node app.ts
+ ```
+
+
+
## AI Agents Flow
diff --git a/docs/installation.mdx b/docs/installation.mdx
index 0e50c7ff..29b85849 100644
--- a/docs/installation.mdx
+++ b/docs/installation.mdx
@@ -14,6 +14,9 @@ pip install praisonai
```bash JavaScript
npm install praisonai
```
+```bash TypeScript
+npm install praisonai
+```
@@ -109,6 +112,22 @@ Follow these steps to set up PraisonAI in your development environment.
+
+
+
+ Install the PraisonAI package:
+ ```bash
+ npm install praisonai
+ ```
+
+
+ Set your OpenAI API key as an environment variable in your terminal:
+ ```bash
+ export OPENAI_API_KEY=your_openai_key
+ ```
+
+
+
Generate your OpenAI API key from [OpenAI](https://platform.openai.com/api-keys)
diff --git a/docs/introduction.mdx b/docs/introduction.mdx
index 8e716cff..4944ad81 100644
--- a/docs/introduction.mdx
+++ b/docs/introduction.mdx
@@ -248,6 +248,68 @@ agents.start();
+
+
+
+
+ ```bash npm
+ npm install praisonai
+ ```
+ ```bash yarn
+ yarn add praisonai
+ ```
+
+
+
+ ```bash
+ export OPENAI_API_KEY=xxxxxxxxxxxxxxxxxxxxxx
+ ```
+
+
+ Create `app.ts` file
+
+ ## Code Example
+
+
+```javascript Single Agent
+import { Agent } from 'praisonai';
+
+const agent = new Agent({
+ instructions: `You are a creative writer who writes short stories with emojis.`,
+ name: "StoryWriter"
+});
+
+agent.start("Write a story about a time traveler")
+```
+
+```javascript Multi Agents
+import { Agent, PraisonAIAgents } from 'praisonai';
+
+const storyAgent = new Agent({
+ instructions: "Generate a very short story (2-3 sentences) about artificial intelligence with emojis.",
+ name: "StoryAgent"
+});
+
+const summaryAgent = new Agent({
+ instructions: "Summarize the provided AI story in one sentence with emojis.",
+ name: "SummaryAgent"
+});
+
+const agents = new PraisonAIAgents({
+ agents: [storyAgent, summaryAgent]
+});
+
+agents.start()
+```
+
+
+
+ ```bash
+ npx ts-node app.ts
+ ```
+
+
+
## Key Features
diff --git a/docs/js/customtools.mdx b/docs/js/customtools.mdx
new file mode 100644
index 00000000..61fd685b
--- /dev/null
+++ b/docs/js/customtools.mdx
@@ -0,0 +1,50 @@
+---
+title: "Custom Tools for TypeScript AI Agents"
+sidebarTitle: "Custom Tools"
+description: "Learn how to create custom tools for TypeScript AI Agents"
+icon: "toolbox"
+---
+
+## Single Agent
+
+```typescript
+import { Agent } from 'praisonai';
+
+async function getWeather(location: string) {
+ console.log(`Getting weather for ${location}...`);
+ return `${Math.floor(Math.random() * 30)}°C`;
+}
+
+const agent = new Agent({
+ instructions: `You provide the current weather for requested locations.`,
+ name: "DirectFunctionAgent",
+ tools: [getWeather]
+});
+
+agent.start("What's the weather in Paris, France?");
+```
+
+## Multi Agents
+
+```typescript
+import { Agent } from 'praisonai';
+
+async function getWeather(location: string) {
+ console.log(`Getting weather for ${location}...`);
+ return `${Math.floor(Math.random() * 30)}°C`;
+}
+
+async function getTime(location: string) {
+ console.log(`Getting time for ${location}...`);
+ const now = new Date();
+ return `${now.getHours()}:${now.getMinutes()}`;
+}
+
+const agent = new Agent({
+ instructions: `You provide the current weather and time for requested locations.`,
+ name: "DirectFunctionAgent",
+ tools: [getWeather, getTime]
+});
+
+agent.start("What's the weather and time in Paris, France and Tokyo, Japan?");
+```
\ No newline at end of file
diff --git a/docs/js/typescript.mdx b/docs/js/typescript.mdx
index be92d39c..79685284 100644
--- a/docs/js/typescript.mdx
+++ b/docs/js/typescript.mdx
@@ -268,74 +268,12 @@ agents.start()
## Tool Calls Examples
-
- Create an agent that can use tools to get information:
-
-```typescript
-import { Agent } from 'praisonai';
-
-/**
- * Example of a simple agent with tool calling capability
- *
- * This example demonstrates how to create a simple agent that can use tools
- * to get weather information for a location.
- */
-
-// Define a weather tool
-const getWeather = {
- type: "function",
- function: {
- name: "get_weather",
- description: "Get current temperature for a given location.",
- parameters: {
- type: "object",
- properties: {
- location: {
- type: "string",
- description: "City and country e.g. Bogotá, Colombia"
- }
- },
- required: ["location"],
- additionalProperties: false
- },
- strict: true
- }
-};
-
-// Make the function globally available
-// The agent will automatically find and use this function
-(global as any).get_weather = async function(location: string) {
- console.log(`Getting weather for ${location}...`);
- return `20°C`;
-};
-
-// Create an agent with the weather tool
-const agent = new Agent({
- instructions: `You provide the current weather for requested locations.`,
- name: "WeatherAgent",
- tools: [getWeather]
-});
-
-// Start the agent with a prompt that will trigger tool usage
-agent.start("What's the weather in Paris, France?");
-```
-
-
Create an agent with directly registered function tools:
```typescript
import { Agent } from 'praisonai';
-/**
- * Example of a simple agent with direct function registration
- *
- * This example demonstrates how to create a simple agent that uses directly
- * registered functions as tools without having to define tool schemas manually
- * or make functions globally available.
- */
-
-// Define the functions directly
async function getWeather(location: string) {
console.log(`Getting weather for ${location}...`);
return `${Math.floor(Math.random() * 30)}°C`;
@@ -347,15 +285,12 @@ async function getTime(location: string) {
return `${now.getHours()}:${now.getMinutes()}`;
}
-// Create an agent with directly registered functions
const agent = new Agent({
instructions: `You provide the current weather and time for requested locations.`,
name: "DirectFunctionAgent",
- // Register functions directly as an array without needing to make them global
tools: [getWeather, getTime]
});
-// Start the agent with a prompt that will trigger tool usage
agent.start("What's the weather and time in Paris, France and Tokyo, Japan?");
```
diff --git a/docs/mint.json b/docs/mint.json
index 21905a35..121a07db 100644
--- a/docs/mint.json
+++ b/docs/mint.json
@@ -244,7 +244,14 @@
"group": "JavaScript",
"pages": [
"js/js",
- "js/typescript",
+ {
+ "group": "TypeScript Agents",
+ "icon": "subscript",
+ "pages": [
+ "js/typescript",
+ "js/customtools"
+ ]
+ },
"js/nodejs",
"js/typescript-async",
"js/development"
diff --git a/docs/quickstart.mdx b/docs/quickstart.mdx
index 60b7532f..3bcc9255 100644
--- a/docs/quickstart.mdx
+++ b/docs/quickstart.mdx
@@ -167,6 +167,68 @@ agents.start();
+
+
+
+
+ ```bash npm
+ npm install praisonai
+ ```
+ ```bash yarn
+ yarn add praisonai
+ ```
+
+
+
+ ```bash
+ export OPENAI_API_KEY=xxxxxxxxxxxxxxxxxxxxxx
+ ```
+
+
+ Create `app.ts` file
+
+ ## Code Example
+
+
+```javascript Single Agent
+import { Agent } from 'praisonai';
+
+const agent = new Agent({
+ instructions: `You are a creative writer who writes short stories with emojis.`,
+ name: "StoryWriter"
+});
+
+agent.start("Write a story about a time traveler")
+```
+
+```javascript Multi Agents
+import { Agent, PraisonAIAgents } from 'praisonai';
+
+const storyAgent = new Agent({
+ instructions: "Generate a very short story (2-3 sentences) about artificial intelligence with emojis.",
+ name: "StoryAgent"
+});
+
+const summaryAgent = new Agent({
+ instructions: "Summarize the provided AI story in one sentence with emojis.",
+ name: "SummaryAgent"
+});
+
+const agents = new PraisonAIAgents({
+ agents: [storyAgent, summaryAgent]
+});
+
+agents.start()
+```
+
+
+
+ ```bash
+ npx ts-node app.ts
+ ```
+
+
+
diff --git a/docs/tools/external/google-trends.mdx b/docs/tools/external/google-trends.mdx
new file mode 100644
index 00000000..36842c20
--- /dev/null
+++ b/docs/tools/external/google-trends.mdx
@@ -0,0 +1,29 @@
+
+
+```python
+import os
+from langchain_community.tools.google_trends import GoogleTrendsQueryRun
+from langchain_community.utilities.google_trends import GoogleTrendsAPIWrapper
+from praisonaiagents import Agent, PraisonAIAgents
+
+# Set your SerpApi API Key
+os.environ["SERPAPI_API_KEY"] = "your_serpapi_key_here"
+
+# Initialize the Google Trends API Wrapper and Tool
+google_trends_api_wrapper = GoogleTrendsAPIWrapper()
+google_trends_tool = GoogleTrendsQueryRun(api_wrapper=google_trends_api_wrapper)
+
+# Define your agents with appropriate tools
+research_agent = Agent(
+ instructions="Research trending topics related to AI",
+ tools=[google_trends_tool]
+)
+
+summarise_agent = Agent(
+ instructions="Summarise findings from the research agent",
+)
+
+# Instantiate and start your PraisonAIAgents
+agents = PraisonAIAgents(agents=[research_agent, summarise_agent])
+agents.start()
+```
\ No newline at end of file
diff --git a/src/praisonai-ts/examples/simple/direct-function-tools.ts b/src/praisonai-ts/examples/simple/direct-function-tools.ts
index a321aab2..9da3e024 100644
--- a/src/praisonai-ts/examples/simple/direct-function-tools.ts
+++ b/src/praisonai-ts/examples/simple/direct-function-tools.ts
@@ -1,14 +1,5 @@
import { Agent } from 'praisonai';
-/**
- * Example of a simple agent with direct function registration
- *
- * This example demonstrates how to create a simple agent that uses directly
- * registered functions as tools without having to define tool schemas manually
- * or make functions globally available.
- */
-
-// Define the functions directly
async function getWeather(location: string) {
console.log(`Getting weather for ${location}...`);
return `${Math.floor(Math.random() * 30)}°C`;
@@ -20,13 +11,10 @@ async function getTime(location: string) {
return `${now.getHours()}:${now.getMinutes()}`;
}
-// Create an agent with directly registered functions
const agent = new Agent({
instructions: `You provide the current weather and time for requested locations.`,
name: "DirectFunctionAgent",
- // Register functions directly as an array without needing to make them global
tools: [getWeather, getTime]
});
-// Start the agent with a prompt that will trigger tool usage
-agent.start("What's the weather and time in Paris, France and Tokyo, Japan?");
+agent.start("What's the weather and time in Paris, France and Tokyo, Japan?");
\ No newline at end of file
diff --git a/src/praisonai-ts/examples/simple/multi-agent-tools.ts b/src/praisonai-ts/examples/simple/multi-agent-tools.ts
new file mode 100644
index 00000000..8d550c3a
--- /dev/null
+++ b/src/praisonai-ts/examples/simple/multi-agent-tools.ts
@@ -0,0 +1,44 @@
+import { Agent, PraisonAIAgents } from 'praisonai';
+
+async function getWeather(location: string) {
+ console.log(`Getting weather for ${location}...`);
+ return `${Math.floor(Math.random() * 30)}°C`;
+}
+
+async function getTime(location: string) {
+ console.log(`Getting time for ${location}...`);
+ const now = new Date();
+ return `${now.getHours()}:${now.getMinutes()}`;
+}
+
+const weatherAgent = new Agent({
+ instructions: "You are a Weather Agent",
+ name: "WeatherAgent",
+ tools: [getWeather]
+});
+
+const timeAgent = new Agent({
+ instructions: "You are a Time Agent",
+ name: "TimeAgent",
+ tools: [getTime]
+});
+
+const agents = new PraisonAIAgents({
+ agents: [weatherAgent, timeAgent],
+ tasks: [
+ "Get the weather of London and express it in 5 lines with emojis",
+ "Get the time and express it in 5 lines with emojis"
+ ]
+});
+
+agents.start()
+ .then(results => {
+ console.log('\nFinal Results:');
+ console.log('\nWeather Task Results:');
+ console.log(results[0]);
+ console.log('\nTime Task Results:');
+ console.log(results[1]);
+ })
+ .catch(error => {
+ console.error('Error:', error);
+ });
\ No newline at end of file
diff --git a/src/praisonai-ts/examples/simple/task-based-agent-tools.ts b/src/praisonai-ts/examples/simple/task-based-agent-tools.ts
new file mode 100644
index 00000000..2a159a35
--- /dev/null
+++ b/src/praisonai-ts/examples/simple/task-based-agent-tools.ts
@@ -0,0 +1,51 @@
+import { Agent, PraisonAIAgents } from 'praisonai';
+
+async function getWeather(location: string) {
+ console.log(`Getting weather for ${location}...`);
+ return `${Math.floor(Math.random() * 30)}°C`;
+}
+
+async function getTime(location: string) {
+ console.log(`Getting time for ${location}...`);
+ const now = new Date();
+ return `${now.getHours()}:${now.getMinutes()}`;
+}
+
+// Create recipe agent
+const recipeAgent = new Agent({
+ instructions: `You are a Weather Agent`,
+ name: "WeatherAgent",
+ verbose: true,
+ tools: [getWeather]
+});
+
+// Create blog agent
+const blogAgent = new Agent({
+ instructions: `You are a Time Agent`,
+ name: "TimeAgent",
+ verbose: true,
+ tools: [getTime]
+});
+
+// Create PraisonAIAgents instance with tasks
+const agents = new PraisonAIAgents({
+ agents: [recipeAgent, blogAgent],
+ tasks: [
+ "Get the weather and express it in 5 lines with emojis",
+ "Get the time and express it in 5 lines with emojis"
+ ],
+ verbose: true
+});
+
+// Start the agents
+agents.start()
+ .then(results => {
+ console.log('\nFinal Results:');
+ console.log('\nWeather Task Results:');
+ console.log(results[0]);
+ console.log('\nTime Task Results:');
+ console.log(results[1]);
+ })
+ .catch(error => {
+ console.error('Error:', error);
+ });
diff --git a/src/praisonai-ts/package.json b/src/praisonai-ts/package.json
index d5425f85..bd8f49b2 100644
--- a/src/praisonai-ts/package.json
+++ b/src/praisonai-ts/package.json
@@ -62,7 +62,7 @@
"fast-xml-parser": "^4.5.1",
"node-fetch": "^2.6.9",
"openai": "^4.81.0",
- "praisonai": "^1.0.18"
+ "praisonai": "^1.0.19"
},
"optionalDependencies": {
"boxen": "^7.1.1",
diff --git a/src/praisonai-ts/src/tools/test.ts b/src/praisonai-ts/src/tools/test.ts
index e69de29b..8b137891 100644
--- a/src/praisonai-ts/src/tools/test.ts
+++ b/src/praisonai-ts/src/tools/test.ts
@@ -0,0 +1 @@
+
diff --git a/src/praisonai-ts/tests/development/simple/direct-function-tools.ts b/src/praisonai-ts/tests/development/simple/direct-function-tools.ts
index 0785b41a..3fb1cead 100644
--- a/src/praisonai-ts/tests/development/simple/direct-function-tools.ts
+++ b/src/praisonai-ts/tests/development/simple/direct-function-tools.ts
@@ -1,14 +1,5 @@
import { Agent } from '../../../src/agent/proxy';
-/**
- * Example of a simple agent with direct function registration
- *
- * This example demonstrates how to create a simple agent that uses directly
- * registered functions as tools without having to define tool schemas manually
- * or make functions globally available.
- */
-
-// Define the functions directly
async function getWeather(location: string) {
console.log(`Getting weather for ${location}...`);
return `${Math.floor(Math.random() * 30)}°C`;
@@ -20,13 +11,10 @@ async function getTime(location: string) {
return `${now.getHours()}:${now.getMinutes()}`;
}
-// Create an agent with directly registered functions
const agent = new Agent({
instructions: `You provide the current weather and time for requested locations.`,
name: "DirectFunctionAgent",
- // Register functions directly as an array without needing to make them global
tools: [getWeather, getTime]
});
-// Start the agent with a prompt that will trigger tool usage
-agent.start("What's the weather and time in Paris, France and Tokyo, Japan?");
+agent.start("What's the weather and time in Paris, France and Tokyo, Japan?");
\ No newline at end of file
diff --git a/src/praisonai-ts/tests/development/simple/multi-agent-tools.ts b/src/praisonai-ts/tests/development/simple/multi-agent-tools.ts
new file mode 100644
index 00000000..b10393f9
--- /dev/null
+++ b/src/praisonai-ts/tests/development/simple/multi-agent-tools.ts
@@ -0,0 +1,44 @@
+import { Agent, PraisonAIAgents } from '../../../src/agent/simple';
+
+async function getWeather(location: string) {
+ console.log(`Getting weather for ${location}...`);
+ return `${Math.floor(Math.random() * 30)}°C`;
+}
+
+async function getTime(location: string) {
+ console.log(`Getting time for ${location}...`);
+ const now = new Date();
+ return `${now.getHours()}:${now.getMinutes()}`;
+}
+
+const weatherAgent = new Agent({
+ instructions: "You are a Weather Agent",
+ name: "WeatherAgent",
+ tools: [getWeather]
+});
+
+const timeAgent = new Agent({
+ instructions: "You are a Time Agent",
+ name: "TimeAgent",
+ tools: [getTime]
+});
+
+const agents = new PraisonAIAgents({
+ agents: [weatherAgent, timeAgent],
+ tasks: [
+ "Get the weather of London and express it in 5 lines with emojis",
+ "Get the time and express it in 5 lines with emojis"
+ ]
+});
+
+agents.start()
+ .then(results => {
+ console.log('\nFinal Results:');
+ console.log('\nWeather Task Results:');
+ console.log(results[0]);
+ console.log('\nTime Task Results:');
+ console.log(results[1]);
+ })
+ .catch(error => {
+ console.error('Error:', error);
+ });
\ No newline at end of file
diff --git a/src/praisonai-ts/tests/development/simple/task-based-agent-tools.ts b/src/praisonai-ts/tests/development/simple/task-based-agent-tools.ts
new file mode 100644
index 00000000..3abe7204
--- /dev/null
+++ b/src/praisonai-ts/tests/development/simple/task-based-agent-tools.ts
@@ -0,0 +1,51 @@
+import { Agent, PraisonAIAgents } from '../../../src/agent/simple';
+
+async function getWeather(location: string) {
+ console.log(`Getting weather for ${location}...`);
+ return `${Math.floor(Math.random() * 30)}°C`;
+}
+
+async function getTime(location: string) {
+ console.log(`Getting time for ${location}...`);
+ const now = new Date();
+ return `${now.getHours()}:${now.getMinutes()}`;
+}
+
+// Create recipe agent
+const recipeAgent = new Agent({
+ instructions: `You are a Weather Agent`,
+ name: "WeatherAgent",
+ verbose: true,
+ tools: [getWeather]
+});
+
+// Create blog agent
+const blogAgent = new Agent({
+ instructions: `You are a Time Agent`,
+ name: "TimeAgent",
+ verbose: true,
+ tools: [getTime]
+});
+
+// Create PraisonAIAgents instance with tasks
+const agents = new PraisonAIAgents({
+ agents: [recipeAgent, blogAgent],
+ tasks: [
+ "Get the weather and express it in 5 lines with emojis",
+ "Get the time and express it in 5 lines with emojis"
+ ],
+ verbose: true
+});
+
+// Start the agents
+agents.start()
+ .then(results => {
+ console.log('\nFinal Results:');
+ console.log('\nWeather Task Results:');
+ console.log(results[0]);
+ console.log('\nTime Task Results:');
+ console.log(results[1]);
+ })
+ .catch(error => {
+ console.error('Error:', error);
+ });