oci 2.151.0__py3-none-any.whl → 2.152.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- oci/__init__.py +2 -2
- oci/access_governance_cp/access_governance_cp_client.py +8 -8
- oci/addons/__init__.py +20 -0
- oci/addons/adk/__init__.py +13 -0
- oci/addons/adk/agent.py +852 -0
- oci/addons/adk/agent_client.py +682 -0
- oci/addons/adk/agent_error.py +36 -0
- oci/addons/adk/auth/__init__.py +5 -0
- oci/addons/adk/auth/auth_provider.py +28 -0
- oci/addons/adk/auth/factory.py +78 -0
- oci/addons/adk/auth/oci/__init__.py +5 -0
- oci/addons/adk/auth/oci/instance_principal.py +53 -0
- oci/addons/adk/auth/oci/resource_principal.py +53 -0
- oci/addons/adk/auth/oci/session.py +91 -0
- oci/addons/adk/auth/oci/user_principal.py +64 -0
- oci/addons/adk/constants.py +17 -0
- oci/addons/adk/logger.py +163 -0
- oci/addons/adk/run/__init__.py +5 -0
- oci/addons/adk/run/response.py +56 -0
- oci/addons/adk/run/types.py +32 -0
- oci/addons/adk/tool/__init__.py +13 -0
- oci/addons/adk/tool/function_tool.py +334 -0
- oci/addons/adk/tool/prebuilt/__init__.py +8 -0
- oci/addons/adk/tool/prebuilt/agentic_rag_tool.py +49 -0
- oci/addons/adk/tool/prebuilt/calculator_toolkit.py +104 -0
- oci/addons/adk/tool/tool.py +37 -0
- oci/addons/adk/tool/toolkit.py +189 -0
- oci/addons/adk/tool/utils.py +120 -0
- oci/addons/adk/util.py +325 -0
- oci/adm/application_dependency_management_client.py +36 -36
- oci/ai_anomaly_detection/anomaly_detection_client.py +36 -36
- oci/ai_document/ai_service_document_client.py +26 -26
- oci/ai_language/ai_service_language_client.py +44 -44
- oci/ai_speech/ai_service_speech_client.py +19 -19
- oci/ai_vision/ai_service_vision_client.py +28 -28
- oci/analytics/analytics_client.py +24 -24
- oci/announcements_service/announcement_client.py +5 -5
- oci/announcements_service/announcement_subscription_client.py +9 -9
- oci/announcements_service/announcements_preferences_client.py +4 -4
- oci/announcements_service/service_client.py +1 -1
- oci/apigateway/api_gateway_client.py +21 -21
- oci/apigateway/deployment_client.py +6 -6
- oci/apigateway/gateway_client.py +6 -6
- oci/apigateway/subscribers_client.py +6 -6
- oci/apigateway/usage_plans_client.py +6 -6
- oci/apigateway/work_requests_client.py +5 -5
- oci/apm_config/config_client.py +12 -12
- oci/apm_control_plane/apm_domain_client.py +14 -14
- oci/apm_synthetics/apm_synthetic_client.py +28 -28
- oci/apm_traces/attributes_client.py +8 -8
- oci/apm_traces/query_client.py +2 -2
- oci/apm_traces/trace_client.py +4 -4
- oci/appmgmt_control/appmgmt_control_client.py +8 -8
- oci/artifacts/artifacts_client.py +32 -32
- oci/audit/audit_client.py +3 -3
- oci/autoscaling/auto_scaling_client.py +11 -11
- oci/bastion/bastion_client.py +15 -15
- oci/bds/bds_client.py +84 -84
- oci/blockchain/blockchain_platform_client.py +27 -27
- oci/budget/budget_client.py +10 -10
- oci/capacity_management/capacity_management_client.py +32 -32
- oci/certificates/certificates_client.py +5 -5
- oci/certificates_management/certificates_management_client.py +32 -32
- oci/cims/incident_client.py +6 -6
- oci/cloud_bridge/common_client.py +5 -5
- oci/cloud_bridge/discovery_client.py +15 -15
- oci/cloud_bridge/inventory_client.py +16 -16
- oci/cloud_bridge/ocb_agent_svc_client.py +23 -23
- oci/cloud_guard/cloud_guard_client.py +155 -155
- oci/cloud_migrations/migration_client.py +43 -43
- oci/cluster_placement_groups/cluster_placement_groups_cp_client.py +13 -13
- oci/compute_cloud_at_customer/compute_cloud_at_customer_client.py +12 -12
- oci/compute_instance_agent/compute_instance_agent_client.py +6 -6
- oci/compute_instance_agent/plugin_client.py +2 -2
- oci/compute_instance_agent/pluginconfig_client.py +1 -1
- oci/container_engine/container_engine_client.py +46 -46
- oci/container_instances/container_instance_client.py +18 -18
- oci/core/blockstorage_client.py +60 -60
- oci/core/compute_client.py +117 -117
- oci/core/compute_management_client.py +32 -32
- oci/core/virtual_network_client.py +258 -258
- oci/dashboard_service/dashboard_client.py +6 -6
- oci/dashboard_service/dashboard_group_client.py +6 -6
- oci/data_catalog/data_catalog_client.py +149 -149
- oci/data_flow/data_flow_client.py +45 -45
- oci/data_integration/data_integration_client.py +163 -163
- oci/data_labeling_service/data_labeling_management_client.py +17 -17
- oci/data_labeling_service_dataplane/data_labeling_client.py +15 -15
- oci/data_safe/data_safe_client.py +317 -317
- oci/data_science/data_science_client.py +145 -145
- oci/database/database_client.py +745 -469
- oci/database/models/__init__.py +2 -0
- oci/database/models/autonomous_db_version_summary.py +31 -0
- oci/database/models/backup.py +4 -2
- oci/database/models/backup_summary.py +4 -2
- oci/database/models/create_external_backup_job_details.py +4 -4
- oci/database/models/db_system.py +4 -2
- oci/database/models/db_system_summary.py +4 -2
- oci/database/models/db_system_upgrade_summary.py +152 -0
- oci/database/models/external_container_database.py +4 -2
- oci/database/models/external_container_database_summary.py +4 -2
- oci/database/models/external_database_base.py +4 -2
- oci/database/models/external_non_container_database.py +4 -2
- oci/database/models/external_non_container_database_summary.py +4 -2
- oci/database/models/external_pluggable_database.py +4 -2
- oci/database/models/external_pluggable_database_summary.py +4 -2
- oci/database_management/db_management_client.py +356 -230
- oci/database_management/db_management_client_composite_operations.py +44 -0
- oci/database_management/diagnosability_client.py +4 -4
- oci/database_management/managed_my_sql_databases_client.py +7 -247
- oci/database_management/models/__init__.py +0 -4
- oci/database_management/models/database_diagnostics_and_management_feature_details.py +35 -4
- oci/database_management/models/disable_database_management_feature_details.py +33 -2
- oci/database_management/models/disable_external_container_database_management_feature_details.py +33 -2
- oci/database_management/models/discovered_external_database.py +64 -2
- oci/database_management/models/exadata_infrastructure_lifecycle_state_values.py +40 -36
- oci/database_management/models/external_database_diagnostics_and_management_feature_details.py +64 -2
- oci/database_management/models/managed_database.py +2 -4
- oci/database_management/models/managed_database_summary.py +2 -4
- oci/database_management/models/modify_database_management_feature_details.py +1 -1
- oci/database_management/perfhub_client.py +1 -1
- oci/database_management/sql_tuning_client.py +17 -17
- oci/database_migration/database_migration_client.py +42 -42
- oci/database_tools/database_tools_client.py +23 -23
- oci/dblm/db_life_cycle_management_client.py +14 -14
- oci/delegate_access_control/delegate_access_control_client.py +26 -26
- oci/delegate_access_control/work_request_client.py +4 -4
- oci/demand_signal/occ_demand_signal_client.py +7 -7
- oci/desktops/desktop_service_client.py +21 -21
- oci/devops/devops_client.py +141 -141
- oci/disaster_recovery/disaster_recovery_client.py +31 -31
- oci/distributed_database/__init__.py +20 -0
- oci/distributed_database/distributed_autonomous_db_service_client.py +2315 -0
- oci/distributed_database/distributed_autonomous_db_service_client_composite_operations.py +605 -0
- oci/distributed_database/distributed_db_private_endpoint_service_client.py +944 -0
- oci/distributed_database/distributed_db_private_endpoint_service_client_composite_operations.py +238 -0
- oci/distributed_database/distributed_db_service_client.py +2435 -0
- oci/distributed_database/distributed_db_service_client_composite_operations.py +647 -0
- oci/distributed_database/distributed_db_work_request_service_client.py +654 -0
- oci/distributed_database/distributed_db_work_request_service_client_composite_operations.py +26 -0
- oci/distributed_database/models/__init__.py +158 -0
- oci/distributed_database/models/add_distributed_autonomous_database_gds_control_node_details.py +105 -0
- oci/distributed_database/models/add_distributed_database_gds_control_node_details.py +105 -0
- oci/distributed_database/models/catalog_peer_with_dedicated_infra.py +331 -0
- oci/distributed_database/models/catalog_peer_with_exadb_xs.py +331 -0
- oci/distributed_database/models/change_distributed_autonomous_database_compartment_details.py +74 -0
- oci/distributed_database/models/change_distributed_database_compartment_details.py +74 -0
- oci/distributed_database/models/change_distributed_database_private_endpoint_compartment_details.py +74 -0
- oci/distributed_database/models/change_distributed_db_backup_config_details.py +66 -0
- oci/distributed_database/models/configure_distributed_autonomous_database_gsms_details.py +103 -0
- oci/distributed_database/models/configure_distributed_database_gsms_details.py +103 -0
- oci/distributed_database/models/create_distributed_autonomous_database_catalog_details.py +101 -0
- oci/distributed_database/models/create_distributed_autonomous_database_catalog_with_dedicated_infra_details.py +342 -0
- oci/distributed_database/models/create_distributed_autonomous_database_details.py +799 -0
- oci/distributed_database/models/create_distributed_autonomous_database_shard_details.py +101 -0
- oci/distributed_database/models/create_distributed_autonomous_database_shard_with_dedicated_infra_details.py +377 -0
- oci/distributed_database/models/create_distributed_database_catalog_details.py +99 -0
- oci/distributed_database/models/create_distributed_database_catalog_with_exadb_xs_details.py +282 -0
- oci/distributed_database/models/create_distributed_database_details.py +810 -0
- oci/distributed_database/models/create_distributed_database_private_endpoint_details.py +260 -0
- oci/distributed_database/models/create_distributed_database_shard_details.py +99 -0
- oci/distributed_database/models/create_distributed_database_shard_with_exadb_xs_details.py +282 -0
- oci/distributed_database/models/distributed_autonomous_database.py +1143 -0
- oci/distributed_database/models/distributed_autonomous_database_associated_with_private_endpoint.py +105 -0
- oci/distributed_database/models/distributed_autonomous_database_catalog.py +194 -0
- oci/distributed_database/models/distributed_autonomous_database_catalog_with_dedicated_infra.py +559 -0
- oci/distributed_database/models/distributed_autonomous_database_collection.py +70 -0
- oci/distributed_database/models/distributed_autonomous_database_connection_string.py +70 -0
- oci/distributed_database/models/distributed_autonomous_database_gsm.py +385 -0
- oci/distributed_database/models/distributed_autonomous_database_gsm_image.py +105 -0
- oci/distributed_database/models/distributed_autonomous_database_shard.py +194 -0
- oci/distributed_database/models/distributed_autonomous_database_shard_with_dedicated_infra.py +592 -0
- oci/distributed_database/models/distributed_autonomous_database_summary.py +935 -0
- oci/distributed_database/models/distributed_autonomous_db_metadata.py +70 -0
- oci/distributed_database/models/distributed_database.py +1154 -0
- oci/distributed_database/models/distributed_database_associated_with_private_endpoint.py +105 -0
- oci/distributed_database/models/distributed_database_catalog.py +192 -0
- oci/distributed_database/models/distributed_database_catalog_with_exadb_xs.py +466 -0
- oci/distributed_database/models/distributed_database_collection.py +70 -0
- oci/distributed_database/models/distributed_database_gsm.py +385 -0
- oci/distributed_database/models/distributed_database_private_endpoint.py +639 -0
- oci/distributed_database/models/distributed_database_private_endpoint_collection.py +70 -0
- oci/distributed_database/models/distributed_database_private_endpoint_summary.py +479 -0
- oci/distributed_database/models/distributed_database_shard.py +192 -0
- oci/distributed_database/models/distributed_database_shard_with_exadb_xs.py +499 -0
- oci/distributed_database/models/distributed_database_summary.py +904 -0
- oci/distributed_database/models/distributed_db_backup_config.py +536 -0
- oci/distributed_database/models/distributed_db_backup_destination.py +362 -0
- oci/distributed_database/models/distributed_db_connection_string.py +70 -0
- oci/distributed_database/models/distributed_db_gsm_image.py +105 -0
- oci/distributed_database/models/distributed_db_metadata.py +70 -0
- oci/distributed_database/models/generate_distributed_autonomous_database_wallet_details.py +70 -0
- oci/distributed_database/models/generate_distributed_database_wallet_details.py +70 -0
- oci/distributed_database/models/patch_distributed_autonomous_database_details.py +73 -0
- oci/distributed_database/models/patch_distributed_database_details.py +73 -0
- oci/distributed_database/models/patch_insert_instruction.py +87 -0
- oci/distributed_database/models/patch_instruction.py +154 -0
- oci/distributed_database/models/patch_merge_instruction.py +95 -0
- oci/distributed_database/models/patch_remove_instruction.py +57 -0
- oci/distributed_database/models/shard_peer_with_dedicated_infra.py +331 -0
- oci/distributed_database/models/shard_peer_with_exadb_xs.py +331 -0
- oci/distributed_database/models/update_distributed_autonomous_database_details.py +136 -0
- oci/distributed_database/models/update_distributed_database_details.py +136 -0
- oci/distributed_database/models/update_distributed_database_private_endpoint_details.py +198 -0
- oci/distributed_database/models/upload_distributed_autonomous_database_signed_certificate_and_generate_wallet_details.py +71 -0
- oci/distributed_database/models/upload_distributed_database_signed_certificate_and_generate_wallet_details.py +71 -0
- oci/distributed_database/models/work_request.py +516 -0
- oci/distributed_database/models/work_request_error.py +134 -0
- oci/distributed_database/models/work_request_error_collection.py +70 -0
- oci/distributed_database/models/work_request_log_entry.py +101 -0
- oci/distributed_database/models/work_request_log_entry_collection.py +70 -0
- oci/distributed_database/models/work_request_resource.py +232 -0
- oci/distributed_database/models/work_request_summary.py +516 -0
- oci/distributed_database/models/work_request_summary_collection.py +70 -0
- oci/dns/dns_client.py +54 -54
- oci/dts/appliance_export_job_client.py +6 -6
- oci/dts/shipping_vendors_client.py +1 -1
- oci/dts/transfer_appliance_client.py +8 -8
- oci/dts/transfer_appliance_entitlement_client.py +3 -3
- oci/dts/transfer_device_client.py +5 -5
- oci/dts/transfer_job_client.py +6 -6
- oci/dts/transfer_package_client.py +7 -7
- oci/em_warehouse/em_warehouse_client.py +13 -13
- oci/email/email_client.py +31 -31
- oci/email_data_plane/email_dp_client.py +1 -1
- oci/events/events_client.py +6 -6
- oci/file_storage/file_storage_client.py +74 -74
- oci/fleet_apps_management/fleet_apps_management_admin_client.py +27 -27
- oci/fleet_apps_management/fleet_apps_management_catalog_client.py +7 -7
- oci/fleet_apps_management/fleet_apps_management_client.py +32 -32
- oci/fleet_apps_management/fleet_apps_management_maintenance_window_client.py +5 -5
- oci/fleet_apps_management/fleet_apps_management_operations_client.py +29 -29
- oci/fleet_apps_management/fleet_apps_management_provision_client.py +6 -6
- oci/fleet_apps_management/fleet_apps_management_runbooks_client.py +19 -19
- oci/fleet_apps_management/fleet_apps_management_work_request_client.py +4 -4
- oci/fleet_software_update/fleet_software_update_client.py +46 -46
- oci/functions/functions_invoke_client.py +1 -1
- oci/functions/functions_management_client.py +16 -16
- oci/fusion_apps/fusion_applications_client.py +41 -41
- oci/generative_ai/generative_ai_client.py +22 -22
- oci/generative_ai/models/create_dedicated_ai_cluster_details.py +4 -0
- oci/generative_ai/models/dedicated_ai_cluster.py +11 -3
- oci/generative_ai_agent/generative_ai_agent_client.py +38 -38
- oci/generative_ai_agent_runtime/generative_ai_agent_runtime_client.py +6 -6
- oci/generative_ai_inference/generative_ai_inference_client.py +6 -6
- oci/generic_artifacts_content/generic_artifacts_content_client.py +3 -3
- oci/globally_distributed_database/sharded_database_service_client.py +58 -58
- oci/golden_gate/golden_gate_client.py +89 -89
- oci/governance_rules_control_plane/governance_rule_client.py +15 -15
- oci/governance_rules_control_plane/work_request_client.py +5 -5
- oci/healthchecks/health_checks_client.py +17 -17
- oci/identity/identity_client.py +145 -145
- oci/identity_data_plane/dataplane_client.py +2 -2
- oci/identity_domains/identity_domains_client.py +311 -311
- oci/integration/integration_instance_client.py +19 -19
- oci/jms/java_management_service_client.py +79 -79
- oci/jms_java_downloads/java_download_client.py +25 -25
- oci/key_management/ekm_client.py +5 -5
- oci/key_management/kms_crypto_client.py +6 -6
- oci/key_management/kms_hsm_cluster_client.py +12 -12
- oci/key_management/kms_management_client.py +21 -21
- oci/key_management/kms_vault_client.py +14 -14
- oci/license_manager/license_manager_client.py +18 -18
- oci/limits/limits_client.py +4 -4
- oci/limits/quotas_client.py +7 -7
- oci/load_balancer/load_balancer_client.py +61 -61
- oci/lockbox/lockbox_client.py +24 -24
- oci/log_analytics/log_analytics_client.py +200 -200
- oci/logging/logging_management_client.py +30 -30
- oci/loggingingestion/logging_client.py +1 -1
- oci/loggingsearch/log_search_client.py +1 -1
- oci/lustre_file_storage/lustre_file_storage_client.py +11 -11
- oci/management_agent/management_agent_client.py +28 -28
- oci/management_dashboard/dashx_apis_client.py +14 -14
- oci/marketplace/account_client.py +2 -2
- oci/marketplace/marketplace_client.py +30 -30
- oci/marketplace_private_offer/attachment_client.py +5 -5
- oci/marketplace_private_offer/offer_client.py +6 -6
- oci/marketplace_publisher/attachment_client.py +5 -5
- oci/marketplace_publisher/marketplace_publisher_client.py +71 -71
- oci/marketplace_publisher/offer_client.py +6 -6
- oci/media_services/media_services_client.py +60 -60
- oci/media_services/media_stream_client.py +2 -2
- oci/mngdmac/mac_device_client.py +3 -3
- oci/mngdmac/mac_order_client.py +11 -11
- oci/model_deployment/__init__.py +14 -0
- oci/model_deployment/model_deployment_client.py +331 -0
- oci/model_deployment/model_deployment_client_composite_operations.py +26 -0
- oci/model_deployment/models/__init__.py +14 -0
- oci/model_deployment/models/inference_result.py +70 -0
- oci/monitoring/monitoring_client.py +18 -18
- oci/mysql/channels_client.py +7 -7
- oci/mysql/db_backups_client.py +7 -7
- oci/mysql/db_system_client.py +17 -17
- oci/mysql/models/create_db_system_details.py +31 -0
- oci/mysql/models/db_system.py +31 -0
- oci/mysql/models/db_system_snapshot.py +31 -0
- oci/mysql/models/replica.py +31 -0
- oci/mysql/models/replica_overrides.py +33 -2
- oci/mysql/models/replica_summary.py +31 -0
- oci/mysql/models/update_db_system_details.py +31 -0
- oci/mysql/mysqlaas_client.py +7 -7
- oci/mysql/replicas_client.py +5 -5
- oci/mysql/work_requests_client.py +4 -4
- oci/network_firewall/network_firewall_client.py +86 -86
- oci/network_load_balancer/network_load_balancer_client.py +35 -35
- oci/nosql/nosql_client.py +24 -24
- oci/object_storage/object_storage_client.py +55 -55
- oci/oce/oce_instance_client.py +10 -10
- oci/oci_control_center/occ_metrics_client.py +3 -3
- oci/ocvp/cluster_client.py +5 -5
- oci/ocvp/esxi_host_client.py +8 -8
- oci/ocvp/sddc_client.py +14 -14
- oci/ocvp/work_request_client.py +4 -4
- oci/oda/management_client.py +59 -59
- oci/oda/oda_client.py +17 -17
- oci/oda/odapackage_client.py +7 -7
- oci/onesubscription/billing_schedule_client.py +1 -1
- oci/onesubscription/commitment_client.py +2 -2
- oci/onesubscription/computed_usage_client.py +3 -3
- oci/onesubscription/invoice_summary_client.py +2 -2
- oci/onesubscription/organization_subscription_client.py +1 -1
- oci/onesubscription/ratecard_client.py +1 -1
- oci/onesubscription/subscribed_service_client.py +2 -2
- oci/onesubscription/subscription_client.py +1 -1
- oci/ons/notification_control_plane_client.py +6 -6
- oci/ons/notification_data_plane_client.py +10 -10
- oci/opa/opa_instance_client.py +13 -13
- oci/opensearch/models/__init__.py +2 -0
- oci/opensearch/models/create_opensearch_cluster_details.py +291 -0
- oci/opensearch/models/create_opensearch_cluster_pipeline_details.py +31 -0
- oci/opensearch/models/opensearch_cluster.py +291 -0
- oci/opensearch/models/opensearch_cluster_pipeline.py +31 -0
- oci/opensearch/models/opensearch_cluster_pipeline_summary.py +31 -0
- oci/opensearch/models/resize_opensearch_cluster_horizontal_details.py +31 -0
- oci/opensearch/models/resize_opensearch_cluster_vertical_details.py +217 -0
- oci/opensearch/models/shapes_details.py +70 -0
- oci/opensearch/models/update_cluster_specs_details.py +186 -0
- oci/opensearch/models/update_opensearch_cluster_pipeline_details.py +31 -0
- oci/opensearch/opensearch_cluster_backup_client.py +4 -4
- oci/opensearch/opensearch_cluster_client.py +87 -16
- oci/opensearch/opensearch_cluster_pipeline_client.py +5 -5
- oci/operator_access_control/access_requests_client.py +10 -10
- oci/operator_access_control/operator_actions_client.py +2 -2
- oci/operator_access_control/operator_control_assignment_client.py +8 -8
- oci/operator_access_control/operator_control_client.py +6 -6
- oci/opsi/operations_insights_client.py +181 -181
- oci/optimizer/optimizer_client.py +26 -26
- oci/os_management/event_client.py +8 -8
- oci/os_management/os_management_client.py +69 -69
- oci/os_management_hub/event_client.py +8 -8
- oci/os_management_hub/lifecycle_environment_client.py +13 -13
- oci/os_management_hub/managed_instance_client.py +33 -33
- oci/os_management_hub/managed_instance_group_client.py +26 -26
- oci/os_management_hub/management_station_client.py +10 -10
- oci/os_management_hub/onboarding_client.py +13 -13
- oci/os_management_hub/reporting_managed_instance_client.py +3 -3
- oci/os_management_hub/scheduled_job_client.py +7 -7
- oci/os_management_hub/software_source_client.py +33 -33
- oci/os_management_hub/work_request_client.py +5 -5
- oci/osp_gateway/address_rule_service_client.py +1 -1
- oci/osp_gateway/address_service_client.py +2 -2
- oci/osp_gateway/invoice_service_client.py +5 -5
- oci/osp_gateway/subscription_service_client.py +5 -5
- oci/osub_billing_schedule/billing_schedule_client.py +1 -1
- oci/osub_organization_subscription/organization_subscription_client.py +1 -1
- oci/osub_subscription/commitment_client.py +2 -2
- oci/osub_subscription/ratecard_client.py +1 -1
- oci/osub_subscription/subscription_client.py +1 -1
- oci/osub_usage/computed_usage_client.py +3 -3
- oci/psql/postgresql_client.py +34 -34
- oci/queue/queue_admin_client.py +11 -11
- oci/queue/queue_client.py +8 -8
- oci/recovery/database_recovery_client.py +26 -26
- oci/redis/redis_cluster_client.py +12 -12
- oci/resource_manager/resource_manager_client.py +52 -52
- oci/resource_scheduler/schedule_client.py +14 -14
- oci/resource_search/resource_search_client.py +3 -3
- oci/rover/rover_bundle_client.py +8 -8
- oci/rover/rover_cluster_client.py +8 -8
- oci/rover/rover_entitlement_client.py +6 -6
- oci/rover/rover_node_client.py +15 -15
- oci/rover/shape_client.py +1 -1
- oci/rover/work_requests_client.py +5 -5
- oci/sch/connector_plugins_client.py +2 -2
- oci/sch/service_connector_client.py +12 -12
- oci/secrets/secrets_client.py +3 -3
- oci/security_attribute/security_attribute_client.py +18 -18
- oci/service_catalog/service_catalog_client.py +26 -26
- oci/service_manager_proxy/service_manager_proxy_client.py +2 -2
- oci/service_mesh/service_mesh_client.py +48 -48
- oci/stack_monitoring/stack_monitoring_client.py +87 -87
- oci/streaming/stream_admin_client.py +18 -18
- oci/streaming/stream_client.py +8 -8
- oci/tenant_manager_control_plane/domain_client.py +5 -5
- oci/tenant_manager_control_plane/domain_governance_client.py +5 -5
- oci/tenant_manager_control_plane/governance_client.py +2 -2
- oci/tenant_manager_control_plane/link_client.py +3 -3
- oci/tenant_manager_control_plane/orders_client.py +2 -2
- oci/tenant_manager_control_plane/organization_client.py +10 -10
- oci/tenant_manager_control_plane/recipient_invitation_client.py +5 -5
- oci/tenant_manager_control_plane/sender_invitation_client.py +5 -5
- oci/tenant_manager_control_plane/subscription_client.py +11 -11
- oci/tenant_manager_control_plane/work_request_client.py +4 -4
- oci/threat_intelligence/threatintel_client.py +5 -5
- oci/usage/resources_client.py +2 -2
- oci/usage/rewards_client.py +6 -6
- oci/usage/usagelimits_client.py +1 -1
- oci/usage_api/usageapi_client.py +33 -33
- oci/vault/vaults_client.py +13 -13
- oci/vbs_inst/vbs_instance_client.py +10 -10
- oci/version.py +1 -1
- oci/visual_builder/vb_instance_client.py +14 -14
- oci/vn_monitoring/vn_monitoring_client.py +12 -12
- oci/vulnerability_scanning/vulnerability_scanning_client.py +58 -58
- oci/waa/waa_client.py +13 -13
- oci/waa/work_request_client.py +4 -4
- oci/waas/redirect_client.py +6 -6
- oci/waas/waas_client.py +66 -66
- oci/waf/waf_client.py +24 -24
- oci/work_requests/work_request_client.py +4 -4
- oci/zpr/zpr_client.py +15 -15
- {oci-2.151.0.dist-info → oci-2.152.1.dist-info}/METADATA +6 -1
- {oci-2.151.0.dist-info → oci-2.152.1.dist-info}/RECORD +428 -313
- oci/database_management/models/disable_external_mysql_associated_service_details.py +0 -144
- oci/database_management/models/enable_external_mysql_associated_service_details.py +0 -144
- {oci-2.151.0.dist-info → oci-2.152.1.dist-info}/LICENSE.txt +0 -0
- {oci-2.151.0.dist-info → oci-2.152.1.dist-info}/THIRD_PARTY_LICENSES.txt +0 -0
- {oci-2.151.0.dist-info → oci-2.152.1.dist-info}/WHEEL +0 -0
- {oci-2.151.0.dist-info → oci-2.152.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,682 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
|
3
|
+
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
|
4
|
+
|
5
|
+
"""
|
6
|
+
ADK Agent Client
|
7
|
+
"""
|
8
|
+
|
9
|
+
from typing import Any, Callable, Dict, List, Literal, Optional, Tuple
|
10
|
+
|
11
|
+
import oci
|
12
|
+
from oci.constants import HEADER_REQUEST_ID
|
13
|
+
from oci.exceptions import ClientError, ServiceError
|
14
|
+
from oci.generative_ai_agent import GenerativeAiAgentClient
|
15
|
+
from oci.generative_ai_agent.models import (
|
16
|
+
CreateToolDetails,
|
17
|
+
Function,
|
18
|
+
FunctionCallingToolConfig,
|
19
|
+
KnowledgeBaseConfig,
|
20
|
+
LlmConfig,
|
21
|
+
LlmCustomization,
|
22
|
+
RagToolConfig,
|
23
|
+
UpdateAgentDetails,
|
24
|
+
UpdateToolDetails,
|
25
|
+
)
|
26
|
+
from oci.generative_ai_agent_runtime import GenerativeAiAgentRuntimeClient
|
27
|
+
from oci.generative_ai_agent_runtime.models import (
|
28
|
+
ChatDetails,
|
29
|
+
ChatResult,
|
30
|
+
CreateSessionDetails,
|
31
|
+
FunctionCallingPerformedAction,
|
32
|
+
Session,
|
33
|
+
)
|
34
|
+
from oci.response import Response
|
35
|
+
from oci.util import formatted_flat_dict, to_dict
|
36
|
+
from oci.pagination import list_call_get_all_results
|
37
|
+
|
38
|
+
from oci.addons.adk.agent_error import AgentError, UserError
|
39
|
+
from oci.addons.adk.auth.factory import AuthFactory, OCIAuthType
|
40
|
+
from oci.addons.adk.constants import (
|
41
|
+
DEFAULT_SESSION_NAME,
|
42
|
+
DEFAULT_TIMEOUT,
|
43
|
+
DESC_SUFFIX,
|
44
|
+
FREEFORM_TAGS,
|
45
|
+
)
|
46
|
+
from oci.addons.adk.logger import default_logger as logger
|
47
|
+
from oci.addons.adk.run.types import PerformedAction
|
48
|
+
from oci.addons.adk.tool import FunctionTool
|
49
|
+
from oci.addons.adk.tool.prebuilt import AgenticRagTool
|
50
|
+
from oci.addons.adk.util import build_custom_function_params, get_region_endpoint
|
51
|
+
|
52
|
+
|
53
|
+
class AgentClient:
|
54
|
+
"""Client for interacting with OCI Agent endpoints."""
|
55
|
+
|
56
|
+
def __init__(
|
57
|
+
self,
|
58
|
+
auth_type: Optional[str] = "api_key",
|
59
|
+
config: Optional[str] = oci.config.DEFAULT_LOCATION,
|
60
|
+
profile: Optional[str] = oci.config.DEFAULT_PROFILE,
|
61
|
+
token: Optional[str] = None,
|
62
|
+
region: Optional[str] = None,
|
63
|
+
runtime_endpoint: Optional[str] = None,
|
64
|
+
management_endpoint: Optional[str] = None,
|
65
|
+
timeout: Optional[float | Tuple[float, float]] = DEFAULT_TIMEOUT,
|
66
|
+
debug: Optional[bool] = False,
|
67
|
+
) -> None:
|
68
|
+
"""
|
69
|
+
Initialize the agent client.
|
70
|
+
|
71
|
+
Args:
|
72
|
+
auth_type: The authentication type, Must be
|
73
|
+
one of: 'api_key', 'security_token', 'instance_principal',
|
74
|
+
'resource_principal', 'instance_obo_user'
|
75
|
+
config: The config file path for the agent client
|
76
|
+
profile: The profile to use for authentication
|
77
|
+
token: The token to use for authentication
|
78
|
+
region: The region to use for authentication
|
79
|
+
If provided, runtime_endpoint and management_endpoint will be
|
80
|
+
constructed automatically unless explicitly specified
|
81
|
+
runtime_endpoint: The runtime endpoint for OCI Generative AI Agent
|
82
|
+
management_endpoint: The management endpoint for OCI Generative AI Agent
|
83
|
+
timeout: The timeout for the agent client
|
84
|
+
debug: Whether to enable debug logging
|
85
|
+
|
86
|
+
Raises:
|
87
|
+
AgentError: If the agent endpoint id is unknown
|
88
|
+
"""
|
89
|
+
# use auth module
|
90
|
+
self.auth = AuthFactory.create_oci_auth(
|
91
|
+
auth_type=OCIAuthType(auth_type),
|
92
|
+
config_path=config,
|
93
|
+
profile=profile,
|
94
|
+
token=token,
|
95
|
+
region=region,
|
96
|
+
)
|
97
|
+
|
98
|
+
# endpoint
|
99
|
+
self.runtime_endpoint = self.get_runtime_endpoint(runtime_endpoint, region)
|
100
|
+
self.management_endpoint = self.get_management_endpoint(
|
101
|
+
management_endpoint, region
|
102
|
+
)
|
103
|
+
|
104
|
+
# init Agent Runtime Client
|
105
|
+
self._rt_client = GenerativeAiAgentRuntimeClient(
|
106
|
+
config=self.auth.get_config(),
|
107
|
+
signer=self.auth.get_auth_credentials(),
|
108
|
+
service_endpoint=self.runtime_endpoint,
|
109
|
+
timeout=timeout,
|
110
|
+
retry_strategy=oci.retry.DEFAULT_RETRY_STRATEGY,
|
111
|
+
)
|
112
|
+
# init Agent client
|
113
|
+
self._mgmt_client = GenerativeAiAgentClient(
|
114
|
+
config=self.auth.get_config(),
|
115
|
+
signer=self.auth.get_auth_credentials(),
|
116
|
+
service_endpoint=self.management_endpoint,
|
117
|
+
timeout=timeout,
|
118
|
+
retry_strategy=oci.retry.DEFAULT_RETRY_STRATEGY,
|
119
|
+
)
|
120
|
+
self.debug = debug
|
121
|
+
self._handlers: Dict[str, Callable] = {}
|
122
|
+
|
123
|
+
def create_session(
|
124
|
+
self,
|
125
|
+
agent_endpoint_id: str,
|
126
|
+
display_name: str | None = None,
|
127
|
+
description: str | None = None,
|
128
|
+
) -> str:
|
129
|
+
"""
|
130
|
+
Create a new agent session.
|
131
|
+
|
132
|
+
Args:
|
133
|
+
agent_endpoint_id: The agent endpoint id
|
134
|
+
display_name: Name for the session
|
135
|
+
description: Description for the session
|
136
|
+
|
137
|
+
Returns:
|
138
|
+
The session ID
|
139
|
+
|
140
|
+
Raises:
|
141
|
+
AgentError: If session creation fails
|
142
|
+
"""
|
143
|
+
create_session_details = CreateSessionDetails()
|
144
|
+
create_session_details.display_name = (
|
145
|
+
display_name if display_name else DEFAULT_SESSION_NAME
|
146
|
+
)
|
147
|
+
create_session_details.description = (
|
148
|
+
description if description else DEFAULT_SESSION_NAME + DESC_SUFFIX
|
149
|
+
)
|
150
|
+
|
151
|
+
logger.debug(f"Creating session with details: {create_session_details}")
|
152
|
+
|
153
|
+
create_session_response: Response = self._invoke(
|
154
|
+
method=self._rt_client.create_session,
|
155
|
+
success_message="Session creation succeeded",
|
156
|
+
error_message="Failed to create session",
|
157
|
+
debug=self.debug,
|
158
|
+
create_session_details=create_session_details,
|
159
|
+
agent_endpoint_id=agent_endpoint_id,
|
160
|
+
)
|
161
|
+
response_data: Session = create_session_response.data
|
162
|
+
return response_data.id
|
163
|
+
|
164
|
+
def delete_session(self, agent_endpoint_id: str, session_id: str) -> None:
|
165
|
+
"""
|
166
|
+
Delete an existing agent session.
|
167
|
+
|
168
|
+
Args:
|
169
|
+
agent_endpoint_id: The agent endpoint id
|
170
|
+
session_id: The session ID to delete
|
171
|
+
|
172
|
+
Returns:
|
173
|
+
None
|
174
|
+
|
175
|
+
Raises:
|
176
|
+
AgentError: If session deletion fails
|
177
|
+
"""
|
178
|
+
logger.debug(f"Deleting session: {session_id}")
|
179
|
+
self._invoke(
|
180
|
+
method=self._rt_client.delete_session,
|
181
|
+
success_message="Session deletion succeeded",
|
182
|
+
error_message="Failed to delete session",
|
183
|
+
debug=self.debug,
|
184
|
+
session_id=session_id,
|
185
|
+
agent_endpoint_id=agent_endpoint_id,
|
186
|
+
)
|
187
|
+
return
|
188
|
+
|
189
|
+
def chat(
|
190
|
+
self,
|
191
|
+
agent_endpoint_id: str,
|
192
|
+
session_id: str,
|
193
|
+
user_message: Optional[str] = None,
|
194
|
+
performed_actions: Optional[List[PerformedAction]] = None,
|
195
|
+
) -> Dict[str, Any]:
|
196
|
+
"""
|
197
|
+
Invoke a chat session with the agent.
|
198
|
+
|
199
|
+
Args:
|
200
|
+
agent_endpoint_id: The agent endpoint id
|
201
|
+
session_id: The session ID to use for the chat
|
202
|
+
user_message: The message from the user
|
203
|
+
performed_actions: Actions that have been performed
|
204
|
+
|
205
|
+
Returns:
|
206
|
+
The response from the agent
|
207
|
+
|
208
|
+
Raises:
|
209
|
+
AgentError: If the invocation fails
|
210
|
+
"""
|
211
|
+
chat_details = ChatDetails()
|
212
|
+
fc_performed_actions = []
|
213
|
+
if performed_actions:
|
214
|
+
fc_performed_actions = [
|
215
|
+
FunctionCallingPerformedAction(
|
216
|
+
action_id=action.action_id,
|
217
|
+
performed_action_type=action.performed_action_type,
|
218
|
+
function_call_output=action.function_call_output,
|
219
|
+
)
|
220
|
+
for action in performed_actions
|
221
|
+
]
|
222
|
+
chat_details.performed_actions = fc_performed_actions
|
223
|
+
chat_details.user_message = user_message
|
224
|
+
chat_details.should_stream = False
|
225
|
+
chat_details.session_id = session_id
|
226
|
+
|
227
|
+
logger.debug(f"Invoking chat endpoint with data: {chat_details}")
|
228
|
+
|
229
|
+
chat_response: Response = self._invoke(
|
230
|
+
method=self._rt_client.chat,
|
231
|
+
success_message="Chat succeeded",
|
232
|
+
error_message="Failed to invoke chat endpoint",
|
233
|
+
debug=self.debug,
|
234
|
+
chat_details=chat_details,
|
235
|
+
agent_endpoint_id=agent_endpoint_id,
|
236
|
+
)
|
237
|
+
|
238
|
+
response_data: ChatResult = chat_response.data
|
239
|
+
return to_dict(response_data)
|
240
|
+
|
241
|
+
def update_agent(
|
242
|
+
self,
|
243
|
+
agent_id: str,
|
244
|
+
name: str | None = None,
|
245
|
+
description: str | None = None,
|
246
|
+
instructions: str | None = None,
|
247
|
+
) -> None:
|
248
|
+
"""
|
249
|
+
Update the agent.
|
250
|
+
|
251
|
+
Args:
|
252
|
+
agent_id: The ID of the agent to update
|
253
|
+
name: The new name for the agent
|
254
|
+
description: The new description for the agent
|
255
|
+
instructions: The new instructions for the agent
|
256
|
+
|
257
|
+
Returns:
|
258
|
+
None
|
259
|
+
|
260
|
+
Raises:
|
261
|
+
AgentError: If updating the instructions fails
|
262
|
+
"""
|
263
|
+
update_agent_details = UpdateAgentDetails(freeform_tags=FREEFORM_TAGS)
|
264
|
+
if name is not None:
|
265
|
+
update_agent_details.display_name = name
|
266
|
+
if description is not None:
|
267
|
+
update_agent_details.description = description
|
268
|
+
if instructions is not None:
|
269
|
+
llm_customization = LlmCustomization(
|
270
|
+
instruction=instructions,
|
271
|
+
)
|
272
|
+
update_agent_details.llm_config = LlmConfig(
|
273
|
+
routing_llm_customization=llm_customization,
|
274
|
+
)
|
275
|
+
self._invoke(
|
276
|
+
method=self._mgmt_client.update_agent,
|
277
|
+
success_message="Agent updated successfully",
|
278
|
+
error_message="Failed to update agent",
|
279
|
+
debug=self.debug,
|
280
|
+
update_agent_details=update_agent_details,
|
281
|
+
agent_id=agent_id,
|
282
|
+
)
|
283
|
+
|
284
|
+
def find_tools(self, compartment_id: str, agent_id: str) -> List[Dict[str, Any]]:
|
285
|
+
"""
|
286
|
+
Find tools associated with the agent.
|
287
|
+
|
288
|
+
Args:
|
289
|
+
compartment_id: The compartment ID
|
290
|
+
agent_id: The agent ID
|
291
|
+
|
292
|
+
Returns:
|
293
|
+
List of tools
|
294
|
+
|
295
|
+
Raises:
|
296
|
+
AgentError: If finding tools fails
|
297
|
+
"""
|
298
|
+
# use pagination to eagerly get all records
|
299
|
+
find_tools_response: Response = self._invoke(
|
300
|
+
method=list_call_get_all_results,
|
301
|
+
success_message="Tools retrieval succeeded",
|
302
|
+
error_message="Failed to find tools",
|
303
|
+
debug=self.debug,
|
304
|
+
list_func_ref=self._mgmt_client.list_tools,
|
305
|
+
compartment_id=compartment_id,
|
306
|
+
agent_id=agent_id,
|
307
|
+
)
|
308
|
+
|
309
|
+
return [to_dict(tool) for tool in find_tools_response.data]
|
310
|
+
|
311
|
+
def delete_tool(self, tool_id: str) -> None:
|
312
|
+
"""
|
313
|
+
Delete a tool by ID.
|
314
|
+
|
315
|
+
Args:
|
316
|
+
tool_id: The ID of the tool to delete
|
317
|
+
|
318
|
+
Returns:
|
319
|
+
None
|
320
|
+
|
321
|
+
Raises:
|
322
|
+
AgentError: If tool deletion fails
|
323
|
+
"""
|
324
|
+
self._invoke(
|
325
|
+
method=self._mgmt_client.delete_tool,
|
326
|
+
success_message="Tool deletion succeeded",
|
327
|
+
error_message="Failed to delete tool",
|
328
|
+
debug=self.debug,
|
329
|
+
tool_id=tool_id,
|
330
|
+
)
|
331
|
+
|
332
|
+
def add_function_tool(
|
333
|
+
self,
|
334
|
+
function: FunctionTool,
|
335
|
+
compartment_id: str,
|
336
|
+
agent_id: str,
|
337
|
+
) -> Dict[str, Any]:
|
338
|
+
"""
|
339
|
+
Add a function tool to the agent.
|
340
|
+
|
341
|
+
Args:
|
342
|
+
function: The function tool to add
|
343
|
+
|
344
|
+
Returns:
|
345
|
+
Dict[str, Any]: The added tool as a dict with its attributes
|
346
|
+
|
347
|
+
Raises:
|
348
|
+
AgentError: If adding the tool fails
|
349
|
+
"""
|
350
|
+
tool_config = FunctionCallingToolConfig(
|
351
|
+
function=Function(
|
352
|
+
name=function.name,
|
353
|
+
description=function.description,
|
354
|
+
parameters=build_custom_function_params(function.parameters),
|
355
|
+
)
|
356
|
+
)
|
357
|
+
create_tool_details = CreateToolDetails(
|
358
|
+
display_name=function.name,
|
359
|
+
description=function.description,
|
360
|
+
compartment_id=compartment_id,
|
361
|
+
agent_id=agent_id,
|
362
|
+
tool_config=tool_config,
|
363
|
+
freeform_tags=FREEFORM_TAGS,
|
364
|
+
)
|
365
|
+
|
366
|
+
add_tool_response: Response = self._invoke(
|
367
|
+
method=self._mgmt_client.create_tool,
|
368
|
+
success_message="Tool addition succeeded",
|
369
|
+
error_message="Failed to add tool",
|
370
|
+
debug=self.debug,
|
371
|
+
create_tool_details=create_tool_details,
|
372
|
+
)
|
373
|
+
|
374
|
+
return to_dict(add_tool_response.data)
|
375
|
+
|
376
|
+
def get_tool(self, tool_id: str) -> Dict[str, Any]:
|
377
|
+
"""
|
378
|
+
Get a tool by ID.
|
379
|
+
|
380
|
+
Args:
|
381
|
+
tool_id: The ID of the tool to get
|
382
|
+
|
383
|
+
Returns:
|
384
|
+
Dict[str, Any]: The tool as a dict with its attributes
|
385
|
+
|
386
|
+
Raises:
|
387
|
+
AgentError: If getting the tool fails
|
388
|
+
"""
|
389
|
+
get_tool_response: Response = self._invoke(
|
390
|
+
method=self._mgmt_client.get_tool,
|
391
|
+
success_message="Tool retrieval succeeded",
|
392
|
+
error_message="Failed to get tool",
|
393
|
+
debug=self.debug,
|
394
|
+
tool_id=tool_id,
|
395
|
+
)
|
396
|
+
|
397
|
+
return to_dict(get_tool_response.data)
|
398
|
+
|
399
|
+
def add_rag_tool(
|
400
|
+
self,
|
401
|
+
rag_tool: AgenticRagTool,
|
402
|
+
compartment_id: str,
|
403
|
+
agent_id: str,
|
404
|
+
) -> Dict[str, Any]:
|
405
|
+
"""
|
406
|
+
Add an agentic RAG tool to the agent.
|
407
|
+
|
408
|
+
Args:
|
409
|
+
rag_tool: The RAG tool to add
|
410
|
+
compartment_id: The compartment ID
|
411
|
+
agent_id: The agent ID
|
412
|
+
|
413
|
+
Returns:
|
414
|
+
Dict[str, Any]: The added tool as a dict with its attributes
|
415
|
+
|
416
|
+
Raises:
|
417
|
+
AgentError: If adding the tool fails
|
418
|
+
"""
|
419
|
+
tool_config = RagToolConfig(
|
420
|
+
knowledge_base_configs=[
|
421
|
+
KnowledgeBaseConfig(knowledge_base_id=kb_id)
|
422
|
+
for kb_id in rag_tool.knowledge_base_ids
|
423
|
+
]
|
424
|
+
)
|
425
|
+
create_tool_details = CreateToolDetails(
|
426
|
+
compartment_id=compartment_id,
|
427
|
+
agent_id=agent_id,
|
428
|
+
display_name=rag_tool.name,
|
429
|
+
description=rag_tool.description,
|
430
|
+
tool_config=tool_config,
|
431
|
+
freeform_tags=FREEFORM_TAGS,
|
432
|
+
)
|
433
|
+
|
434
|
+
add_tool_response: Response = self._invoke(
|
435
|
+
method=self._mgmt_client.create_tool,
|
436
|
+
success_message="RAG tool addition succeeded",
|
437
|
+
error_message="""
|
438
|
+
Failed to add RAG tool
|
439
|
+
probably because a remote RAG tool not configured by ADK already exists
|
440
|
+
""",
|
441
|
+
debug=self.debug,
|
442
|
+
create_tool_details=create_tool_details,
|
443
|
+
)
|
444
|
+
|
445
|
+
return to_dict(add_tool_response.data)
|
446
|
+
|
447
|
+
def update_function_tool(
|
448
|
+
self,
|
449
|
+
tool_id: str,
|
450
|
+
function: FunctionTool,
|
451
|
+
) -> None:
|
452
|
+
"""
|
453
|
+
Update a function tool by ID.
|
454
|
+
|
455
|
+
Args:
|
456
|
+
tool_id: The ID of the tool to update
|
457
|
+
function: The function tool to update
|
458
|
+
|
459
|
+
Returns:
|
460
|
+
None
|
461
|
+
|
462
|
+
Raises:
|
463
|
+
AgentError: If updating the tool fails
|
464
|
+
"""
|
465
|
+
tool_config = FunctionCallingToolConfig(
|
466
|
+
function=Function(
|
467
|
+
name=function.name,
|
468
|
+
description=function.description,
|
469
|
+
parameters=build_custom_function_params(function.parameters),
|
470
|
+
)
|
471
|
+
)
|
472
|
+
update_tool_details = UpdateToolDetails(
|
473
|
+
display_name=function.name,
|
474
|
+
description=function.description,
|
475
|
+
tool_config=tool_config,
|
476
|
+
freeform_tags=FREEFORM_TAGS,
|
477
|
+
)
|
478
|
+
|
479
|
+
self._invoke(
|
480
|
+
method=self._mgmt_client.update_tool,
|
481
|
+
success_message="Tool update succeeded",
|
482
|
+
error_message="Failed to update tool",
|
483
|
+
debug=self.debug,
|
484
|
+
tool_id=tool_id,
|
485
|
+
update_tool_details=update_tool_details,
|
486
|
+
)
|
487
|
+
|
488
|
+
def update_rag_tool(
|
489
|
+
self,
|
490
|
+
tool_id: str,
|
491
|
+
rag_tool: AgenticRagTool,
|
492
|
+
) -> None:
|
493
|
+
"""
|
494
|
+
Update a rag tool by ID.
|
495
|
+
|
496
|
+
Args:
|
497
|
+
tool_id: The ID of the tool to update
|
498
|
+
rag_tool: The rag tool to update
|
499
|
+
|
500
|
+
Returns:
|
501
|
+
None
|
502
|
+
|
503
|
+
Raises:
|
504
|
+
AgentError: If updating the tool fails
|
505
|
+
"""
|
506
|
+
tool_config = RagToolConfig(
|
507
|
+
knowledge_base_configs=[
|
508
|
+
KnowledgeBaseConfig(knowledge_base_id=kb_id)
|
509
|
+
for kb_id in rag_tool.knowledge_base_ids
|
510
|
+
]
|
511
|
+
)
|
512
|
+
update_tool_details = UpdateToolDetails(
|
513
|
+
display_name=rag_tool.name,
|
514
|
+
description=rag_tool.description,
|
515
|
+
tool_config=tool_config,
|
516
|
+
freeform_tags=FREEFORM_TAGS,
|
517
|
+
)
|
518
|
+
|
519
|
+
self._invoke(
|
520
|
+
method=self._mgmt_client.update_tool,
|
521
|
+
success_message="RAG tool update succeeded",
|
522
|
+
error_message="Failed to update RAG tool",
|
523
|
+
debug=self.debug,
|
524
|
+
tool_id=tool_id,
|
525
|
+
update_tool_details=update_tool_details,
|
526
|
+
)
|
527
|
+
|
528
|
+
def get_agent(self, agent_id: str) -> Dict[str, Any]:
|
529
|
+
"""
|
530
|
+
Get the agent details.
|
531
|
+
|
532
|
+
Args:
|
533
|
+
agent_id: The ID of the agent
|
534
|
+
|
535
|
+
Returns:
|
536
|
+
The agent details
|
537
|
+
|
538
|
+
Raises:
|
539
|
+
AgentError: If getting the agent fails
|
540
|
+
"""
|
541
|
+
|
542
|
+
get_agent_response: Response = self._invoke(
|
543
|
+
method=self._mgmt_client.get_agent,
|
544
|
+
success_message="Agent retrieval succeeded",
|
545
|
+
error_message="Failed to get agent",
|
546
|
+
debug=self.debug,
|
547
|
+
agent_id=agent_id,
|
548
|
+
)
|
549
|
+
|
550
|
+
return to_dict(get_agent_response.data)
|
551
|
+
|
552
|
+
def get_agent_endpoint_details(self, agent_endpoint_id: str) -> Dict[str, Any]:
|
553
|
+
"""
|
554
|
+
Get the agent endpoint details.
|
555
|
+
|
556
|
+
Args:
|
557
|
+
agent_endpoint_id: The agent endpoint id
|
558
|
+
|
559
|
+
Returns:
|
560
|
+
The agent endpoint details
|
561
|
+
|
562
|
+
Raises:
|
563
|
+
AgentError: If getting the agent endpoint fails
|
564
|
+
"""
|
565
|
+
get_agent_endpoint_response: Response = self._invoke(
|
566
|
+
method=self._mgmt_client.get_agent_endpoint,
|
567
|
+
success_message="Agent endpoint retrieval succeeded",
|
568
|
+
error_message="Failed to get agent endpoint",
|
569
|
+
debug=self.debug,
|
570
|
+
agent_endpoint_id=agent_endpoint_id,
|
571
|
+
)
|
572
|
+
|
573
|
+
return to_dict(get_agent_endpoint_response.data)
|
574
|
+
|
575
|
+
def get_runtime_endpoint(
|
576
|
+
self, endpoint_url: Optional[str], region: Optional[str]
|
577
|
+
) -> str:
|
578
|
+
"""
|
579
|
+
Get the runtime endpoint.
|
580
|
+
|
581
|
+
Args:
|
582
|
+
endpoint_url: The runtime endpoint
|
583
|
+
region: The region
|
584
|
+
|
585
|
+
Returns:
|
586
|
+
The runtime endpoint
|
587
|
+
"""
|
588
|
+
return self._get_service_endpoint(endpoint_url, region, "agent-runtime")
|
589
|
+
|
590
|
+
def get_management_endpoint(
|
591
|
+
self, endpoint_url: Optional[str], region: Optional[str]
|
592
|
+
) -> str:
|
593
|
+
"""
|
594
|
+
Get the management endpoint.
|
595
|
+
|
596
|
+
Args:
|
597
|
+
endpoint_url: The management endpoint
|
598
|
+
region: The region
|
599
|
+
|
600
|
+
Returns:
|
601
|
+
The management endpoint
|
602
|
+
"""
|
603
|
+
return self._get_service_endpoint(endpoint_url, region, "agent")
|
604
|
+
|
605
|
+
def _get_service_endpoint(
|
606
|
+
self,
|
607
|
+
endpoint_url: Optional[str] = None,
|
608
|
+
region: Optional[str] = None,
|
609
|
+
endpoint_type: Literal["agent-runtime", "agent"] = "agent-runtime",
|
610
|
+
) -> str:
|
611
|
+
"""
|
612
|
+
Set the service endpoint.
|
613
|
+
|
614
|
+
Args:
|
615
|
+
endpoint_url: The service endpoint
|
616
|
+
region: The region
|
617
|
+
endpoint_type: The endpoint type
|
618
|
+
|
619
|
+
Returns:
|
620
|
+
The service endpoint
|
621
|
+
"""
|
622
|
+
# use endpoint if provided, otherwise use region
|
623
|
+
if endpoint_url:
|
624
|
+
return endpoint_url
|
625
|
+
elif region:
|
626
|
+
return get_region_endpoint(region, endpoint_type)
|
627
|
+
else:
|
628
|
+
raise UserError(
|
629
|
+
message="At least one of endpoint_url or region must be provided"
|
630
|
+
)
|
631
|
+
|
632
|
+
def _invoke(
|
633
|
+
self,
|
634
|
+
method: Callable,
|
635
|
+
success_message: str,
|
636
|
+
error_message: str,
|
637
|
+
debug: Optional[bool],
|
638
|
+
**kwargs,
|
639
|
+
) -> Response:
|
640
|
+
"""
|
641
|
+
Invoke a method.
|
642
|
+
|
643
|
+
Args:
|
644
|
+
method: The method to invoke
|
645
|
+
success_message: The success message for debug purposes
|
646
|
+
error_message: The error message
|
647
|
+
debug: Whether to enable debug logging
|
648
|
+
**kwargs: Additional keyword arguments to pass in method
|
649
|
+
|
650
|
+
Returns:
|
651
|
+
The response
|
652
|
+
"""
|
653
|
+
response: Response | None = None
|
654
|
+
try:
|
655
|
+
response = method(**kwargs)
|
656
|
+
if response is None:
|
657
|
+
raise UserError(
|
658
|
+
message=error_message,
|
659
|
+
response=response,
|
660
|
+
)
|
661
|
+
|
662
|
+
if response.status not in (200, 202):
|
663
|
+
raise AgentError(message=error_message, response=response)
|
664
|
+
|
665
|
+
logger.debug(
|
666
|
+
f"{success_message} response: {formatted_flat_dict(response.data)}"
|
667
|
+
)
|
668
|
+
logger.debug(f"{success_message} {HEADER_REQUEST_ID}: {response.request_id}")
|
669
|
+
|
670
|
+
return response
|
671
|
+
|
672
|
+
except ServiceError as e:
|
673
|
+
raise AgentError(
|
674
|
+
message=f"{error_message}: {str(e)}",
|
675
|
+
response=response,
|
676
|
+
) from e
|
677
|
+
|
678
|
+
except (ValueError, ClientError) as e:
|
679
|
+
raise UserError(
|
680
|
+
message=f"{error_message}: {str(e)}",
|
681
|
+
response=response,
|
682
|
+
) from e
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
|
3
|
+
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
|
4
|
+
|
5
|
+
from oci.response import Response
|
6
|
+
|
7
|
+
|
8
|
+
class AgentException(Exception):
|
9
|
+
"""Base exception class for OCI Generative AI ADK errors"""
|
10
|
+
|
11
|
+
def __init__(self, message: str = "", response: Response | None = None):
|
12
|
+
self.message = message
|
13
|
+
self.response = response
|
14
|
+
|
15
|
+
if response is not None:
|
16
|
+
self.status_code = response.status
|
17
|
+
self.data = response.data
|
18
|
+
self.headers = response.headers
|
19
|
+
else:
|
20
|
+
self.status_code = None
|
21
|
+
self.data = None
|
22
|
+
self.headers = None
|
23
|
+
|
24
|
+
def __str__(self):
|
25
|
+
if self.response is not None:
|
26
|
+
return f"{self.message}. Status code: {self.status_code}. Response data: {self.data}. Response headers: {self.headers}" # noqa: E501
|
27
|
+
else:
|
28
|
+
return f"{self.message}"
|
29
|
+
|
30
|
+
|
31
|
+
class AgentError(AgentException):
|
32
|
+
"""Exception for OCI Agent service errors"""
|
33
|
+
|
34
|
+
|
35
|
+
class UserError(AgentException):
|
36
|
+
"""Exception for user errors"""
|