Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
19 changes: 18 additions & 1 deletion .github/composite-actions/cypress-e2e/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,24 @@ runs:
shell: bash
env:
INKEEP_API_KEY: ${{ env.INKEEP_AGENTS_MANAGE_API_BYPASS_SECRET }}
run: cd agents-cookbook/template-projects && npx inkeep push --project weather-project
run: |
max_attempts=3
attempt=1
while [ $attempt -le $max_attempts ]; do
echo "Push attempt $attempt/$max_attempts..."
if cd agents-cookbook/template-projects && npx inkeep push --project weather-project; then
echo "Push succeeded on attempt $attempt"
break
fi
if [ $attempt -eq $max_attempts ]; then
echo "Push failed after $max_attempts attempts"
exit 1
fi
echo "Push failed, retrying in $((attempt * 5)) seconds..."
sleep $((attempt * 5))
cd "$GITHUB_WORKSPACE"
attempt=$((attempt + 1))
done

- name: Run Cypress E2E Tests
shell: bash
Expand Down
3 changes: 2 additions & 1 deletion agents-manage-ui/cypress/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export default defineConfig({
'--disable-dev-shm-usage',
'--disable-gpu',
'--no-sandbox',
'--disable-features=IsolateOrigins,site-per-process'
'--disable-features=IsolateOrigins,site-per-process',
'--js-flags=--max-old-space-size=4096'
);
}
return launchOptions;
Expand Down
28 changes: 28 additions & 0 deletions agents-manage-ui/cypress/e2e/agent-prompt.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/// <reference types="cypress" />

describe('Agent Prompt', () => {
it('should suggest autocomplete in prompt editor from context variables editor and headers JSON schema editor', () => {
cy.visit('/default/projects/my-weather-project/agents/weather-agent?pane=agent');

cy.typeInMonaco('contextVariables.json', '{"contextVariablesValue":123}');
const headersJsonSchema = {
type: 'object',
properties: {
testHeadersJsonSchemaValue: { type: 'string' },
},
};
cy.typeInMonaco('headersSchema.json', JSON.stringify(headersJsonSchema));
cy.contains('Save changes').click();

cy.typeInMonaco('agent-prompt.template', '{');
cy.get('[aria-label=Suggest]').contains('contextVariablesValue');
cy.get('[aria-label=Suggest]').contains('headers.testHeadersJsonSchemaValue');
cy.get('[aria-label=Suggest]').contains('$env.');
});

it('should highlight as error unknown variables', () => {
cy.visit('/default/projects/my-weather-project/agents/weather-agent?pane=agent');
cy.typeInMonaco('agent-prompt.template', 'Hello {{unknown}} {{$env.MY_ENV}}');
cy.get('.squiggly-error').should('have.length', 1);
});
});
67 changes: 67 additions & 0 deletions agents-manage-ui/cypress/e2e/agent-tools.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/// <reference types="cypress" />

import { generateId } from '../../src/lib/utils/id-utils';

function dragNode(selector: string) {
const dataTransfer = new DataTransfer();
cy.get(selector).trigger('dragstart', { dataTransfer, force: true });

cy.get('.react-flow__node-agent')
.eq(0)
.trigger('dragover', { dataTransfer, force: true })
.trigger('drop', { dataTransfer, force: true });
}
function connectEdge(selector: string) {
cy.get(selector).trigger('mousedown', { button: 0, force: true });
cy.get('[data-handleid="target-agent"]')
.trigger('mousemove', { force: true })
.trigger('mouseup', { force: true });
}

describe('Agent Tools', () => {
it('Editing sub-agent ID should not removes linked tools', () => {
cy.visit('/default/projects/my-weather-project');
cy.contains('Create agent').click();
cy.get('[name=name]').type(generateId(), { delay: 0 });
cy.get('button[type=submit]').click();
cy.get('.react-flow__node').should('exist');

dragNode('[aria-label="Drag Function Tool node"]');
connectEdge('[data-handleid="target-function-tool"]');
cy.typeInMonaco('code.jsx', 'function () {}');
dragNode('[aria-label="Drag MCP node"]');
cy.contains('Geocode address').click();
connectEdge('[data-handleid="target-mcp"]');
saveAndAssert();
cy.get('.react-flow__node-agent').click();
cy.get('[name=id]').clear().type('TEST', { delay: 0 });
saveAndAssert();

function saveAndAssert() {
cy.contains('Save changes').click();
cy.contains('Agent saved').should('exist');
cy.reload();
cy.get('.react-flow__node').should('have.length', 3);
}
});

describe('Format', () => {
it('JSON', () => {
const uri = 'contextVariables.json';

cy.visit('/default/projects/my-weather-project/agents/weather-agent?pane=agent');
cy.typeInMonaco(uri, '{"foo":123}');
cy.contains('Format').click();
cy.assertMonacoContent(uri, '{\n "foo": 123\n}');
});
it('JavaScript', () => {
const uri = 'code.jsx';

cy.visit('/default/projects/my-weather-project/agents/weather-agent?pane=agent');
dragNode('[aria-label="Drag Function Tool node"]');
cy.typeInMonaco(uri, 'function(){return"foo"}');
cy.contains('Format').click();
cy.assertMonacoContent(uri, 'function() { return "foo" }');
});
});
});
89 changes: 0 additions & 89 deletions agents-manage-ui/cypress/e2e/agent.cy.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,5 @@
/// <reference types="cypress" />

