Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Sequential and hierarchy tasks execution - Included STOP/PAUSE/RESUME features from anthonydevs17 #199

Open
wants to merge 33 commits into
base: workflows-v2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
64f815e
feat(workflow): add pause and resume functionality to team workflow
anthonydevs17 Jan 4, 2025
9662c83
remove logs
anthonydevs17 Jan 4, 2025
1ca477c
feat(agent): add pause handling to ReactChampionAgent workflow
anthonydevs17 Jan 5, 2025
94c5e78
feat(workflow): implement stop functionality for team workflow
anthonydevs17 Jan 6, 2025
ac46726
feat(workflow): enhance workflow control with pause, resume, and stop…
anthonydevs17 Jan 8, 2025
c30a39d
Merge branch 'main' of https://github.com/kaiban-ai/KaibanJS into pau…
anthonydevs17 Jan 8, 2025
5ca097f
fix(tools): update README formatting for better readability
anthonydevs17 Jan 8, 2025
ea3f631
Merge branch 'main' of https://github.com/kaiban-ai/KaibanJS into pau…
anthonydevs17 Jan 13, 2025
5b15c1f
feat(workflow): streamline workflow management with enhanced pause, r…
anthonydevs17 Jan 16, 2025
ce70eb3
feat(tests): update snapshots to include currentIterations and lastFe…
anthonydevs17 Jan 16, 2025
d4a7e7f
docs: remove redundant newline in README.md
anthonydevs17 Jan 16, 2025
9192ed7
feat: enhance ESLint and Jest configurations, update dependencies, an…
ernestocarrasco Jan 18, 2025
b10e551
refactor(reactChampionAgent): remove redundant pause check in handleL…
anthonydevs17 Jan 20, 2025
cc7f51b
Adjust task handling to follow the 'flux' pattern.
ernestocarrasco Jan 21, 2025
ca0b70a
feat(workflow): implement task pause functionality and enhance agent …
anthonydevs17 Jan 21, 2025
49b6101
feat(subscriber): add PAUSED state to task status updates
anthonydevs17 Jan 21, 2025
b9cc3ab
Merge remote-tracking branch 'anthonydevs17/pause-and-resume-agents-w…
ernestocarrasco Jan 22, 2025
ef4a6a0
feat(workflow): enhance agent state management and task queue handling
anthonydevs17 Jan 22, 2025
b6fc578
feat(tests): update snapshots with detailed lastFeedbackMessage for v…
anthonydevs17 Jan 22, 2025
8bf87f7
Handle concurrency of the exeuction of tasks by adding all tasks to a…
ernestocarrasco Jan 22, 2025
0be5753
Handle concurrency of the exeuction of tasks by adding all tasks to a…
ernestocarrasco Jan 22, 2025
d0228c7
rerun tests for eventPlanningTeam
ernestocarrasco Jan 22, 2025
4355b7e
remove some files from git
ernestocarrasco Jan 22, 2025
09a971c
Merge branch 'pause-and-resume-agents-workflow' of https://github.com…
ernestocarrasco Jan 22, 2025
3affc01
Adjust execution strategies to fix invalid calling to removed clearAg…
ernestocarrasco Jan 22, 2025
c8a44f1
Remove non-used workflowController
ernestocarrasco Jan 22, 2025
3dae6d1
Remove outdated unit tests for workflow execution
ernestocarrasco Jan 23, 2025
db13940
feat(agent): add workOnTaskResume method and integrate into workflow …
anthonydevs17 Jan 23, 2025
5326172
Merge branch 'pause-and-resume-agents-workflow' of https://github.com…
ernestocarrasco Jan 23, 2025
1bcb99d
Remove unused workflowController.js file
ernestocarrasco Jan 23, 2025
3c5ec3b
153 - Integrate pause/stop/resume features.
ernestocarrasco Jan 26, 2025
da6f605
Add some tests for STOP operation in sequential workflow execution.
ernestocarrasco Jan 26, 2025
b34ea78
Add some tests for STOP process in the hierarchyExecutionStrategy
ernestocarrasco Jan 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,6 @@ For more details on how to utilize observability features in KaibanJS, please vi
- [LLM-friendly Documentation](https://docs.kaibanjs.com/llms-full.txt) - Optimized for AI tools and coding assistants
- [Join Our Discord](https://www.kaibanjs.com/discord)


### Compatibility

KaibanJS aims to be compatible with major front-end frameworks like React, Vue, Angular, and NextJS, making it a versatile choice for developers. The JavaScript ecosystem is a "bit complex...". If you have any problems, please tell us and we'll help you fix them.
Expand Down
2 changes: 2 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ export default [
'@typescript-eslint/no-require-imports': 'off',
'react/react-in-jsx-scope': 'off',
'react/prop-types': 'off',
'jest/no-focused-tests': 'off',
'jest/no-disabled-tests': 'off',
},
},
];
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ module.exports = {
verbose: true, // Make Jest more verbose
silent: false, // Ensure Jest is not silent (though this is not directly related to console.log output)
// testMatch: [
// "**/tests/e2e/exampl/**/*.js"
// "**/tests/e2e/**/eventPlanningTeam.test.js"
// ], // Run tests only in the specific directory
};
2,738 changes: 1,915 additions & 823 deletions package-lock.json

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions packages/tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ npm install @kaibanjs/tools

