Files
twenty/packages/twenty-server/test/integration/metadata/suites/agent/failing-agent-deletion.integration-spec.ts
T
Félix Malfait 70a78aafe9 feat(ai): replace agent search with skills system (#16513)
## Summary

- Replace the agent search mechanism with a new skills-based system
- Add a `skills` module with predefined skill definitions that the AI
can load on demand
- Remove specialized agents (workflow-builder, data-manipulator,
dashboard-builder, metadata-builder, researcher), keeping only the
helper agent
- Add `recordReferences` to workflow creation tool for chip linking in
the UI

## Changes

### New Skills Module
- `skill-definitions.ts` - Contains 5 skill definitions with detailed
instructions
- `skills.service.ts` - Service to get skills by name
- `load-skill.tool.ts` - Tool for AI to load skills explicitly

### Removed
- `agent-search.tool.ts` - Replaced by skill loading
- Specialized agent definitions (converted to skills)

### Updated
- Chat execution now shows skill catalog in system prompt
- Workflow creation returns `recordReferences` for UI linking

## Test plan
- [ ] Verify AI can load skills using `load_skill` tool
- [ ] Verify skill content is returned correctly
- [ ] Verify workflow creation shows clickable chip in chat
- [ ] Verify helper agent still works
2025-12-12 06:51:25 +01:00

69 lines
1.8 KiB
TypeScript

import { faker } from '@faker-js/faker';
import { expectOneNotInternalServerErrorSnapshot } from 'test/integration/graphql/utils/expect-one-not-internal-server-error-snapshot.util';
import { deleteOneAgent } from 'test/integration/metadata/suites/agent/utils/delete-one-agent.util';
import { findAgents } from 'test/integration/metadata/suites/agent/utils/find-agents.util';
import {
eachTestingContextFilter,
type EachTestingContext,
} from 'twenty-shared/testing';
type TestContext = {
input: () => {
id: string;
};
};
type DeleteOneAgentTestingContext = EachTestingContext<TestContext>[];
describe('Agent deletion should fail', () => {
const failingAgentDeletionTestCases: DeleteOneAgentTestingContext = [
{
title: 'when deleting a non-existent agent',
context: {
input: () => ({
id: faker.string.uuid(),
}),
},
},
];
it.each(eachTestingContextFilter(failingAgentDeletionTestCases))(
'$title',
async ({ context }) => {
const { id } = context.input();
const { errors } = await deleteOneAgent({
expectToFail: true,
input: {
id,
},
});
expectOneNotInternalServerErrorSnapshot({ errors });
},
);
it('should fail when attempting to delete a standard agent', async () => {
const { data } = await findAgents({
expectToFail: false,
input: undefined,
gqlFields: 'id name isCustom',
});
const helperAgent = data.findManyAgents.find(
(agent) => agent.name === 'helper' && agent.isCustom === false,
);
expect(helperAgent).toBeDefined();
const { errors } = await deleteOneAgent({
expectToFail: true,
input: {
id: helperAgent!.id,
},
});
expectOneNotInternalServerErrorSnapshot({ errors });
});
});