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
ts
// 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_configCloudWatchLogsDataSourceConfigcloudWatchLogsConfigCloudWatchLogsDataSourceConfigCloudWatchLogsConfigCloudWatchLogsDataSourceConfigCloudWatchLogsConfigCloudWatchLogsDataSourceConfigrequired#The CloudWatch Logs configuration.
Methods
bind(): DataSourceConfigBindResultdef bind(self, ) -> DataSourceConfigBindResultpublic DataSourceConfigBindResult bind()public DataSourceConfigBindResult Bind()func Bind() DataSourceConfigBindResult#Binds the data source configuration to produce the L1 property.
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#Creates a data source configuration from an AgentCore Runtime and optional endpoint.
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
ts
// 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#Creates a data source configuration from an AgentCore Runtime and an endpoint name string.
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
ts
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#Creates a CloudWatch Logs data source configuration.
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
ts
const dataSource = agentcore.DataSourceConfig.fromCloudWatchLogs({
logGroupNames: ['/aws/bedrock-agentcore/runtimes/myRuntime-abc123-DEFAULT'],
serviceNames: ['myRuntime.DEFAULT'],
});