Here's a list of all available tools. Click on the tool names to view their detailed documentation.

| Tool | Description | Documentation |
| ---------------- | ---------------------------------------------------------------------- | --------------------------------------- |
| Exa | AI-focused search engine using embeddings to organize web data | [README](src/exa/README.md) |
| Firecrawl | Web scraping service for extracting structured data | [README](src/firecrawl/README.md) |
| GitHub Issues | GitHub API integration for fetching and analyzing repository issues | [README](src/github-issues/README.md) |
| Jina URL to MD | Convert web content into clean, LLM-ready markdown using Jina.ai | [README](src/jina-url-to-markdown/README.md) |
| PDF Search | Extract and search content from PDF documents | [README](src/pdf-search/README.md) |
| Serper | Google Search API integration with support for multiple search types | [README](src/serper/README.md) |
| Simple RAG | Basic Retrieval-Augmented Generation implementation for Q&A | [README](src/simple-rag/README.md) |
| Tavily Search | AI-optimized search engine for comprehensive and accurate results | [README](src/tavily/README.md) |
| Text File Search | Search and analyze content within text files | [README](src/textfile-search/README.md) |
| Website Search | Semantic search within website content using RAG models | [README](src/website-search/README.md) |
| WolframAlpha | Computational intelligence engine for complex queries and calculations | [README](src/wolfram-alpha/README.md) |
| Zapier Webhook | Integration with Zapier for workflow automation | [README](src/zapier-webhook/README.md) |
| Make Webhook | Integration with Make (formerly Integromat) for workflow automation | [README](src/make-webhook/README.md) |
| Tool | Description | Documentation |
| ---------------- | ---------------------------------------------------------------------- | -------------------------------------------- |
| Exa | AI-focused search engine using embeddings to organize web data | [README](src/exa/README.md) |
| Firecrawl | Web scraping service for extracting structured data | [README](src/firecrawl/README.md) |
| GitHub Issues | GitHub API integration for fetching and analyzing repository issues | [README](src/github-issues/README.md) |
| Jina URL to MD | Convert web content into clean, LLM-ready markdown using Jina.ai | [README](src/jina-url-to-markdown/README.md) |
| PDF Search | Extract and search content from PDF documents | [README](src/pdf-search/README.md) |
| Serper | Google Search API integration with support for multiple search types | [README](src/serper/README.md) |
| Simple RAG | Basic Retrieval-Augmented Generation implementation for Q&A | [README](src/simple-rag/README.md) |
| Tavily Search | AI-optimized search engine for comprehensive and accurate results | [README](src/tavily/README.md) |
| Text File Search | Search and analyze content within text files | [README](src/textfile-search/README.md) |
| Website Search | Semantic search within website content using RAG models | [README](src/website-search/README.md) |
| WolframAlpha | Computational intelligence engine for complex queries and calculations | [README](src/wolfram-alpha/README.md) |
| Zapier Webhook | Integration with Zapier for workflow automation | [README](src/zapier-webhook/README.md) |
| Make Webhook | Integration with Make (formerly Integromat) for workflow automation | [README](src/make-webhook/README.md) |

