Experimental
@aws-cdk/aws-bedrock-agentcore-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.
DataSourceConfig Class
Configuration for the data source used in online evaluation.
Use the static factory methods to create data source configurations:
DataSourceConfig.fromAgentRuntimeEndpoint()for AgentCore Runtime (recommended)DataSourceConfig.fromAgentRuntimeEndpointName()for AgentCore Runtime using endpoint name stringDataSourceConfig.fromCloudWatchLogs()for external agents or custom log groups
Example
// CloudWatch Logs data source (for external agents)
const dataSource = agentcore.DataSourceConfig.fromCloudWatchLogs({
logGroupNames: ['/aws/my-external-agent/logs'],
serviceNames: ['my-external-agent'],
});
Properties
cloudWatchLogsConfigCloudWatchLogsDataSourceConfigcloud_watch_logs_configCloudWatchLogsDataSourceConfigcloudWatchLogsConfigCloudWatchLogsDataSourceConfigCloudWatchLogsConfigCloudWatchLogsDataSourceConfigCloudWatchLogsConfigCloudWatchLogsDataSourceConfig#Methods
bind(): DataSourceConfigBindResultdef bind(self, ) -> DataSourceConfigBindResultpublic DataSourceConfigBindResult bind()public DataSourceConfigBindResult Bind()func Bind() DataSourceConfigBindResult#fromAgentRuntimeEndpoint(runtime: IBedrockAgentRuntime, endpoint?: IRuntimeEndpoint): DataSourceConfig // chainable@staticmethod def from_agent_runtime_endpoint(runtime: IBedrockAgentRuntime, endpoint: typing.Optional[IRuntimeEndpoint] = None) -> DataSourceConfigpublic static DataSourceConfig fromAgentRuntimeEndpoint(IBedrockAgentRuntime runtime, IRuntimeEndpoint endpoint)public static DataSourceConfig FromAgentRuntimeEndpoint(IBedrockAgentRuntime runtime, IRuntimeEndpoint? endpoint = null)func FromAgentRuntimeEndpoint(Runtime IBedrockAgentRuntime, Endpoint IRuntimeEndpoint) DataSourceConfigstatic#This is the recommended way to configure evaluation for AgentCore Runtime agents. It automatically derives the CloudWatch log group and service name from the runtime and endpoint.
2 parameters · returns · example
Parameters
runtimeruntimeruntimeruntimeRuntime— - The AgentCore Runtime construct.endpointendpointendpointendpointEndpoint— - The RuntimeEndpoint construct.
Returns: A DataSourceConfig instance
// Using a specific endpoint
declare const runtime: agentcore.Runtime;
const endpoint = runtime.addEndpoint('PROD');
const dataSource = agentcore.DataSourceConfig.fromAgentRuntimeEndpoint(runtime, endpoint);
fromAgentRuntimeEndpointName(runtime: IBedrockAgentRuntime, endpointName: string): DataSourceConfig // chainable@staticmethod def from_agent_runtime_endpoint_name(runtime: IBedrockAgentRuntime, endpoint_name: str) -> DataSourceConfigpublic static DataSourceConfig fromAgentRuntimeEndpointName(IBedrockAgentRuntime runtime, String endpointName)public static DataSourceConfig FromAgentRuntimeEndpointName(IBedrockAgentRuntime runtime, string endpointName)func FromAgentRuntimeEndpointName(Runtime IBedrockAgentRuntime, EndpointName *string) DataSourceConfigstatic#Use this method when you want to reference an endpoint by name without having a construct reference. For construct references, prefer fromAgentRuntimeEndpoint().
2 parameters · returns · example
Parameters
runtimeruntimeruntimeruntimeRuntime— - The AgentCore Runtime construct.endpointNameendpoint_nameendpointNameendpointNameEndpointName— - The name of the runtime endpoint.
Returns: A DataSourceConfig instance
declare const runtime: agentcore.Runtime;
const dataSource = agentcore.DataSourceConfig.fromAgentRuntimeEndpointName(runtime, 'PROD');
fromCloudWatchLogs(config: CloudWatchLogsDataSourceConfig): DataSourceConfig // chainable@staticmethod def from_cloud_watch_logs(config: CloudWatchLogsDataSourceConfig) -> DataSourceConfigpublic static DataSourceConfig fromCloudWatchLogs(CloudWatchLogsDataSourceConfig config)public static DataSourceConfig FromCloudWatchLogs(CloudWatchLogsDataSourceConfig config)func FromCloudWatchLogs(Config CloudWatchLogsDataSourceConfig) DataSourceConfigstatic#Use this when your agent traces are stored in CloudWatch Logs, such as for external agents or when you need to specify log groups directly.
1 parameter · returns · example
Parameters
configconfigconfigconfigConfig— - The CloudWatch Logs data source configuration.
Returns: A DataSourceConfig instance
const dataSource = agentcore.DataSourceConfig.fromCloudWatchLogs({
logGroupNames: ['/aws/bedrock-agentcore/runtimes/myRuntime-abc123-DEFAULT'],
serviceNames: ['myRuntime.DEFAULT'],
});