rnadigital / agentcloud

Agent Cloud is like having your own GPT builder with a bunch extra goodies. The GUI features 1) RAG pipeline which can natively embed 260+ datasources 2) Create Conversational apps (like GPTs) 3) Create Multi Agent process automation apps (crewai) 4) Tools 5) Teams+user permissions. Get started fast with Docker and our install.sh
https://agentcloud.dev
GNU Affero General Public License v3.0
528 stars 111 forks source link

Make preferred agent optional in task creation #563

Closed tomlynchRNA closed 1 month ago

tomlynchRNA commented 1 month ago

RE this ticket, in sequential process, tasks are required to have a preferred agent.

If you switch to heirarchical process, it then complains that youre missing the manager model on crew.

When you reenable the old manager model code on frontend and make crews heirarchical with a patch like:

patch ```diff diff --git a/agent-backend/src/models/mongo.py b/agent-backend/src/models/mongo.py index 9ac860f9..6c011bd4 100644 --- a/agent-backend/src/models/mongo.py +++ b/agent-backend/src/models/mongo.py @@ -257,7 +257,7 @@ class Crew(BaseModel): model_config = ConfigDict(extra='ignore') tasks: Optional[List[PyObjectId]] = None agents: Optional[List[PyObjectId]] = None - process: Optional[Process] = Process.Sequential + process: Optional[Process] = Process.Hierarchical managerLLM: Optional[Model] = None functionCallingLLM: Optional[Callable] = None verbose: Optional[Union[int, bool]] = False diff --git a/webapp/src/components/CrewAppForm.tsx b/webapp/src/components/CrewAppForm.tsx index 854eae77..cb7df979 100644 --- a/webapp/src/components/CrewAppForm.tsx +++ b/webapp/src/components/CrewAppForm.tsx @@ -25,6 +25,7 @@ import { SharingMode } from 'struct/sharing'; import { Task } from 'struct/task'; import ToolTip from './shared/ToolTip'; +import ModelSelect from './models/ModelSelect'; export default function CrewAppForm({ agentChoices = [], @@ -157,7 +158,7 @@ export default function CrewAppForm({ name: e.target.name.value, description, // process: e.target.process.value, - process: ProcessImpl.SEQUENTIAL, + process: ProcessImpl.HIERARCHICAL, agents: agentsState.map(a => a.value), memory: appMemory, cache: appCache, @@ -561,7 +562,7 @@ export default function CrewAppForm({
*/} - {/* {}} modelFilter='llm' - />*/} + />
diff --git a/webapp/src/controllers/app.ts b/webapp/src/controllers/app.ts index 58bf7ea0..8ad8979e 100644 --- a/webapp/src/controllers/app.ts +++ b/webapp/src/controllers/app.ts @@ -1,20 +1,17 @@ 'use strict'; -import { deleteAsset } from '@api'; import { dynamicResponse } from '@dr'; import { cloneAssetInStorageProvider } from 'controllers/asset'; -import { getAccountByEmail, getAccountsById, pushAccountOrg, pushAccountTeam } from 'db/account'; +import { getAccountByEmail, getAccountsById } from 'db/account'; import { addAgent, getAgentById, getAgentsByTeam, updateAgent } from 'db/agent'; import { addApp, - deleteAppById, deleteAppByIdReturnApp, getAppById, getAppsByTeam, - updateApp, updateAppGetOldApp } from 'db/app'; -import { addAsset, attachAssetToObject, deleteAssetById, getAssetById } from 'db/asset'; +import { attachAssetToObject, deleteAssetById } from 'db/asset'; import { addCrew, updateCrew } from 'db/crew'; import { getDatasourcesByTeam } from 'db/datasource'; import { getModelById, getModelsByTeam } from 'db/model'; @@ -22,19 +19,15 @@ import { updateShareLinkPayload } from 'db/sharelink'; import { getTasksByTeam } from 'db/task'; import { getToolsByTeam } from 'db/tool'; import createAccount from 'lib/account/create'; -import StorageProviderFactory from 'lib/storage'; import { chainValidations } from 'lib/utils/validationutils'; import toObjectId from 'misc/toobjectid'; import { ObjectId } from 'mongodb'; -import path from 'path'; import { AppType } from 'struct/app'; -import { Asset, IconAttachment } from 'struct/asset'; +import { IconAttachment } from 'struct/asset'; import { CollectionName } from 'struct/db'; -import { ChatAppAllowedModels, ModelType } from 'struct/model'; +import { ChatAppAllowedModels } from 'struct/model'; import { SharingMode } from 'struct/sharing'; - -import { addTeamMember } from '../db/team'; -import Roles from '../lib/permissions/roles'; +import { ProcessImpl } from 'struct/crew'; export async function appsData(req, res, _next) { const [apps, tasks, tools, agents, models, datasources, teamMembers] = await Promise.all([ @@ -164,7 +157,7 @@ export async function addAppApi(req, res, next) { agents, memory, cache, - // managerModelId, + managerModelId, tasks, iconId, tags, @@ -296,8 +289,10 @@ export async function addAppApi(req, res, next) { agents: agents.map(toObjectId), process, verbose, - fullOutput: fullOutput === true - // managerModelId: toObjectId(managerModelId) + fullOutput: fullOutput === true, + ...(managerModelId && (process as ProcessImpl) === ProcessImpl.HIERARCHICAL + ? { managerModelId: toObjectId(managerModelId) } + : {}) }); } else { if (agentId) { @@ -391,7 +386,8 @@ export async function addAppApi(req, res, next) { permissions: sharePermissions, mode: sharingMode as SharingMode }, - ...(shareLinkShareId ? { shareLinkShareId } : {}) + ...(shareLinkShareId ? { shareLinkShareId } : {}), + ...(managerModelId ? { managerModelId: toObjectId(managerModelId) } : {}) }); if (shareLinkShareId) { @@ -429,7 +425,7 @@ export async function editAppApi(req, res, next) { agents, memory, cache, - // managerModelId, + managerModelId, tasks, iconId, tags, @@ -551,8 +547,8 @@ export async function editAppApi(req, res, next) { agents: agents.map(toObjectId), process, verbose, - fullOutput: fullOutput === true - // managerModelId: toObjectId(managerModelId) + fullOutput: fullOutput === true, + ...(managerModelId ? { managerModelId: toObjectId(managerModelId) } : {}) }); } else { if (agentId) { diff --git a/webapp/src/controllers/task.ts b/webapp/src/controllers/task.ts index 8f068f14..5934ef1f 100644 --- a/webapp/src/controllers/task.ts +++ b/webapp/src/controllers/task.ts @@ -151,7 +151,7 @@ export async function addTaskApi(req, res, next) { } }, { field: 'asyncExecution', validation: { ofType: 'boolean' } }, - { field: 'agentId', validation: { notEmpty: true, ofType: 'string' } }, + { field: 'agentId', validation: { ofType: 'string' } }, { field: 'iconId', validation: { ofType: 'string' } }, { field: 'context', @@ -289,7 +289,7 @@ export async function editTaskApi(req, res, next) { } }, { field: 'asyncExecution', validation: { ofType: 'boolean' } }, - { field: 'agentId', validation: { notEmpty: true, ofType: 'string' } }, + { field: 'agentId', validation: { ofType: 'string' } }, { field: 'context', validation: { ```

Youll then face issues that the manager agent has no name, make name optional, an error about it not having the agentcloud modifications to agent like self.socket_io, so on and so on. Seems pretty blocked because of our crewai fork changes.