DataSourceConfig
- class aws_cdk.aws_bedrock_agentcore_alpha.DataSourceConfig(*args: Any, **kwargs)
Bases:
object(experimental) 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
- Stability:
experimental
Example:
# CloudWatch Logs data source (for external agents) data_source = agentcore.DataSourceConfig.from_cloud_watch_logs( log_group_names=["/aws/my-external-agent/logs"], service_names=["my-external-agent"] )
Methods
- bind()
(experimental) Binds the data source configuration to produce the L1 property.
- Stability:
experimental
- Return type:
Attributes
- cloud_watch_logs_config
(experimental) The CloudWatch Logs configuration.
- Stability:
experimental
Static Methods
- classmethod from_agent_runtime_endpoint(runtime, endpoint=None)
(experimental) 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.
- Parameters:
runtime (
IBedrockAgentRuntime) –The AgentCore Runtime construct.
endpoint (
Optional[IRuntimeEndpoint]) –The RuntimeEndpoint construct. Defaults to ‘DEFAULT’ endpoint if not provided.
- Return type:
- Returns:
A DataSourceConfig instance
- Stability:
experimental
Example:
# Using a specific endpoint # runtime: agentcore.Runtime endpoint = runtime.add_endpoint("PROD") data_source = agentcore.DataSourceConfig.from_agent_runtime_endpoint(runtime, endpoint)
- classmethod from_agent_runtime_endpoint_name(runtime, endpoint_name)
(experimental) 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().- Parameters:
runtime (
IBedrockAgentRuntime) –The AgentCore Runtime construct.
endpoint_name (
str) –The name of the runtime endpoint.
- Return type:
- Returns:
A DataSourceConfig instance
- Stability:
experimental
Example:
# runtime: agentcore.Runtime data_source = agentcore.DataSourceConfig.from_agent_runtime_endpoint_name(runtime, "PROD")
- classmethod from_cloud_watch_logs(*, log_group_names, service_names)
(experimental) 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.
- Parameters:
log_group_names (
Sequence[str]) – (experimental) The list of CloudWatch log group names to monitor for agent traces.service_names (
Sequence[str]) – (experimental) The list of service names to filter traces within the specified log groups. Used to identify relevant agent sessions. For agents hosted on AgentCore Runtime, service name follows the format:<agent-runtime-name>.<agent-runtime-endpoint-name>
- Return type:
- Returns:
A DataSourceConfig instance
- Stability:
experimental
Example:
data_source = agentcore.DataSourceConfig.from_cloud_watch_logs( log_group_names=["/aws/bedrock-agentcore/runtimes/myRuntime-abc123-DEFAULT"], service_names=["myRuntime.DEFAULT"] )