Skip to content

Commit ff3003b

Browse files
author
awstools
committed
feat(client-bedrock-agentcore): Support for AgentCore Evaluations and Episodic memory strategy for AgentCore Memory.
1 parent d93e9c4 commit ff3003b

21 files changed

+1122
-32
lines changed

clients/client-bedrock-agentcore/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,14 @@ DeleteMemoryRecord
258258

259259
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock-agentcore/command/DeleteMemoryRecordCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-agentcore/Interface/DeleteMemoryRecordCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-agentcore/Interface/DeleteMemoryRecordCommandOutput/)
260260

261+
</details>
262+
<details>
263+
<summary>
264+
Evaluate
265+
</summary>
266+
267+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock-agentcore/command/EvaluateCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-agentcore/Interface/EvaluateCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-agentcore/Interface/EvaluateCommandOutput/)
268+
261269
</details>
262270
<details>
263271
<summary>

clients/client-bedrock-agentcore/src/BedrockAgentCore.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import {
3030
DeleteMemoryRecordCommandInput,
3131
DeleteMemoryRecordCommandOutput,
3232
} from "./commands/DeleteMemoryRecordCommand";
33+
import { EvaluateCommand, EvaluateCommandInput, EvaluateCommandOutput } from "./commands/EvaluateCommand";
3334
import {
3435
GetAgentCardCommand,
3536
GetAgentCardCommandInput,
@@ -162,6 +163,7 @@ const commands = {
162163
CreateEventCommand,
163164
DeleteEventCommand,
164165
DeleteMemoryRecordCommand,
166+
EvaluateCommand,
165167
GetAgentCardCommand,
166168
GetBrowserSessionCommand,
167169
GetCodeInterpreterSessionCommand,
@@ -299,6 +301,17 @@ export interface BedrockAgentCore {
299301
cb: (err: any, data?: DeleteMemoryRecordCommandOutput) => void
300302
): void;
301303

304+
/**
305+
* @see {@link EvaluateCommand}
306+
*/
307+
evaluate(args: EvaluateCommandInput, options?: __HttpHandlerOptions): Promise<EvaluateCommandOutput>;
308+
evaluate(args: EvaluateCommandInput, cb: (err: any, data?: EvaluateCommandOutput) => void): void;
309+
evaluate(
310+
args: EvaluateCommandInput,
311+
options: __HttpHandlerOptions,
312+
cb: (err: any, data?: EvaluateCommandOutput) => void
313+
): void;
314+
302315
/**
303316
* @see {@link GetAgentCardCommand}
304317
*/

clients/client-bedrock-agentcore/src/BedrockAgentCoreClient.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ import {
8383
import { CreateEventCommandInput, CreateEventCommandOutput } from "./commands/CreateEventCommand";
8484
import { DeleteEventCommandInput, DeleteEventCommandOutput } from "./commands/DeleteEventCommand";
8585
import { DeleteMemoryRecordCommandInput, DeleteMemoryRecordCommandOutput } from "./commands/DeleteMemoryRecordCommand";
86+
import { EvaluateCommandInput, EvaluateCommandOutput } from "./commands/EvaluateCommand";
8687
import { GetAgentCardCommandInput, GetAgentCardCommandOutput } from "./commands/GetAgentCardCommand";
8788
import { GetBrowserSessionCommandInput, GetBrowserSessionCommandOutput } from "./commands/GetBrowserSessionCommand";
8889
import {
@@ -177,6 +178,7 @@ export type ServiceInputTypes =
177178
| CreateEventCommandInput
178179
| DeleteEventCommandInput
179180
| DeleteMemoryRecordCommandInput
181+
| EvaluateCommandInput
180182
| GetAgentCardCommandInput
181183
| GetBrowserSessionCommandInput
182184
| GetCodeInterpreterSessionCommandInput
@@ -216,6 +218,7 @@ export type ServiceOutputTypes =
216218
| CreateEventCommandOutput
217219
| DeleteEventCommandOutput
218220
| DeleteMemoryRecordCommandOutput
221+
| EvaluateCommandOutput
219222
| GetAgentCardCommandOutput
220223
| GetBrowserSessionCommandOutput
221224
| GetCodeInterpreterSessionCommandOutput
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
// smithy-typescript generated code
2+
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
3+
import { Command as $Command } from "@smithy/smithy-client";
4+
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
5+
6+
import { BedrockAgentCoreClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../BedrockAgentCoreClient";
7+
import { commonParams } from "../endpoint/EndpointParameters";
8+
import { EvaluateRequest, EvaluateResponse } from "../models/models_0";
9+
import { Evaluate } from "../schemas/schemas_0";
10+
11+
/**
12+
* @public
13+
*/
14+
export type { __MetadataBearer };
15+
export { $Command };
16+
/**
17+
* @public
18+
*
19+
* The input for {@link EvaluateCommand}.
20+
*/
21+
export interface EvaluateCommandInput extends EvaluateRequest {}
22+
/**
23+
* @public
24+
*
25+
* The output of {@link EvaluateCommand}.
26+
*/
27+
export interface EvaluateCommandOutput extends EvaluateResponse, __MetadataBearer {}
28+
29+
/**
30+
* <p> Performs on-demand evaluation of agent traces using a specified evaluator. This synchronous API accepts traces in OpenTelemetry format and returns immediate scoring results with detailed explanations.</p>
31+
* @example
32+
* Use a bare-bones client and the command you need to make an API call.
33+
* ```javascript
34+
* import { BedrockAgentCoreClient, EvaluateCommand } from "@aws-sdk/client-bedrock-agentcore"; // ES Modules import
35+
* // const { BedrockAgentCoreClient, EvaluateCommand } = require("@aws-sdk/client-bedrock-agentcore"); // CommonJS import
36+
* // import type { BedrockAgentCoreClientConfig } from "@aws-sdk/client-bedrock-agentcore";
37+
* const config = {}; // type is BedrockAgentCoreClientConfig
38+
* const client = new BedrockAgentCoreClient(config);
39+
* const input = { // EvaluateRequest
40+
* evaluatorId: "STRING_VALUE", // required
41+
* evaluationInput: { // EvaluationInput Union: only one key present
42+
* sessionSpans: [ // Spans
43+
* "DOCUMENT_VALUE",
44+
* ],
45+
* },
46+
* evaluationTarget: { // EvaluationTarget Union: only one key present
47+
* spanIds: [ // SpanIds
48+
* "STRING_VALUE",
49+
* ],
50+
* traceIds: [ // TraceIds
51+
* "STRING_VALUE",
52+
* ],
53+
* },
54+
* };
55+
* const command = new EvaluateCommand(input);
56+
* const response = await client.send(command);
57+
* // { // EvaluateResponse
58+
* // evaluationResults: [ // EvaluationResults // required
59+
* // { // EvaluationResultContent
60+
* // evaluatorArn: "STRING_VALUE", // required
61+
* // evaluatorId: "STRING_VALUE", // required
62+
* // evaluatorName: "STRING_VALUE", // required
63+
* // explanation: "STRING_VALUE",
64+
* // context: { // Context Union: only one key present
65+
* // spanContext: { // SpanContext
66+
* // sessionId: "STRING_VALUE", // required
67+
* // traceId: "STRING_VALUE",
68+
* // spanId: "STRING_VALUE",
69+
* // },
70+
* // },
71+
* // value: Number("double"),
72+
* // label: "STRING_VALUE",
73+
* // tokenUsage: { // TokenUsage
74+
* // inputTokens: Number("int"),
75+
* // outputTokens: Number("int"),
76+
* // totalTokens: Number("int"),
77+
* // },
78+
* // errorMessage: "STRING_VALUE",
79+
* // errorCode: "STRING_VALUE",
80+
* // },
81+
* // ],
82+
* // };
83+
*
84+
* ```
85+
*
86+
* @param EvaluateCommandInput - {@link EvaluateCommandInput}
87+
* @returns {@link EvaluateCommandOutput}
88+
* @see {@link EvaluateCommandInput} for command's `input` shape.
89+
* @see {@link EvaluateCommandOutput} for command's `response` shape.
90+
* @see {@link BedrockAgentCoreClientResolvedConfig | config} for BedrockAgentCoreClient's `config` shape.
91+
*
92+
* @throws {@link AccessDeniedException} (client fault)
93+
* <p>The exception that occurs when you do not have sufficient permissions to perform an action. Verify that your IAM policy includes the necessary permissions for the operation you are trying to perform.</p>
94+
*
95+
* @throws {@link ConflictException} (client fault)
96+
* <p>The exception that occurs when the request conflicts with the current state of the resource. This can happen when trying to modify a resource that is currently being modified by another request, or when trying to create a resource that already exists.</p>
97+
*
98+
* @throws {@link DuplicateIdException} (client fault)
99+
* <p> An exception thrown when attempting to create a resource with an identifier that already exists.</p>
100+
*
101+
* @throws {@link InternalServerException} (server fault)
102+
* <p>The exception that occurs when the service encounters an unexpected internal error. This is a temporary condition that will resolve itself with retries. We recommend implementing exponential backoff retry logic in your application.</p>
103+
*
104+
* @throws {@link ResourceNotFoundException} (client fault)
105+
* <p>The exception that occurs when the specified resource does not exist. This can happen when using an invalid identifier or when trying to access a resource that has been deleted.</p>
106+
*
107+
* @throws {@link ServiceQuotaExceededException} (client fault)
108+
* <p>The exception that occurs when the request would cause a service quota to be exceeded. Review your service quotas and either reduce your request rate or request a quota increase.</p>
109+
*
110+
* @throws {@link ThrottlingException} (client fault)
111+
* <p>The exception that occurs when the request was denied due to request throttling. This happens when you exceed the allowed request rate for an operation. Reduce the frequency of requests or implement exponential backoff retry logic in your application.</p>
112+
*
113+
* @throws {@link UnauthorizedException} (client fault)
114+
* <p>This exception is thrown when the JWT bearer token is invalid or not found for OAuth bearer token based access</p>
115+
*
116+
* @throws {@link ValidationException} (client fault)
117+
* <p>The exception that occurs when the input fails to satisfy the constraints specified by the service. Check the error message for details about which input parameter is invalid and correct your request.</p>
118+
*
119+
* @throws {@link BedrockAgentCoreServiceException}
120+
* <p>Base exception class for all service exceptions from BedrockAgentCore service.</p>
121+
*
122+
*
123+
* @public
124+
*/
125+
export class EvaluateCommand extends $Command
126+
.classBuilder<
127+
EvaluateCommandInput,
128+
EvaluateCommandOutput,
129+
BedrockAgentCoreClientResolvedConfig,
130+
ServiceInputTypes,
131+
ServiceOutputTypes
132+
>()
133+
.ep(commonParams)
134+
.m(function (this: any, Command: any, cs: any, config: BedrockAgentCoreClientResolvedConfig, o: any) {
135+
return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
136+
})
137+
.s("AmazonBedrockAgentCore", "Evaluate", {})
138+
.n("BedrockAgentCoreClient", "EvaluateCommand")
139+
.sc(Evaluate)
140+
.build() {
141+
/** @internal type navigation helper, not in runtime. */
142+
protected declare static __types: {
143+
api: {
144+
input: EvaluateRequest;
145+
output: EvaluateResponse;
146+
};
147+
sdk: {
148+
input: EvaluateCommandInput;
149+
output: EvaluateCommandOutput;
150+
};
151+
};
152+
}

clients/client-bedrock-agentcore/src/commands/GetBrowserSessionCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export interface GetBrowserSessionCommandInput extends GetBrowserSessionRequest
2727
export interface GetBrowserSessionCommandOutput extends GetBrowserSessionResponse, __MetadataBearer {}
2828

2929
/**
30-
* <p>Retrieves detailed information about a specific browser session in Amazon Bedrock. This operation returns the session's configuration, current status, associated streams, and metadata.</p> <p>To get a browser session, you must specify both the browser identifier and the session ID. The response includes information about the session's viewport configuration, timeout settings, and stream endpoints.</p> <p>The following operations are related to <code>GetBrowserSession</code>:</p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/API_StartBrowserSession.html">StartBrowserSession</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/API_ListBrowserSessions.html">ListBrowserSessions</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/API_StopBrowserSession.html">StopBrowserSession</a> </p> </li> </ul>
30+
* <p>Retrieves detailed information about a specific browser session in Amazon Bedrock. This operation returns the session's configuration, current status, associated streams, and metadata.</p> <p>To get a browser session, you must specify both the browser identifier and the session ID. The response includes information about the session's viewport configuration, timeout settings, and stream endpoints.</p> <p>The following operations are related to <code>GetBrowserSession</code>:</p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/bedrock-agentcore/latest/APIReference/API_StartBrowserSession.html">StartBrowserSession</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/bedrock-agentcore/latest/APIReference/API_ListBrowserSessions.html">ListBrowserSessions</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/bedrock-agentcore/latest/APIReference/API_StopBrowserSession.html">StopBrowserSession</a> </p> </li> </ul>
3131
* @example
3232
* Use a bare-bones client and the command you need to make an API call.
3333
* ```javascript

clients/client-bedrock-agentcore/src/commands/GetCodeInterpreterSessionCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export interface GetCodeInterpreterSessionCommandInput extends GetCodeInterprete
2727
export interface GetCodeInterpreterSessionCommandOutput extends GetCodeInterpreterSessionResponse, __MetadataBearer {}
2828

2929
/**
30-
* <p>Retrieves detailed information about a specific code interpreter session in Amazon Bedrock. This operation returns the session's configuration, current status, and metadata.</p> <p>To get a code interpreter session, you must specify both the code interpreter identifier and the session ID. The response includes information about the session's timeout settings and current status.</p> <p>The following operations are related to <code>GetCodeInterpreterSession</code>:</p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/API_StartCodeInterpreterSession.html">StartCodeInterpreterSession</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/API_ListCodeInterpreterSessions.html">ListCodeInterpreterSessions</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/API_StopCodeInterpreterSession.html">StopCodeInterpreterSession</a> </p> </li> </ul>
30+
* <p>Retrieves detailed information about a specific code interpreter session in Amazon Bedrock. This operation returns the session's configuration, current status, and metadata.</p> <p>To get a code interpreter session, you must specify both the code interpreter identifier and the session ID. The response includes information about the session's timeout settings and current status.</p> <p>The following operations are related to <code>GetCodeInterpreterSession</code>:</p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/bedrock-agentcore/latest/APIReference/API_StartCodeInterpreterSession.html">StartCodeInterpreterSession</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/bedrock-agentcore/latest/APIReference/API_ListCodeInterpreterSessions.html">ListCodeInterpreterSessions</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/bedrock-agentcore/latest/APIReference/API_StopCodeInterpreterSession.html">StopCodeInterpreterSession</a> </p> </li> </ul>
3131
* @example
3232
* Use a bare-bones client and the command you need to make an API call.
3333
* ```javascript

clients/client-bedrock-agentcore/src/commands/GetMemoryRecordCommand.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ export interface GetMemoryRecordCommandOutput extends GetMemoryRecordOutput, __M
5353
* // "STRING_VALUE",
5454
* // ],
5555
* // createdAt: new Date("TIMESTAMP"), // required
56+
* // metadata: { // MetadataMap
57+
* // "<keys>": { // MetadataValue Union: only one key present
58+
* // stringValue: "STRING_VALUE",
59+
* // },
60+
* // },
5661
* // },
5762
* // };
5863
*

clients/client-bedrock-agentcore/src/commands/InvokeCodeInterpreterCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export interface InvokeCodeInterpreterCommandInput extends InvokeCodeInterpreter
2727
export interface InvokeCodeInterpreterCommandOutput extends InvokeCodeInterpreterResponse, __MetadataBearer {}
2828

2929
/**
30-
* <p>Executes code within an active code interpreter session in Amazon Bedrock. This operation processes the provided code, runs it in a secure environment, and returns the execution results including output, errors, and generated visualizations.</p> <p>To execute code, you must specify the code interpreter identifier, session ID, and the code to run in the arguments parameter. The operation returns a stream containing the execution results, which can include text output, error messages, and data visualizations.</p> <p>This operation is subject to request rate limiting based on your account's service quotas.</p> <p>The following operations are related to <code>InvokeCodeInterpreter</code>:</p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/API_StartCodeInterpreterSession.html">StartCodeInterpreterSession</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/API_GetCodeInterpreterSession.html">GetCodeInterpreterSession</a> </p> </li> </ul>
30+
* <p>Executes code within an active code interpreter session in Amazon Bedrock. This operation processes the provided code, runs it in a secure environment, and returns the execution results including output, errors, and generated visualizations.</p> <p>To execute code, you must specify the code interpreter identifier, session ID, and the code to run in the arguments parameter. The operation returns a stream containing the execution results, which can include text output, error messages, and data visualizations.</p> <p>This operation is subject to request rate limiting based on your account's service quotas.</p> <p>The following operations are related to <code>InvokeCodeInterpreter</code>:</p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/bedrock-agentcore/latest/APIReference/API_StartCodeInterpreterSession.html">StartCodeInterpreterSession</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/bedrock-agentcore/latest/APIReference/API_GetCodeInterpreterSession.html">GetCodeInterpreterSession</a> </p> </li> </ul>
3131
* @example
3232
* Use a bare-bones client and the command you need to make an API call.
3333
* ```javascript

clients/client-bedrock-agentcore/src/commands/ListBrowserSessionsCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export interface ListBrowserSessionsCommandInput extends ListBrowserSessionsRequ
2727
export interface ListBrowserSessionsCommandOutput extends ListBrowserSessionsResponse, __MetadataBearer {}
2828

2929
/**
30-
* <p>Retrieves a list of browser sessions in Amazon Bedrock that match the specified criteria. This operation returns summary information about each session, including identifiers, status, and timestamps.</p> <p>You can filter the results by browser identifier and session status. The operation supports pagination to handle large result sets efficiently.</p> <p>We recommend using pagination to ensure that the operation returns quickly and successfully when retrieving large numbers of sessions.</p> <p>The following operations are related to <code>ListBrowserSessions</code>:</p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/API_StartBrowserSession.html">StartBrowserSession</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/API_GetBrowserSession.html">GetBrowserSession</a> </p> </li> </ul>
30+
* <p>Retrieves a list of browser sessions in Amazon Bedrock that match the specified criteria. This operation returns summary information about each session, including identifiers, status, and timestamps.</p> <p>You can filter the results by browser identifier and session status. The operation supports pagination to handle large result sets efficiently.</p> <p>We recommend using pagination to ensure that the operation returns quickly and successfully when retrieving large numbers of sessions.</p> <p>The following operations are related to <code>ListBrowserSessions</code>:</p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/bedrock-agentcore/latest/APIReference/API_StartBrowserSession.html">StartBrowserSession</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/bedrock-agentcore/latest/APIReference/API_GetBrowserSession.html">GetBrowserSession</a> </p> </li> </ul>
3131
* @example
3232
* Use a bare-bones client and the command you need to make an API call.
3333
* ```javascript

0 commit comments

Comments
 (0)