-
Notifications
You must be signed in to change notification settings - Fork 637
CreateAgentCommand not saving the bedrock agent !! #7296
Unanswered
rr-jino-jose
asked this question in
Q&A
-
hello I was trying out this code
/**
* Create a Bedrock Agent
*/
export async function createBedrockAgent({
name,
description = "",
instruction,
model,
resourceRoleArn,
userId = "anonymous",
userName = "Anonymous User",
}: CreateAgentParams): Promise<AgentResponse> {
try {
const command = new CreateAgentCommand({
agentName: name,
description,
idleSessionTTLInSeconds: 3600, // 1 hour idle timeout
instruction,
agentResourceRoleArn: resourceRoleArn,
foundationModel: model,
tags: {
"owner": userName,
"owner_id": userId,
"created_at": new Date().toISOString()
},
memoryConfiguration: {
enabledMemoryTypes: ["SESSION_SUMMARY"],
storageDays: 10,
sessionSummaryConfiguration: {
maxRecentSessions: 20
}
}
});
const response = await client.send(command);
if (!response.agent?.agentId) {
throw new Error("Failed to create agent: No agentId in response");
}
const agentId = response.agent.agentId;
return {
agentId,
agentName: response.agent.agentName || "",
description: response.agent.description || "",
status: "online",
agentAliasId: "", // new agents don't have aliases yet
};
} catch (error) {
logger.errorLog(`Error creating Bedrock agent: ${error}`);
throw error;
}
}
It does creates the agent but doesn't save the configuration, similar to the one in console button "save". I am not providing any resourceRoleARN and let aws create it. But to prepare I need to save the agent !! ... Am i missing something ?? Any help is appreciated. Thanks.
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment
-
Hello! Reopening this discussion to make it searchable.
Beta Was this translation helpful? Give feedback.
All reactions
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment