Las traducciones son generadas a través de traducción automática. En caso de conflicto entre la traducción y la version original de inglés, prevalecerá la version en inglés.
En los siguientes ejemplos de código, se muestra cómo utilizar DeleteAgent
.
Los ejemplos de acciones son extractos de código de programas más grandes y deben ejecutarse en contexto. Puede ver esta acción en contexto en el siguiente ejemplo de código:
- SDK para JavaScript (v3)
-
nota
Hay más información. GitHub Busque el ejemplo completo y aprenda a configurar y ejecutar en el Repositorio de ejemplos de código de AWS
. Elimine un agente.
import { fileURLToPath } from "node:url"; import { checkForPlaceholders } from "../lib/utils.js"; import { BedrockAgentClient, DeleteAgentCommand, } from "@aws-sdk/client-bedrock-agent"; /** * Deletes an Amazon Bedrock Agent. * * @param {string} agentId - The unique identifier of the agent to delete. * @param {string} [region='us-east-1'] - The AWS region in use. * @returns {Promise<import("@aws-sdk/client-bedrock-agent").DeleteAgentCommandOutput>} An object containing the agent id, the status, and some additional metadata. */ export const deleteAgent = (agentId, region = "us-east-1") => { const client = new BedrockAgentClient({ region }); const command = new DeleteAgentCommand({ agentId }); return client.send(command); }; // Invoke main function if this file was run directly. if (process.argv[1] === fileURLToPath(import.meta.url)) { // Replace the placeholders for agentId with an existing agent's id. // Ensure to remove the brackets (`[]`) before adding your data. // The agentId must be an alphanumeric string with exactly 10 characters. const agentId = "[ABC123DE45]"; // Check for unresolved placeholders in agentId. checkForPlaceholders([agentId]); console.log(`Deleting agent with ID ${agentId}...`); const response = await deleteAgent(agentId); console.log(response); }
-
Para obtener más información sobre la API, consulta DeleteAgentla Referencia AWS SDK for JavaScript de la API.
-
Para obtener una lista completa de las guías para desarrolladores del AWS SDK y ejemplos de código, consulte. Uso de Amazon Bedrock con un SDK AWS En este tema también se incluye información sobre cómo comenzar a utilizar el SDK y detalles sobre sus versiones anteriores.