-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Human-in-the-Loop (HITL) Implementation for Enhanced Task Oversight This PR implements Human-in-the-Loop (HITL) support to allow for manual intervention in tasks that require human oversight, addressing [issue #35](#35). The changes enhance AgenticJS's ability to handle complex tasks that benefit from human judgment while maintaining automated efficiency. ## Key Changes: 1. **AgentsBoardDebugger Component**: Added functionality for providing feedback and validating tasks, including UI elements for task selection, feedback entry, and submission. 2. **React Playground**: Added a new story for ResumeCreationTeam with HITL integration using OpenAI models. 3. **Agent and Task Classes**: Updated with new methods for workflow management, feedback provision, and task validation. 4. **Task and Team Stores**: Implemented new enums and logic for handling task completion, errors, validation, and feedback processing. 5. **Workflow Controller**: Added helper function to check agent availability and manage task status transitions. 6. **Subscribers**: Updated taskSubscriber and teamSubscriber to support new task statuses and provide more specific status messages. 7. **Enums**: Added new enums for feedback and task statuses (AWAITING_VALIDATION, VALIDATED, PENDING, PROCESSED). 8. **Test Updates**: Modified various test files to reflect new HITL functionality, including updates to snapshots and the addition of new test cases for OpenAI agents with HITL features. 9. **API Mocks**: Updated request/response mocks for OpenAI and Gemini to support HITL testing scenarios. 10. **Utility Updates**: Enhanced moscaFetch function to improve request body comparison accuracy in tests. These changes collectively implement a robust HITL system within AgenticJS, allowing for seamless integration of human oversight in AI-driven workflows. This enhancement improves the accuracy, reliability, and ethical considerations of complex or sensitive operations managed by the library.
- Loading branch information
Showing
31 changed files
with
58,603 additions
and
12,949 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"presets": ["@babel/preset-env"], | ||
"plugins": ["@babel/plugin-syntax-import-meta"] | ||
// "presets": ["@babel/preset-env"], | ||
// "plugins": ["@babel/plugin-syntax-import-meta"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
playground/react/src/teams/resume_creation/openai_with_hitl.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { Agent, Task, Team } from 'agenticjs'; | ||
|
||
// Define agents | ||
const profileAnalyst = new Agent({ | ||
name: 'Mary', | ||
role: 'Profile Analyst', | ||
goal: 'Extract structured information from conversational user input.', | ||
background: 'Data Processor', | ||
tools: [] // Tools are omitted for now | ||
}); | ||
|
||
const resumeWriter = new Agent({ | ||
name: 'Alex Mercer', | ||
role: 'Resume Writer', | ||
goal: `Craft compelling, well-structured resumes | ||
that effectively showcase job seekers qualifications and achievements.`, | ||
background: `Extensive experience in recruiting, | ||
copywriting, and human resources, enabling | ||
effective resume design that stands out to employers.`, | ||
tools: [] | ||
}); | ||
|
||
// Define tasks | ||
const processingTask = new Task({ | ||
description: `Extract relevant details such as name, | ||
experience, skills, and job history from the user's 'aboutMe' input. | ||
aboutMe: {aboutMe}`, | ||
expectedOutput: 'Structured data ready to be used for a resume creation.', | ||
agent: profileAnalyst, | ||
externalValidationRequired: true | ||
}); | ||
|
||
const resumeCreationTask = new Task({ | ||
description: `Utilize the structured data to create | ||
a detailed and attractive resume. | ||
Enrich the resume content by inferring additional details from the provided information. | ||
Include sections such as a personal summary, detailed work experience, skills, and educational background.`, | ||
expectedOutput: `A professionally formatted resume in markdown format, | ||
ready for submission to potential employers.`, | ||
agent: resumeWriter | ||
}); | ||
|
||
// Create a team | ||
const team = new Team({ | ||
name: 'Resume Creation Team', | ||
agents: [profileAnalyst, resumeWriter], | ||
tasks: [processingTask, resumeCreationTask], | ||
inputs: { aboutMe: `My name is David Llaca. | ||
JavaScript Developer for 5 years. | ||
I worked for three years at Disney, | ||
where I developed user interfaces for their primary landing pages | ||
using React, NextJS, and Redux. Before Disney, | ||
I was a Junior Front-End Developer at American Airlines, | ||
where I worked with Vue and Tailwind. | ||
I earned a Bachelor of Science in Computer Science from FIU in 2018, | ||
and I completed a JavaScript bootcamp that same year.` }, // Initial input for the first task | ||
env: {OPENAI_API_KEY: import.meta.env.VITE_OPENAI_API_KEY, ANTHROPIC_API_KEY: import.meta.env.VITE_ANTHROPIC_API_KEY} | ||
}); | ||
|
||
export default team; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.