# IRPCAgent.CallAgentApiV2

Location: [gRPC API](https://developer.m-files.com/APIs/gRPC-API/index.md) > [Vault API](https://developer.m-files.com/APIs/gRPC-API/vault/index.md) > [Aino agents](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCAgent/index.md)

HTML version: https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCAgent/CallAgentApiV2/

Badges: `Vault API / standard` `write` `session` `returns metadata structure version`

Calls version 2 of the Aino agent service API for the session's user and returns the HTTP
status and body. A temporary bridge for M-Files clients that cannot call the agent service
directly; it will be deprecated when they can.

- **Service:** [Aino agents](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCAgent/index.md) `MFiles.IRPCAgent`
- **gRPC method:** `/MFiles.IRPCAgent/CallAgentApiV2`
- **HTTP (mf-http-grpc):** `POST /grpc/v1/call-agent-api-v2`
- **Request:** [`AgentApiV2Request`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCAgent/CallAgentApiV2/index.md#request)
- **Response:** [`AgentApiV2Response`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCAgent/CallAgentApiV2/index.md#response)
- **Book and level:** Vault API, standard
- **Kind:** write
- **Session:** Required: the session ID from LogIn in the mfiles-session-id-bin metadata.
- **Idempotent:** no
- **Returns metadata structure version:** yes (in the mfiles-metadata-version-bin trailer)
- **Streaming:** none (unary)

<a id="remarks"></a>

## Remarks

- Requires a vault session of a user and a vault whose subscription includes Aino.
- The server fixes the API version, the subscription and the vault (the session's). The
  request gives only the path below the vault, the HTTP method and the body.
- `path` may contain only letters, digits, `.`, `_`, `~`, `-` and `/`, with no empty, `.` or
  `..` segments; there is no query string. `method` may be GET, POST (the default), PUT, PATCH
  or DELETE. Other values fail with "The parameter is incorrect.".
- `parameters` must be empty or a JSON object. The server adds its own member
  `_mfserverData` to it (information about the user and the vault that the agent service needs)
  and drops any member of that name, in any letter case, that the caller sent.
- Every HTTP answer, including error statuses, is returned as a successful call with `status`
  and `data`; check `status`. Only a failure to reach the agent service fails the call.
- Not idempotent: a call can start an agent turn.

<a id="request"></a>

## Request: AgentApiV2Request

> Nested message fields are expanded to depth 3; follow a type link for deeper levels and for the type's own page.

| Field | Type | Description |
|---|---|---|
| `method` | `string` | The HTTP method: GET, POST, PUT, PATCH or DELETE. Empty means POST. |
| `path` | `string` | The API path below the vault, for example `conversations`. Without the API version, the vault or a query string. |
| `parameters` | `string` | The request body, a JSON object, or empty for an empty object. |
| `allow_delegation` | `bool` | True to let the agent service call back to the vault as the session's user. Fails with "Not implemented." on servers that do not support it. |

<a id="response"></a>

## Response: AgentApiV2Response

> Nested message fields are expanded to depth 3; follow a type link for deeper levels and for the type's own page.

| Field | Type | Description |
|---|---|---|
| `status` | `int32` | The HTTP status code that the agent service returned. |
| `data` | `string` | The response body as returned by the agent service; empty when it had none. |