## Development

Expand Down
55 changes: 48 additions & 7 deletions packages/tools/src/_utils/AgentWithToolPreviewer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,26 @@ export const AgentWithToolPreviewer = ({ team }) => {
}
};

const handlePauseResume = async () => {
try {
if (teamWorkflowStatus === 'PAUSED') {
team.resume();
} else {
team.pause();
}
} catch (error) {
console.error('Error pausing/resuming workflow:', error);
}
};

const handleStop = async () => {
try {
team.stop();
} catch (error) {
console.error('Error stopping workflow:', error);
}
};

if (!agents || agents.length === 0) {
return <div className="no-team-message">No agents available</div>;
}
Expand Down Expand Up @@ -130,13 +150,34 @@ export const AgentWithToolPreviewer = ({ team }) => {
rows={5}
spellCheck="false"
/>
<button
className={`start-button ${teamWorkflowStatus.toLowerCase()}`}
onClick={handleStartTeam}
disabled={teamWorkflowStatus === 'RUNNING'}
>
{teamWorkflowStatus === 'RUNNING' ? 'Running...' : 'Start Team'}
</button>
<div className="workflow-buttons">
<button
className={`start-button ${teamWorkflowStatus.toLowerCase()}`}
onClick={handleStartTeam}
disabled={
teamWorkflowStatus === 'RUNNING' ||
teamWorkflowStatus === 'PAUSED'
}
>
{teamWorkflowStatus === 'RUNNING' ? 'Running...' : 'Start Team'}
</button>

<button
className={`pause-resume-button ${teamWorkflowStatus.toLowerCase()}`}
onClick={handlePauseResume}
disabled={!['RUNNING', 'PAUSED'].includes(teamWorkflowStatus)}
>
{teamWorkflowStatus === 'PAUSED' ? 'Resume' : 'Pause'}
</button>

<button
className={`stop-button ${teamWorkflowStatus.toLowerCase()}`}
onClick={handleStop}
disabled={!['RUNNING', 'PAUSED'].includes(teamWorkflowStatus)}
>
Stop
</button>
</div>
</div>

<div className="workflow-status">
Expand Down
30 changes: 30 additions & 0 deletions packages/tools/src/_utils/tools_agent_preview.css
Original file line number Diff line number Diff line change
Expand Up @@ -248,3 +248,33 @@ pre {
.status-using_tool_end {
color: #2e7d32;
}

.workflow-buttons {
display: flex;
gap: 10px;
margin-top: 10px;
}

.pause-resume-button,
.stop-button {
padding: 8px 16px;
border-radius: 4px;
border: 1px solid #ccc;
cursor: pointer;
}

.pause-resume-button:disabled,
.stop-button:disabled {
opacity: 0.5;
cursor: not-allowed;
}

.pause-resume-button {
background-color: #f0ad4e;
color: white;
}

.stop-button {
background-color: #d9534f;
color: white;
}
18 changes: 17 additions & 1 deletion playground/react/src/AgentsBoardDebugger.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,23 @@ const AgentsBoardDebugger = ({ team, title = null }) => {
<button className="actionButton" onClick={startTeam}>
Start Workflow
</button>

<button
className="actionButton"
onClick={() => {
if (teamWorkflowStatus === 'PAUSED') {
team.resume();
} else if (teamWorkflowStatus === 'RUNNING') {
team.pause();
}
}}
>
{teamWorkflowStatus === 'PAUSED'
? 'Resume Workflow'
: 'Pause Workflow'}
</button>
<button className="actionButton" onClick={() => team.stop()}>
Stop Workflow
</button>
{teamWorkflowStatus === 'running_workflow' && <Spinner />}
</div>
</div>
Expand Down
4 changes: 4 additions & 0 deletions src/agents/baseAgent.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ class BaseAgent {
workOnTask(_task) {
throw new Error('workOnTask must be implemented by subclasses.');
}

workOnTaskResume(_task) {
throw new Error('workOnTaskResume must be implemented by subclasses.');
}
}

export { BaseAgent };
Loading