clients/client-bedrock-agent/README.md
AWS SDK for JavaScript BedrockAgent Client for Node.js, Browser and React Native.
<p>Describes the API operations for creating and managing Amazon Bedrock agents.</p>To install this package, use the CLI of your favorite package manager:
npm install @aws-sdk/client-bedrock-agentyarn add @aws-sdk/client-bedrock-agentpnpm add @aws-sdk/client-bedrock-agentThe AWS SDK is modulized by clients and commands.
To send a request, you only need to import the BedrockAgentClient and
the commands you need, for example ListAgentsCommand:
// ES5 example
const { BedrockAgentClient, ListAgentsCommand } = require("@aws-sdk/client-bedrock-agent");
// ES6+ example
import { BedrockAgentClient, ListAgentsCommand } from "@aws-sdk/client-bedrock-agent";
To send a request:
send operation on the client, providing the command object as input.const client = new BedrockAgentClient({ region: "REGION" });
const params = { /** input parameters */ };
const command = new ListAgentsCommand(params);
We recommend using the await operator to wait for the promise returned by send operation as follows:
// async/await.
try {
const data = await client.send(command);
// process data.
} catch (error) {
// error handling.
} finally {
// finally.
}
You can also use Promise chaining.
client
.send(command)
.then((data) => {
// process data.
})
.catch((error) => {
// error handling.
})
.finally(() => {
// finally.
});
The aggregated client class is exported from the same package, but without the "Client" suffix.
BedrockAgent extends BedrockAgentClient and additionally supports all operations, waiters, and paginators as methods.
This style may be familiar to you from the AWS SDK for JavaScript v2.
If you are bundling the AWS SDK, we recommend using only the bare-bones client (BedrockAgentClient).
More details are in the blog post on
modular packages in AWS SDK for JavaScript.
import { BedrockAgent } from "@aws-sdk/client-bedrock-agent";
const client = new BedrockAgent({ region: "REGION" });
// async/await.
try {
const data = await client.listAgents(params);
// process data.
} catch (error) {
// error handling.
}
// Promises.
client
.listAgents(params)
.then((data) => {
// process data.
})
.catch((error) => {
// error handling.
});
// callbacks (not recommended).
client.listAgents(params, (err, data) => {
// process err and data.
});
When the service returns an exception, the error will include the exception information, as well as response metadata (e.g. request id).
try {
const data = await client.send(command);
// process data.
} catch (error) {
const { requestId, cfId, extendedRequestId } = error.$metadata;
console.log({ requestId, cfId, extendedRequestId });
/**
* The keys within exceptions are also parsed.
* You can access them by specifying exception names:
* if (error.name === 'SomeServiceException') {
* const value = error.specialKeyInException;
* }
*/
}
See also docs/ERROR_HANDLING.
Please use these community resources for getting help. We use GitHub issues for tracking bugs and feature requests, but have limited bandwidth to address them.
aws-sdk-js
on AWS Developer Blog.aws-sdk-js.To test your universal JavaScript code in Node.js, browser and react-native environments, visit our code samples repo.
This client code is generated automatically. Any modifications will be overwritten the next time the @aws-sdk/client-bedrock-agent package is updated.
To contribute to client you can check our generate clients scripts.
This SDK is distributed under the Apache License, Version 2.0, see LICENSE for more information.
Command API Reference / Input / Output
</details> <details> <summary> AssociateAgentKnowledgeBase </summary>Command API Reference / Input / Output
</details> <details> <summary> CreateAgent </summary>Command API Reference / Input / Output
</details> <details> <summary> CreateAgentActionGroup </summary>Command API Reference / Input / Output
</details> <details> <summary> CreateAgentAlias </summary>Command API Reference / Input / Output
</details> <details> <summary> CreateDataSource </summary>Command API Reference / Input / Output
</details> <details> <summary> CreateFlow </summary>Command API Reference / Input / Output
</details> <details> <summary> CreateFlowAlias </summary>Command API Reference / Input / Output
</details> <details> <summary> CreateFlowVersion </summary>Command API Reference / Input / Output
</details> <details> <summary> CreateKnowledgeBase </summary>Command API Reference / Input / Output
</details> <details> <summary> CreatePrompt </summary>Command API Reference / Input / Output
</details> <details> <summary> CreatePromptVersion </summary>Command API Reference / Input / Output
</details> <details> <summary> DeleteAgent </summary>Command API Reference / Input / Output
</details> <details> <summary> DeleteAgentActionGroup </summary>Command API Reference / Input / Output
</details> <details> <summary> DeleteAgentAlias </summary>Command API Reference / Input / Output
</details> <details> <summary> DeleteAgentVersion </summary>Command API Reference / Input / Output
</details> <details> <summary> DeleteDataSource </summary>Command API Reference / Input / Output
</details> <details> <summary> DeleteFlow </summary>Command API Reference / Input / Output
</details> <details> <summary> DeleteFlowAlias </summary>Command API Reference / Input / Output
</details> <details> <summary> DeleteFlowVersion </summary>Command API Reference / Input / Output
</details> <details> <summary> DeleteKnowledgeBase </summary>Command API Reference / Input / Output
</details> <details> <summary> DeleteKnowledgeBaseDocuments </summary>Command API Reference / Input / Output
</details> <details> <summary> DeletePrompt </summary>Command API Reference / Input / Output
</details> <details> <summary> DisassociateAgentCollaborator </summary>Command API Reference / Input / Output
</details> <details> <summary> DisassociateAgentKnowledgeBase </summary>Command API Reference / Input / Output
</details> <details> <summary> GetAgent </summary>Command API Reference / Input / Output
</details> <details> <summary> GetAgentActionGroup </summary>Command API Reference / Input / Output
</details> <details> <summary> GetAgentAlias </summary>Command API Reference / Input / Output
</details> <details> <summary> GetAgentCollaborator </summary>Command API Reference / Input / Output
</details> <details> <summary> GetAgentKnowledgeBase </summary>Command API Reference / Input / Output
</details> <details> <summary> GetAgentVersion </summary>Command API Reference / Input / Output
</details> <details> <summary> GetDataSource </summary>Command API Reference / Input / Output
</details> <details> <summary> GetFlow </summary>Command API Reference / Input / Output
</details> <details> <summary> GetFlowAlias </summary>Command API Reference / Input / Output
</details> <details> <summary> GetFlowVersion </summary>Command API Reference / Input / Output
</details> <details> <summary> GetIngestionJob </summary>Command API Reference / Input / Output
</details> <details> <summary> GetKnowledgeBase </summary>Command API Reference / Input / Output
</details> <details> <summary> GetKnowledgeBaseDocuments </summary>Command API Reference / Input / Output
</details> <details> <summary> GetPrompt </summary>Command API Reference / Input / Output
</details> <details> <summary> IngestKnowledgeBaseDocuments </summary>Command API Reference / Input / Output
</details> <details> <summary> ListAgentActionGroups </summary>Command API Reference / Input / Output
</details> <details> <summary> ListAgentAliases </summary>Command API Reference / Input / Output
</details> <details> <summary> ListAgentCollaborators </summary>Command API Reference / Input / Output
</details> <details> <summary> ListAgentKnowledgeBases </summary>Command API Reference / Input / Output
</details> <details> <summary> ListAgents </summary>Command API Reference / Input / Output
</details> <details> <summary> ListAgentVersions </summary>Command API Reference / Input / Output
</details> <details> <summary> ListDataSources </summary>Command API Reference / Input / Output
</details> <details> <summary> ListFlowAliases </summary>Command API Reference / Input / Output
</details> <details> <summary> ListFlows </summary>Command API Reference / Input / Output
</details> <details> <summary> ListFlowVersions </summary>Command API Reference / Input / Output
</details> <details> <summary> ListIngestionJobs </summary>Command API Reference / Input / Output
</details> <details> <summary> ListKnowledgeBaseDocuments </summary>Command API Reference / Input / Output
</details> <details> <summary> ListKnowledgeBases </summary>Command API Reference / Input / Output
</details> <details> <summary> ListPrompts </summary>Command API Reference / Input / Output
</details> <details> <summary> ListTagsForResource </summary>Command API Reference / Input / Output
</details> <details> <summary> PrepareAgent </summary>Command API Reference / Input / Output
</details> <details> <summary> PrepareFlow </summary>Command API Reference / Input / Output
</details> <details> <summary> StartIngestionJob </summary>Command API Reference / Input / Output
</details> <details> <summary> StopIngestionJob </summary>Command API Reference / Input / Output
</details> <details> <summary> TagResource </summary>Command API Reference / Input / Output
</details> <details> <summary> UntagResource </summary>Command API Reference / Input / Output
</details> <details> <summary> UpdateAgent </summary>Command API Reference / Input / Output
</details> <details> <summary> UpdateAgentActionGroup </summary>Command API Reference / Input / Output
</details> <details> <summary> UpdateAgentAlias </summary>Command API Reference / Input / Output
</details> <details> <summary> UpdateAgentCollaborator </summary>Command API Reference / Input / Output
</details> <details> <summary> UpdateAgentKnowledgeBase </summary>Command API Reference / Input / Output
</details> <details> <summary> UpdateDataSource </summary>Command API Reference / Input / Output
</details> <details> <summary> UpdateFlow </summary>Command API Reference / Input / Output
</details> <details> <summary> UpdateFlowAlias </summary>Command API Reference / Input / Output
</details> <details> <summary> UpdateKnowledgeBase </summary>Command API Reference / Input / Output
</details> <details> <summary> UpdatePrompt </summary> </details> <details> <summary> ValidateFlowDefinition </summary> </details>