Skip to content

get_agentic_context async

get_agentic_context(
    agentic_context_id: AgenticContextId,
    *,
    config_overrides: Optional[AsyncWorkSpacesClientConfig] = None,
) -> GetAgenticContextResult

Describes an agentic context, including its body.

Parameters:

Raises:

Examples:

Example – Getting a context The following example gets a context, including its body.

>>> await client.get_agentic_context(agentic_context_id='wsactx-a1b2c3d4')
Source code in docs_src/capo_workspaces/_services/async_work_spaces.py
async def get_agentic_context(
    self,
    agentic_context_id: "capo_workspaces.types.agentic_context_id.AgenticContextId",
    *,
    config_overrides: Optional[AsyncWorkSpacesClientConfig] = None,
) -> "capo_workspaces.types.get_agentic_context_result.GetAgenticContextResult":
    """<p>Describes an agentic context, including its body.</p>

    Args:
        agentic_context_id: <p>The identifier of the context.</p>

    Raises:
        capo_workspaces.errors.access_denied_exception.AccessDeniedException: <p>The user is not authorized to access a resource.</p>
        capo_workspaces.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource could not be found.</p>
        capo_workspaces.errors.throttling_exception.ThrottlingException: <p>The request was throttled. Retry the request with exponential backoff.</p>
        capo_workspaces.errors.validation_exception.ValidationException: <p>Your request failed validation. Check the error message for the parameter that isn't valid.</p>
        capo_workspaces.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Example – Getting a context
        The following example gets a context, including its body.

        >>> await client.get_agentic_context(agentic_context_id='wsactx-a1b2c3d4')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_workspaces.types.get_agentic_context_request.GetAgenticContextRequest]",
    ) -> AsyncOperationResponse[
        "capo_workspaces.types.get_agentic_context_result.GetAgenticContextResult"
    ]:
        if req.options.protocol == "awsJson1_1":
            import capo_workspaces._operations.workspaces_service.aws_json1_1.get_agentic_context

            (
                output,
                http_response,
            ) = await capo_workspaces._operations.workspaces_service.aws_json1_1.get_agentic_context.async_get_agentic_context(
                req.options, req.input
            )
        elif req.options.protocol == "rpcv2Cbor":
            import capo_workspaces._operations.workspaces_service.rpcv2_cbor.get_agentic_context

            (
                output,
                http_response,
            ) = await capo_workspaces._operations.workspaces_service.rpcv2_cbor.get_agentic_context.async_get_agentic_context(
                req.options, req.input
            )
        else:
            raise ValueError(f"unknown protocol {req.options.protocol!r}")
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_workspaces.types.get_agentic_context_result.GetAgenticContextResult",
    ) -> dict[str, Any]:
        import capo_workspaces.types.get_agentic_context_result

        return capo_workspaces.types.get_agentic_context_result.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("GetAgenticContext", redact_output=_redact_output),
    )
    input_: capo_workspaces.types.get_agentic_context_request.GetAgenticContextRequest = {
        "agentic_context_id": agentic_context_id
    }

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output