import { generateId } from '../../src/lib/utils/id-utils';

function dragNode(selector: string) {
const dataTransfer = new DataTransfer();
cy.get(selector).trigger('dragstart', { dataTransfer });

cy.get('.react-flow__node-agent')
.eq(0)
.trigger('dragover', { dataTransfer })
.trigger('drop', { dataTransfer });
}
function connectEdge(selector: string) {
cy.get(selector).trigger('mousedown', { button: 0 });
cy.get('[data-handleid="target-agent"]').trigger('mousemove').trigger('mouseup');
}

describe('Agent', () => {
describe('Unsaved changes dialog', () => {
beforeEach(() => {
Expand Down Expand Up @@ -55,77 +39,4 @@ describe('Agent', () => {
cy.location('pathname').should('eq', '/default/projects');
});
});

describe('Prompt', () => {
it('should suggest autocomplete in prompt editor from context variables editor and headers JSON schema editor', () => {
cy.visit('/default/projects/my-weather-project/agents/weather-agent?pane=agent');

cy.typeInMonaco('contextVariables.json', '{"contextVariablesValue":123}');
const headersJsonSchema = {
type: 'object',
properties: {
testHeadersJsonSchemaValue: { type: 'string' },
},
};
cy.typeInMonaco('headersSchema.json', JSON.stringify(headersJsonSchema));
cy.contains('Save changes').click();

cy.typeInMonaco('agent-prompt.template', '{');
cy.get('[aria-label=Suggest]').contains('contextVariablesValue');
cy.get('[aria-label=Suggest]').contains('headers.testHeadersJsonSchemaValue');
cy.get('[aria-label=Suggest]').contains('$env.');
});

it('should highlight as error unknown variables', () => {
cy.visit('/default/projects/my-weather-project/agents/weather-agent?pane=agent');
cy.typeInMonaco('agent-prompt.template', 'Hello {{unknown}} {{$env.MY_ENV}}');
cy.get('.squiggly-error').should('have.length', 1);
});
});

it('Editing sub-agent ID should not removes linked tools', () => {
cy.visit('/default/projects/my-weather-project');
cy.contains('Create agent').click();
cy.get('[name=name]').type(generateId(), { delay: 0 });
cy.get('button[type=submit]').click();
cy.get('.react-flow__node').should('exist');

dragNode('[aria-label="Drag Function Tool node"]');
connectEdge('[data-handleid="target-function-tool"]');
cy.typeInMonaco('code.jsx', 'function () {}');
dragNode('[aria-label="Drag MCP node"]');
cy.contains('Geocode address').click();
connectEdge('[data-handleid="target-mcp"]');
saveAndAssert();
cy.get('.react-flow__node-agent').click();
cy.get('[name=id]').clear().type('TEST', { delay: 0 });
saveAndAssert();

function saveAndAssert() {
cy.contains('Save changes').click();
cy.contains('Agent saved').should('exist');
cy.reload();
cy.get('.react-flow__node').should('have.length', 3);
}
});

describe('Format', () => {
it('JSON', () => {
const uri = 'contextVariables.json';

cy.visit('/default/projects/my-weather-project/agents/weather-agent?pane=agent');
cy.typeInMonaco(uri, '{"foo":123}');
cy.contains('Format').click();
cy.assertMonacoContent(uri, '{\n "foo": 123\n}');
});
it('JavaScript', () => {
const uri = 'code.jsx';

cy.visit('/default/projects/my-weather-project/agents/weather-agent?pane=agent');
dragNode('[aria-label="Drag Function Tool node"]');
cy.typeInMonaco(uri, 'function(){return"foo"}');
cy.contains('Format').click();
cy.assertMonacoContent(uri, 'function() { return "foo" }');
});
});
});
4 changes: 2 additions & 2 deletions agents-manage-ui/src/lib/api/api-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ async function makeApiRequestInternal<T>(
'Content-Type': 'application/json',
...options.headers,
...(cookieHeader && { Cookie: cookieHeader }),
...(process.env.INKEEP_AGENTS_API_BYPASS_SECRET && {
Authorization: `Bearer ${process.env.INKEEP_AGENTS_API_BYPASS_SECRET}`,
...(process.env.INKEEP_AGENTS_MANAGE_API_BYPASS_SECRET && {
Authorization: `Bearer ${process.env.INKEEP_AGENTS_MANAGE_API_BYPASS_SECRET}`,
}),
};

Expand Down