Full agent admin via API and UI
This commit is contained in:
1 parent
5351144edf
commit
08f0668997
7 files changed
+389
-32
No files matched your search
+45
-8
@@ -64,28 +64,65 @@ async function runTest() {
|
||||
await send('get-chats')
|
||||
);
|
||||
|
||||
console.log("Create Agent",
|
||||
await send('create-agent', {body: {
|
||||
name: 'First Agent',
|
||||
description: 'First agent does nothing',
|
||||
kind: 'simple',
|
||||
data: {}
|
||||
}})
|
||||
console.log("Agent Kinds",
|
||||
await send('get-agent-kinds')
|
||||
);
|
||||
|
||||
let createAgentResponse = await send('create-agent', {body: {
|
||||
name: 'First Agent',
|
||||
description: 'First agent does nothing',
|
||||
kind: 'basic',
|
||||
data: {}
|
||||
}});
|
||||
console.log("Create Agent", createAgentResponse);
|
||||
|
||||
let agents = (await send('get-agents')).agents;
|
||||
console.log("Get Agents", agents);
|
||||
|
||||
let mainAgentId = createAgentResponse.agentId;
|
||||
let mainAgent = agents.find(agent => agent.id == mainAgentId)
|
||||
|
||||
if (USE_LLM) {
|
||||
let promptResponse = await send('send-agent-prompt', {
|
||||
body: {
|
||||
agentId: agents[0].id,
|
||||
agentId: mainAgentId,
|
||||
content: "Hello World!",
|
||||
}
|
||||
});
|
||||
console.log("Prompt Response", promptResponse);
|
||||
}
|
||||
|
||||
// Update agent
|
||||
console.log("Updating agent...");
|
||||
await send('update-agent', {
|
||||
body: {
|
||||
agentId: mainAgentId,
|
||||
name: mainAgent.name + " (UPDATED)",
|
||||
description: "This is a placeholder description for the agent.",
|
||||
data: {
|
||||
system_prompt: "first system prompt",
|
||||
// These are not config fields for 'basic' agent, they cannot be seen by the user
|
||||
field1: "some data",
|
||||
field2: "more data",
|
||||
},
|
||||
}
|
||||
});
|
||||
await send('update-agent', {
|
||||
body: {
|
||||
agentId: mainAgentId,
|
||||
data: {
|
||||
system_prompt: "second system prompt",
|
||||
field2: "replaced data",
|
||||
},
|
||||
}
|
||||
});
|
||||
console.log("Updated Agent:", (
|
||||
(await send('get-agents')).agents.find(agent => agent.id == mainAgentId)
|
||||
));
|
||||
console.log("Agent Data:", (
|
||||
(await send('get-agent-config-fields', {body: {agentId: mainAgentId}}))
|
||||
));
|
||||
|
||||
await testChats();
|
||||
|
||||
process.exit();
|
||||
|
||||
Reference in new issue
Block a user