aws_sdk_bedrockagentruntime/operation/
invoke_agent.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// Orchestration and serialization glue logic for `InvokeAgent`.
3#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct InvokeAgent;
6impl InvokeAgent {
7    /// Creates a new `InvokeAgent`
8    pub fn new() -> Self {
9        Self
10    }
11    pub(crate) async fn orchestrate(
12        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
13        input: crate::operation::invoke_agent::InvokeAgentInput,
14    ) -> ::std::result::Result<
15        crate::operation::invoke_agent::InvokeAgentOutput,
16        ::aws_smithy_runtime_api::client::result::SdkError<
17            crate::operation::invoke_agent::InvokeAgentError,
18            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
19        >,
20    > {
21        let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<
22            ::aws_smithy_runtime_api::client::interceptors::context::Error,
23            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
24        >| {
25            err.map_service_error(|err| {
26                err.downcast::<crate::operation::invoke_agent::InvokeAgentError>()
27                    .expect("correct error type")
28            })
29        };
30        let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
31            .await
32            .map_err(map_err)?;
33        let output = context.finalize().map_err(map_err)?;
34        ::std::result::Result::Ok(
35            output
36                .downcast::<crate::operation::invoke_agent::InvokeAgentOutput>()
37                .expect("correct output type"),
38        )
39    }
40
41    pub(crate) async fn orchestrate_with_stop_point(
42        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
43        input: crate::operation::invoke_agent::InvokeAgentInput,
44        stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
45    ) -> ::std::result::Result<
46        ::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext,
47        ::aws_smithy_runtime_api::client::result::SdkError<
48            ::aws_smithy_runtime_api::client::interceptors::context::Error,
49            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
50        >,
51    > {
52        let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
53        use ::tracing::Instrument;
54        ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point("Bedrock Agent Runtime", "InvokeAgent", input, runtime_plugins, stop_point)
55            // Create a parent span for the entire operation. Includes a random, internal-only,
56            // seven-digit ID for the operation orchestration so that it can be correlated in the logs.
57            .instrument(::tracing::debug_span!(
58                "Bedrock Agent Runtime.InvokeAgent",
59                "rpc.service" = "Bedrock Agent Runtime",
60                "rpc.method" = "InvokeAgent",
61                "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
62                "rpc.system" = "aws-api",
63            ))
64            .await
65    }
66
67    pub(crate) fn operation_runtime_plugins(
68        client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
69        client_config: &crate::config::Config,
70        config_override: ::std::option::Option<crate::config::Builder>,
71    ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
72        let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
73        runtime_plugins = runtime_plugins.with_client_plugin(crate::auth_plugin::DefaultAuthOptionsPlugin::new(vec![
74            ::aws_runtime::auth::sigv4::SCHEME_ID,
75        ]));
76        if let ::std::option::Option::Some(config_override) = config_override {
77            for plugin in config_override.runtime_plugins.iter().cloned() {
78                runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
79            }
80            runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
81                config_override,
82                client_config.config.clone(),
83                &client_config.runtime_components,
84            ));
85        }
86        runtime_plugins
87    }
88}
89impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for InvokeAgent {
90    fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
91        let mut cfg = ::aws_smithy_types::config_bag::Layer::new("InvokeAgent");
92
93        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
94            InvokeAgentRequestSerializer,
95        ));
96        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
97            InvokeAgentResponseDeserializer,
98        ));
99
100        cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
101            ::aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolverParams::new(),
102        ));
103
104        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::SensitiveOutput);
105        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
106            "InvokeAgent",
107            "Bedrock Agent Runtime",
108        ));
109        let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
110        signing_options.double_uri_encode = true;
111        signing_options.content_sha256_header = false;
112        signing_options.normalize_uri_path = true;
113        signing_options.payload_override = None;
114
115        cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
116            signing_options,
117            ..::std::default::Default::default()
118        });
119
120        ::std::option::Option::Some(cfg.freeze())
121    }
122
123    fn runtime_components(
124        &self,
125        _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
126    ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
127        #[allow(unused_mut)]
128        let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("InvokeAgent")
129            .with_interceptor(InvokeAgentEndpointParamsInterceptor)
130            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
131                crate::operation::invoke_agent::InvokeAgentError,
132            >::new())
133            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
134                crate::operation::invoke_agent::InvokeAgentError,
135            >::new())
136            .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
137                crate::operation::invoke_agent::InvokeAgentError,
138            >::new());
139
140        ::std::borrow::Cow::Owned(rcb)
141    }
142}
143
144#[derive(Debug)]
145struct InvokeAgentResponseDeserializer;
146impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for InvokeAgentResponseDeserializer {
147    fn deserialize_streaming(
148        &self,
149        response: &mut ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
150    ) -> ::std::option::Option<::aws_smithy_runtime_api::client::interceptors::context::OutputOrError> {
151        #[allow(unused_mut)]
152        let mut force_error = false;
153        ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
154
155        // If this is an error, defer to the non-streaming parser
156        if (!response.status().is_success() && response.status().as_u16() != 200) || force_error {
157            return ::std::option::Option::None;
158        }
159        ::std::option::Option::Some(crate::protocol_serde::type_erase_result(
160            crate::protocol_serde::shape_invoke_agent::de_invoke_agent_http_response(response),
161        ))
162    }
163
164    fn deserialize_nonstreaming(
165        &self,
166        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
167    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
168        // For streaming operations, we only hit this case if its an error
169        let body = response.body().bytes().expect("body loaded");
170        crate::protocol_serde::type_erase_result(crate::protocol_serde::shape_invoke_agent::de_invoke_agent_http_error(
171            response.status().as_u16(),
172            response.headers(),
173            body,
174        ))
175    }
176}
177#[derive(Debug)]
178struct InvokeAgentRequestSerializer;
179impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for InvokeAgentRequestSerializer {
180    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
181    fn serialize_input(
182        &self,
183        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
184        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
185    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
186        let input = input
187            .downcast::<crate::operation::invoke_agent::InvokeAgentInput>()
188            .expect("correct type");
189        let _header_serialization_settings = _cfg
190            .load::<crate::serialization_settings::HeaderSerializationSettings>()
191            .cloned()
192            .unwrap_or_default();
193        let mut request_builder = {
194            fn uri_base(
195                _input: &crate::operation::invoke_agent::InvokeAgentInput,
196                output: &mut ::std::string::String,
197            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
198                use ::std::fmt::Write as _;
199                let input_1 = &_input.agent_id;
200                let input_1 = input_1
201                    .as_ref()
202                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("agent_id", "cannot be empty or unset"))?;
203                let agent_id = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default);
204                if agent_id.is_empty() {
205                    return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
206                        "agent_id",
207                        "cannot be empty or unset",
208                    ));
209                }
210                let input_2 = &_input.agent_alias_id;
211                let input_2 = input_2
212                    .as_ref()
213                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("agent_alias_id", "cannot be empty or unset"))?;
214                let agent_alias_id = ::aws_smithy_http::label::fmt_string(input_2, ::aws_smithy_http::label::EncodingStrategy::Default);
215                if agent_alias_id.is_empty() {
216                    return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
217                        "agent_alias_id",
218                        "cannot be empty or unset",
219                    ));
220                }
221                let input_3 = &_input.session_id;
222                let input_3 = input_3
223                    .as_ref()
224                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("session_id", "cannot be empty or unset"))?;
225                let session_id = ::aws_smithy_http::label::fmt_string(input_3, ::aws_smithy_http::label::EncodingStrategy::Default);
226                if session_id.is_empty() {
227                    return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
228                        "session_id",
229                        "cannot be empty or unset",
230                    ));
231                }
232                ::std::write!(
233                    output,
234                    "/agents/{agentId}/agentAliases/{agentAliasId}/sessions/{sessionId}/text",
235                    agentId = agent_id,
236                    agentAliasId = agent_alias_id,
237                    sessionId = session_id
238                )
239                .expect("formatting should succeed");
240                ::std::result::Result::Ok(())
241            }
242            #[allow(clippy::unnecessary_wraps)]
243            fn update_http_builder(
244                input: &crate::operation::invoke_agent::InvokeAgentInput,
245                builder: ::http::request::Builder,
246            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
247                let mut uri = ::std::string::String::new();
248                uri_base(input, &mut uri)?;
249                let builder = crate::protocol_serde::shape_invoke_agent::ser_invoke_agent_headers(input, builder)?;
250                ::std::result::Result::Ok(builder.method("POST").uri(uri))
251            }
252            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
253            builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/json");
254            builder
255        };
256        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_invoke_agent::ser_invoke_agent_input(&input)?);
257        if let Some(content_length) = body.content_length() {
258            let content_length = content_length.to_string();
259            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
260        }
261        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
262    }
263}
264#[derive(Debug)]
265struct InvokeAgentEndpointParamsInterceptor;
266
267impl ::aws_smithy_runtime_api::client::interceptors::Intercept for InvokeAgentEndpointParamsInterceptor {
268    fn name(&self) -> &'static str {
269        "InvokeAgentEndpointParamsInterceptor"
270    }
271
272    fn read_before_execution(
273        &self,
274        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
275            '_,
276            ::aws_smithy_runtime_api::client::interceptors::context::Input,
277            ::aws_smithy_runtime_api::client::interceptors::context::Output,
278            ::aws_smithy_runtime_api::client::interceptors::context::Error,
279        >,
280        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
281    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
282        let _input = context
283            .input()
284            .downcast_ref::<InvokeAgentInput>()
285            .ok_or("failed to downcast to InvokeAgentInput")?;
286
287        let params = crate::config::endpoint::Params::builder()
288            .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
289            .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
290            .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
291            .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
292            .build()
293            .map_err(|err| {
294                ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
295            })?;
296        cfg.interceptor_state()
297            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
298        ::std::result::Result::Ok(())
299    }
300}
301
302// The get_* functions below are generated from JMESPath expressions in the
303// operationContextParams trait. They target the operation's input shape.
304
305/// Error type for the `InvokeAgentError` operation.
306#[non_exhaustive]
307#[derive(::std::fmt::Debug)]
308pub enum InvokeAgentError {
309    /// <p>The model specified in the request is not ready to serve inference requests. The AWS SDK will automatically retry the operation up to 5 times. For information about configuring automatic retries, see <a href="https://docs.aws.amazon.com/sdkref/latest/guide/feature-retry-behavior.html">Retry behavior</a> in the <i>AWS SDKs and Tools</i> reference guide.</p>
310    ModelNotReadyException(crate::types::error::ModelNotReadyException),
311    /// <p>Input validation failed. Check your request parameters and retry the request.</p>
312    ValidationException(crate::types::error::ValidationException),
313    /// <p>An internal server error occurred. Retry your request.</p>
314    InternalServerException(crate::types::error::InternalServerException),
315    /// <p>The request is denied because of missing access permissions. Check your permissions and retry your request.</p>
316    AccessDeniedException(crate::types::error::AccessDeniedException),
317    /// <p>There was an issue with a dependency. Check the resource configurations and retry the request.</p>
318    DependencyFailedException(crate::types::error::DependencyFailedException),
319    /// <p>The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.</p>
320    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
321    /// <p>The number of requests exceeds the limit. Resubmit your request later.</p>
322    ThrottlingException(crate::types::error::ThrottlingException),
323    /// <p>There was an issue with a dependency due to a server issue. Retry your request.</p>
324    BadGatewayException(crate::types::error::BadGatewayException),
325    /// <p>There was a conflict performing an operation. Resolve the conflict and retry your request.</p>
326    ConflictException(crate::types::error::ConflictException),
327    /// <p>The number of requests exceeds the service quota. Resubmit your request later.</p>
328    ServiceQuotaExceededException(crate::types::error::ServiceQuotaExceededException),
329    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
330    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
331    variable wildcard pattern and check `.code()`:
332     \
333    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
334     \
335    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-InvokeAgentError) for what information is available for the error.")]
336    Unhandled(crate::error::sealed_unhandled::Unhandled),
337}
338impl InvokeAgentError {
339    /// Creates the `InvokeAgentError::Unhandled` variant from any error type.
340    pub fn unhandled(
341        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
342    ) -> Self {
343        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
344            source: err.into(),
345            meta: ::std::default::Default::default(),
346        })
347    }
348
349    /// Creates the `InvokeAgentError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
350    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
351        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
352            source: err.clone().into(),
353            meta: err,
354        })
355    }
356    ///
357    /// Returns error metadata, which includes the error code, message,
358    /// request ID, and potentially additional information.
359    ///
360    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
361        match self {
362            Self::ModelNotReadyException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
363            Self::ValidationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
364            Self::InternalServerException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
365            Self::AccessDeniedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
366            Self::DependencyFailedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
367            Self::ResourceNotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
368            Self::ThrottlingException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
369            Self::BadGatewayException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
370            Self::ConflictException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
371            Self::ServiceQuotaExceededException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
372            Self::Unhandled(e) => &e.meta,
373        }
374    }
375    /// Returns `true` if the error kind is `InvokeAgentError::ModelNotReadyException`.
376    pub fn is_model_not_ready_exception(&self) -> bool {
377        matches!(self, Self::ModelNotReadyException(_))
378    }
379    /// Returns `true` if the error kind is `InvokeAgentError::ValidationException`.
380    pub fn is_validation_exception(&self) -> bool {
381        matches!(self, Self::ValidationException(_))
382    }
383    /// Returns `true` if the error kind is `InvokeAgentError::InternalServerException`.
384    pub fn is_internal_server_exception(&self) -> bool {
385        matches!(self, Self::InternalServerException(_))
386    }
387    /// Returns `true` if the error kind is `InvokeAgentError::AccessDeniedException`.
388    pub fn is_access_denied_exception(&self) -> bool {
389        matches!(self, Self::AccessDeniedException(_))
390    }
391    /// Returns `true` if the error kind is `InvokeAgentError::DependencyFailedException`.
392    pub fn is_dependency_failed_exception(&self) -> bool {
393        matches!(self, Self::DependencyFailedException(_))
394    }
395    /// Returns `true` if the error kind is `InvokeAgentError::ResourceNotFoundException`.
396    pub fn is_resource_not_found_exception(&self) -> bool {
397        matches!(self, Self::ResourceNotFoundException(_))
398    }
399    /// Returns `true` if the error kind is `InvokeAgentError::ThrottlingException`.
400    pub fn is_throttling_exception(&self) -> bool {
401        matches!(self, Self::ThrottlingException(_))
402    }
403    /// Returns `true` if the error kind is `InvokeAgentError::BadGatewayException`.
404    pub fn is_bad_gateway_exception(&self) -> bool {
405        matches!(self, Self::BadGatewayException(_))
406    }
407    /// Returns `true` if the error kind is `InvokeAgentError::ConflictException`.
408    pub fn is_conflict_exception(&self) -> bool {
409        matches!(self, Self::ConflictException(_))
410    }
411    /// Returns `true` if the error kind is `InvokeAgentError::ServiceQuotaExceededException`.
412    pub fn is_service_quota_exceeded_exception(&self) -> bool {
413        matches!(self, Self::ServiceQuotaExceededException(_))
414    }
415}
416impl ::std::error::Error for InvokeAgentError {
417    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
418        match self {
419            Self::ModelNotReadyException(_inner) => ::std::option::Option::Some(_inner),
420            Self::ValidationException(_inner) => ::std::option::Option::Some(_inner),
421            Self::InternalServerException(_inner) => ::std::option::Option::Some(_inner),
422            Self::AccessDeniedException(_inner) => ::std::option::Option::Some(_inner),
423            Self::DependencyFailedException(_inner) => ::std::option::Option::Some(_inner),
424            Self::ResourceNotFoundException(_inner) => ::std::option::Option::Some(_inner),
425            Self::ThrottlingException(_inner) => ::std::option::Option::Some(_inner),
426            Self::BadGatewayException(_inner) => ::std::option::Option::Some(_inner),
427            Self::ConflictException(_inner) => ::std::option::Option::Some(_inner),
428            Self::ServiceQuotaExceededException(_inner) => ::std::option::Option::Some(_inner),
429            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
430        }
431    }
432}
433impl ::std::fmt::Display for InvokeAgentError {
434    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
435        match self {
436            Self::ModelNotReadyException(_inner) => _inner.fmt(f),
437            Self::ValidationException(_inner) => _inner.fmt(f),
438            Self::InternalServerException(_inner) => _inner.fmt(f),
439            Self::AccessDeniedException(_inner) => _inner.fmt(f),
440            Self::DependencyFailedException(_inner) => _inner.fmt(f),
441            Self::ResourceNotFoundException(_inner) => _inner.fmt(f),
442            Self::ThrottlingException(_inner) => _inner.fmt(f),
443            Self::BadGatewayException(_inner) => _inner.fmt(f),
444            Self::ConflictException(_inner) => _inner.fmt(f),
445            Self::ServiceQuotaExceededException(_inner) => _inner.fmt(f),
446            Self::Unhandled(_inner) => {
447                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
448                    write!(f, "unhandled error ({code})")
449                } else {
450                    f.write_str("unhandled error")
451                }
452            }
453        }
454    }
455}
456impl ::aws_smithy_types::retry::ProvideErrorKind for InvokeAgentError {
457    fn code(&self) -> ::std::option::Option<&str> {
458        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
459    }
460    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
461        ::std::option::Option::None
462    }
463}
464impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for InvokeAgentError {
465    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
466        match self {
467            Self::ModelNotReadyException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
468            Self::ValidationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
469            Self::InternalServerException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
470            Self::AccessDeniedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
471            Self::DependencyFailedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
472            Self::ResourceNotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
473            Self::ThrottlingException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
474            Self::BadGatewayException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
475            Self::ConflictException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
476            Self::ServiceQuotaExceededException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
477            Self::Unhandled(_inner) => &_inner.meta,
478        }
479    }
480}
481impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for InvokeAgentError {
482    fn create_unhandled_error(
483        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
484        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
485    ) -> Self {
486        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
487            source,
488            meta: meta.unwrap_or_default(),
489        })
490    }
491}
492impl ::aws_types::request_id::RequestId for crate::operation::invoke_agent::InvokeAgentError {
493    fn request_id(&self) -> Option<&str> {
494        self.meta().request_id()
495    }
496}
497
498pub use crate::operation::invoke_agent::_invoke_agent_output::InvokeAgentOutput;
499
500pub use crate::operation::invoke_agent::_invoke_agent_input::InvokeAgentInput;
501
502mod _invoke_agent_input;
503
504mod _invoke_agent_output;
505
506/// Builders
507pub mod builders;