# Request

***

To interact with the Cloud4.ai system, the SDK offers a convenient wrapper around all C4AI Services. Serving as the primary entry point, the Elastic Endpoint Service (EES) streamlines the process of defining Command Requests, complete with options and scheduling capabilities, thereby facilitating control over throttling, retries, and other critical integration aspects.

> &#x20;**Note:**  *Delve deeper into EES configurations, options, and features in the* [EES (Elastic Endpoint)](/services/ees-elastic-endpoint.md) *section.*&#x20;

### Configurations

### Simple Request

Using the SDK's EES class, you can seamlessly dispatch any executable command for execution. Here's an example:

```javascript
const command = new C4AI_EES.Commands.EXECUTE({
    service: new C4AI_EES(eesSic),
    command: new C4AI_AAC.Commands.EXECUTE({
        service: new C4AI_AAC(aacSic),
        parameters: new C4AI_RequestParameters(
            new C4AI_RequestParameter('prompt', 'Say Hello!')
        )
    })
});
```

### Nested Injections

By leveraging the request syntax, you can define additional strategies for parameter retrieval. This allows you to specify parameters at various depths within the commands included in the original request. Consider the following example:

```javascript
const command = new C4AI_EES.Commands.EXECUTE({
    service: new C4AI_EES(eesSic),
    command: new C4AI_AAC.Commands.EXECUTE({
        service: new C4AI_AAC(aacSic),
        parameters: new C4AI_RequestParameters(
            new C4AI_RequestParameter('foo', 'bar'),
            new C4AI_RequestParameter('foo2', 'bar2'),
            new C4AI_RequestParameter(
                'prompt',
                new C4AI_PLPrompt.Commands.COMPILE({
                    service: new C4AI_PLPrompt(promptSic),
                    parameters: new C4AI_RequestParameters(
                        new C4AI_RequestParameter('foo', 'bar'),
                        new C4AI_RequestParameter('foo2', 'bar2')
                    )
                })
            )
        )
    })
});
```

Upon making a request, the response will always return a Command Request Type. For instance:

```json
C4AI_CommandRequest {
  rawResult: {
    id: 'c4ai-cr::04b3735e-22ec-4de2-b5fa-ff9cc1f40048',
    status: 'COMPLETED',
    mode: 'play',
    command: 'EXECUTE',
    service: 'sic@0000000001:aac-instance:0000000119',
    result: {
      result: 'My neck can be up to 6 feet long, making it the longest neck of any land animal!',
      payload: [Object]
    },
    api: 'sic@0000000001:api-credentials:0000000019',
    organization: 'sic@0000000000:organization:0000000001',
    duration: 1,
    start: '2024-04-30T23:16:54.746Z',
    end: '2024-04-30T23:16:56.264Z',
    createdAt: 'Tue Apr 30 2024 23:16:56 GMT+0000'
  }
}
```

***

This version maintains the original information while adding clarification and detail for better understanding.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cloud4.ai/sdk/request.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
