- HTTP request
- Path parameters
- Request body
- Response body
- Authorization scopes
- TextInput
- AudioInput
- EventInput
- DriveOffEvent
- CrewInterjectionEvent
- OrderStateUpdateEvent
- ClientEscalationEvent
- CallerHangupEvent
- PosErrorEvent
- ClientExecutionResult
- FinalizeOrderResponse
- PaymentInfo
- PaymentMethod
- OrderPricesResponse
- ValidateDeliveryAddressResponse
- OrderStatusResponse
- Blob
- Config
- FeatureGate
- ClientAppInfo
- SessionMode
- TurnType
- BidiProcessOrderResponse
- AgentAudio
- SpeechRecognition
- InterruptionSignal
- AgentEvent
- RestartOrder
- ClientExecutionRequest
- FinalizeOrderRequest
- SubmitOrderRequest
- LoyaltyInfo
- LoyaltyAmount
- OrderPricesRequest
- ValidateDeliveryAddressRequest
- OrderStatusRequest
- UpdatedOrderState
- AgentText
- SuggestedOptions
- SuggestedItems
- SuggestedItem
- SuggestedModifiers
- SuggestedModifier
- SuggestedModifierGroups
- SuggestedModGroup
- SentimentMeasurement
- TurnCompleted
- EndSession
- EndType
Performs a single turn logic to process user input and return the result.
HTTP request
POST https://foodorderingaiagent.googleapis.com/v1/{config.session=projects/*/locations/*/sessions/*}:processOrder
The URL uses gRPC Transcoding syntax.
Path parameters
| Parameters | |
|---|---|
config.session |
Required. The session for the order. Format: |
Request body
The request body contains data with the following structure:
| JSON representation |
|---|
{ "config": { "session": string, "store": string, "laneId": string, "enableEchoCancellation": boolean, "daypartId": string, "featureGate": { "menuResponseEnabled": boolean, "updatedOrderStateEnabled": boolean, "enableOrderStatusRetrieval": boolean }, "clientAppInfo": { "deviceModel": string, "osVersion": string, "sdkVersion": string }, "mode": enum ( |
| Fields | |
|---|---|
config.store |
Required. The store the order is being placed for. Format: |
config.laneId |
Optional. The id of a specifc drive through lane. |
config.enableEchoCancellation |
Optional. Whether to enable echo cancellation for the session. If enabled, the client should provide the customerAudio and crewAudio in the AudioInput. |
config.daypartId |
Optional. Daypart of the food menu, including breakfast, lunch, dinner, etc. This is used to determine the menu to use for the order. |
config.featureGate |
Optional. The feature gates for the session. This is used to enable or disable features for the session. |
config.clientAppInfo |
Optional. The information about the client application and device environment. |
config.mode |
Optional. The mode of the session. |
config.channelType |
Optional. The type of channel used for agent communication. |
config.enableListenOnlyDualChannel |
Optional. Whether to enable listen-only dual channel for the session. If enabled, the client should provide the customerAudio and crewAudio in the AudioInput, and CES will do EAC and summation on media processing server. |
config.testSessionStartTime |
Optional. The start time of the session, used for testing or evaluation purposes. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
turnType |
Optional. Explicit indicator of the request's position in the session lifecycle. Allows clients to deterministically control when initial session setup variables are injected. |
Union field input. The input from the client. input can be only one of the following: |
|
textInput |
The text input from the client. |
audioInput |
The audio input from the client. |
eventInput |
The event input from the client. |
clientExecutionResult |
The result of a client execution request. |
blobInput |
Generic binary data input. Mirrors http://google3/google/cloud/ces/v1main/session_service.proto?l=720 |
Response body
Response message for FoodOrderingService.ProcessOrder. Functionally contains fields from BidiProcessOrderResponse minus streaming-specific ones.
If successful, the response body contains data with the following structure:
| JSON representation |
|---|
{
"responses": [
{
object ( |
| Fields | |
|---|---|
responses[] |
Output only. List of agent responses to the request, returned in-order. |
Authorization scopes
Requires the following OAuth scope:
https://www.googleapis.com/auth/cloud-platform
For more information, see the Authentication Overview.
TextInput
The text input from the client. Instead of audio, the client can alternatively send text input to the agent. A client must use either text or audio input, not both.
| JSON representation |
|---|
{ "text": string } |
| Fields | |
|---|---|
text |
Required. The text utterance from the client. |
AudioInput
The audio input from the client. The input audio may have multiple channels for the customer, crew, etc. These should all be synchronized and in the format specified in the config. Audio headers should not be included. By default, the audio should be using 16-bit linear PCM audio encoding and 16000 Hz sample rate. Total bytes from all channels should be less than 25600 bytes.
| JSON representation |
|---|
{ "customerAudio": string, "crewAudio": string } |
| Fields | |
|---|---|
customerAudio |
Required. Customer audio data. A base64-encoded string. |
crewAudio |
Optional. Crew audio data. This is an optional audio channel for the crew member in the same lane as the customer, and served as the reference audio for echo cancellation. A base64-encoded string. |
EventInput
The event input from the client. This is used to trigger specific events within the agent.
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field event. Next ID: 10 The event to trigger. event can be only one of the following: |
|
driveOffEvent |
The drive off event. |
crewInterjectionEvent |
The crew interjection event. |
updateOrderStateEvent |
A client-side update to the order state. |
clientEscalationEvent |
A client-side escalation event. |
callerHangupEvent |
Optional. A caller hangup event. |
posErrorInput |
Optional. A POS error event. |
DriveOffEvent
The drive off event. This indicates the customer drove off. Session will be closed after this event.
| JSON representation |
|---|
{ "reason": string } |
| Fields | |
|---|---|
reason |
Optional. The reason for drive off e.g. "order completed", "unexpected driveoff". |
CrewInterjectionEvent
The crew interjection event. This indicates a crew member interjected in the session. Session will be closed after this event.
| JSON representation |
|---|
{ "mode": string } |
| Fields | |
|---|---|
mode |
Optional. The mode in which the crew member interjected, e.g. "headset", "pos". |
OrderStateUpdateEvent
The update order state request. This event should be sent when the order is updated on the client side, e.g. when an item is added or removed via a traditional touch interface.
| JSON representation |
|---|
{
"order": {
object ( |
| Fields | |
|---|---|
order |
Required. The updated state of the Order associated with this session. |
ClientEscalationEvent
Indicates the client is escalating the session to a human agent.
| JSON representation |
|---|
{ "reason": string } |
| Fields | |
|---|---|
reason |
Optional. The reason for client escalation e.g. "payment-declined", "pos-error", "integration-error" etc. |
CallerHangupEvent
This type has no fields.
Indicates the customer hung up the call prematurely (e.g., AI aversion).
PosErrorEvent
Point-of-Sale (POS) specific failures.
| JSON representation |
|---|
{ "errorMessages": [ string ], "affectedItemUids": [ string ], "affectedExternalIds": [ string ], "metadata": { string: string, ... } } |
| Fields | |
|---|---|
errorMessages[] |
Optional. A list of human-readable descriptions of the errors. Multiple error messages can be provided if multiple issues occur simultaneously (e.g., multiple items are out of stock) or to provide a more detailed breakdown of a single complex failure. These messages may be used by the agent to inform the customer or for logging purposes. |
affectedItemUids[] |
Optional. Unique item UIDs generated by the Food Ordering AI Agent that caused the error. Corresponds to |
affectedExternalIds[] |
Optional. List of external IDs (from the Menu) that caused the error. Should be equal to the actual representatives in the POS, which are usually under integration attributes in menu.proto (e.g., in |
metadata |
Optional. Free-form metadata for debugging or brand-specific signaling. Can be used to pass brand-specific error codes or categories (e.g., {"BRAND_ERROR_CODE": "OUT_OF_STOCK"}). An object containing a list of |
ClientExecutionResult
The result of a client execution request.
| JSON representation |
|---|
{ "executionId": string, // Union field |
| Fields | |
|---|---|
executionId |
Required. The ID of the execution request this is a result for. |
Union field response. The specific result of the execution. response can be only one of the following: |
|
finalizeOrderResponse |
The result of finalizing the order. |
orderPricesResponse |
The result of getting the order prices. |
validateDeliveryAddressResponse |
The result of validating the delivery address. |
orderStatusResponse |
The result of getting the order status. |
FinalizeOrderResponse
The result of finalizing the order.
| JSON representation |
|---|
{ "paymentFlowEnabled": boolean, "paymentInfo": { object ( |
| Fields | |
|---|---|
paymentFlowEnabled |
Optional. Whether to enable the payment handling flow in the agent. |
paymentInfo |
Optional. The payment information of the customer. No-op if paymentFlowEnabled is false. |
totalAmountDue |
Optional. The total amount due for the order. |
orderPriceInfo |
Optional. The detailed price information of the order. |
PaymentInfo
Payment information of the user.
| JSON representation |
|---|
{
"creditCardLastFourDigits": string,
"creditCardCvv": string,
"paymentMethod": enum ( |
| Fields | |
|---|---|
creditCardLastFourDigits |
Optional. The last four digits of the credit card. This is used to verify the credit card number at the payment stage. |
creditCardCvv |
Optional. CVV of the credit card. |
paymentMethod |
Optional. The type of payment method used. |
PaymentMethod
The type of payment method.
| Enums | |
|---|---|
PAYMENT_METHOD_UNSPECIFIED |
Unspecified payment method. |
PAYMENT_METHOD_CREDIT_CARD |
Credit card. |
PAYMENT_METHOD_CASH |
Cash. |
OrderPricesResponse
The result of getting the order prices.
| JSON representation |
|---|
{
"success": boolean,
"orderPriceInfo": {
object ( |
| Fields | |
|---|---|
success |
Required. Whether the order prices were successfully retrieved. |
orderPriceInfo |
Optional. Total order price after all discounts, fees, taxes, etc |
ValidateDeliveryAddressResponse
The result of validating a delivery address.
| JSON representation |
|---|
{
"success": boolean,
"validationStatus": enum ( |
| Fields | |
|---|---|
success |
Required. Whether or not the validation completed without error. |
validationStatus |
Required. The validation status of the delivery address. |
OrderStatusResponse
The result of getting the order status.
| JSON representation |
|---|
{ "success": boolean } |
| Fields | |
|---|---|
success |
Required. Whether the order status was successfully retrieved. |
Blob
Represents a blob input or output in the conversation.
| JSON representation |
|---|
{ "mimeType": string, "data": string } |
| Fields | |
|---|---|
mimeType |
Required. The IANA standard MIME type of the source data. |
data |
Required. Raw bytes of the blob. A base64-encoded string. |
Config
The configuration for a session and food ordering properties. At the start of each connection, the client must first send a config message. This must happen before any other requests to initiate the session. If the client disconnects, they should repeat the same config message when they reconnect.
| JSON representation |
|---|
{ "session": string, "store": string, "laneId": string, "enableEchoCancellation": boolean, "daypartId": string, "featureGate": { object ( |
| Fields | |
|---|---|
session |
Required. The session for the order. Format: |
store |
Required. The store the order is being placed for. Format: |
laneId |
Optional. The id of a specifc drive through lane. |
enableEchoCancellation |
Optional. Whether to enable echo cancellation for the session. If enabled, the client should provide the customerAudio and crewAudio in the AudioInput. |
daypartId |
Optional. Daypart of the food menu, including breakfast, lunch, dinner, etc. This is used to determine the menu to use for the order. |
featureGate |
Optional. The feature gates for the session. This is used to enable or disable features for the session. |
clientAppInfo |
Optional. The information about the client application and device environment. |
mode |
Optional. The mode of the session. |
channelType |
Optional. The type of channel used for agent communication. |
enableListenOnlyDualChannel |
Optional. Whether to enable listen-only dual channel for the session. If enabled, the client should provide the customerAudio and crewAudio in the AudioInput, and CES will do EAC and summation on media processing server. |
testSessionStartTime |
Optional. The start time of the session, used for testing or evaluation purposes. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
FeatureGate
The feature gates for the session. This is used to enable or disable features for the session.
| JSON representation |
|---|
{ "menuResponseEnabled": boolean, "updatedOrderStateEnabled": boolean, "enableOrderStatusRetrieval": boolean } |
| Fields | |
|---|---|
menuResponseEnabled |
Optional. Returns the menu data to the client in BidiProcessOrderResponse if set. |
updatedOrderStateEnabled |
Optional. If set, updatedOrderState is returned instead of legacyOrderStateResponse. |
enableOrderStatusRetrieval |
Optional. If set, the agent will support order status retrieval. |
ClientAppInfo
Information about the client application and device environment. This is primarily used for logging, analytics, and debugging.
| JSON representation |
|---|
{ "deviceModel": string, "osVersion": string, "sdkVersion": string } |
| Fields | |
|---|---|
deviceModel |
Optional. The device model of the client (e.g., "iPhone 13", "Pixel 7", "Kiosk v2"). |
osVersion |
Optional. The operating system version of the client (e.g., "iOS 16.1", "Android 13"). |
sdkVersion |
Optional. The version of the client SDK or application software. |
SessionMode
The mode of the session.
| Enums | |
|---|---|
SESSION_MODE_UNSPECIFIED |
The session mode is not specified. |
HYBRID |
The session supports both audio and text. This is the default. |
TEXT |
The session is text-only. |
TurnType
Represents the lifecycle position of a unary request within a session.
| Enums | |
|---|---|
TURN_TYPE_UNSPECIFIED |
Unspecified turn type. |
INITIALIZE |
Explicitly indicates this request initializes the session in unary mode. When set, initial session variables (e.g., store metadata and menus) are injected into CES. |
SUBSEQUENT |
Explicitly indicates a subsequent conversational turn or mid-session update. When set, initial session variables are omitted to prevent input token explosion. |
BidiProcessOrderResponse
The top-level message returned from FoodOrderingService.BidiProcessOrder method.
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field response. The response from the agent. response can be only one of the following: |
|
agentAudio |
The audio response from the agent. |
speechRecognition |
The speech recognition result from the agent. |
legacyOrderStateResponse |
The legacy order state response for a session. |
interruptionSignal |
Interruption signal detected from the audio input. |
agentEvent |
Event from the agent. |
clientExecutionRequest |
The request forward to the client to execute. This is used for client side execution, such as adding a code to the order. |
updatedOrderState |
Indicates an update to the order state. Includes the complete state of the order. |
agentText |
The text response from the agent. |
suggestedOptions |
Options to suggest to the customer. |
sentimentMeasurement |
The realtime sentiment score measured for this turn. |
turnCompleted |
Turn Completed message. |
endSession |
Indicates that the session is ending, and that this will be the last turn. The agent will finish sending any pending responses for the current turn, and then send a final turnCompleted message. The agent will not start any new turns. For example, a 2 turn session will look like:
|
AgentAudio
The audio response from the agent.
| JSON representation |
|---|
{ "agentAudio": string } |
| Fields | |
|---|---|
agentAudio |
The audio data from the agent. A base64-encoded string. |
SpeechRecognition
The speech recognition result from the agent.
| JSON representation |
|---|
{ "transcript": string, "languageCode": string, "isFinal": boolean } |
| Fields | |
|---|---|
transcript |
Transcribed text from the audio input in the detected language. |
languageCode |
The language code of the transcript. The language code should be in BCP-47 format, such as "en-US". |
isFinal |
Indicates whether this is the final transcript for the turn. |
InterruptionSignal
This type has no fields.
Indicates the agent's audio response has been interrupted (e.g. by end user barge-in). Client should stop playback immediately.
AgentEvent
Special event from the agent that needs client to take action.
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field event. The event from the agent. event can be only one of the following: |
|
restartOrder |
Customer requests to restart the order. |
RestartOrder
Customer requests to start over the order.
| JSON representation |
|---|
{ "confirmationStep": boolean } |
| Fields | |
|---|---|
confirmationStep |
The agent is asking the customer to confirm the restarting request. |
ClientExecutionRequest
A request to the for client side to execute a command.
| JSON representation |
|---|
{ "executionId": string, // Union field |
| Fields | |
|---|---|
executionId |
Required. A unique ID for this execution request. |
Union field request. The specific request to be executed. request can be only one of the following: |
|
finalizeOrderRequest |
A request to finalize the order. |
submitOrderRequest |
A request to submit the order. |
orderPricesRequest |
A request to get the order prices. |
validateDeliveryAddressRequest |
A request to validate the delivery address. |
orderStatusRequest |
A request to get the order status. |
FinalizeOrderRequest
This type has no fields.
A request to finalize the order. This is typically sent by the agent when the customer indicates they are done ordering and want to pay.
SubmitOrderRequest
A request to submit the order, with all the required payment information collected from the customer.
| JSON representation |
|---|
{ "paymentInfo": { object ( |
| Fields | |
|---|---|
paymentInfo |
Required. The payment information for the order. |
loyaltyInfo |
Optional. The loyalty consumed for the order. |
tipAmount |
Optional. The tip amount for the order. |
LoyaltyInfo
Represents a customer's loyalty information.
| JSON representation |
|---|
{
"loyaltyAmount": {
object ( |
| Fields | |
|---|---|
loyaltyAmount |
Required. The loyalty amount. This can be a loyalty balance or loyalty consumed. |
LoyaltyAmount
Represents a customer's loyalty amount.
| JSON representation |
|---|
{ "units": string } |
| Fields | |
|---|---|
units |
Required. The loyalty points. |
OrderPricesRequest
A request to get the order prices.
| JSON representation |
|---|
{
"order": {
object ( |
| Fields | |
|---|---|
order |
Optional. The order to get the prices for. If not specified, we can assume the request is for the existing order/cart in the session. |
ValidateDeliveryAddressRequest
A request to validate a delivery address collected during the session.
| JSON representation |
|---|
{
"deliveryAddress": {
object ( |
| Fields | |
|---|---|
deliveryAddress |
Required. The delivery address to validate. |
OrderStatusRequest
This type has no fields.
A request to get the order status.
UpdatedOrderState
Event returned by the agent representing an update to the order state.
| JSON representation |
|---|
{
"order": {
object ( |
| Fields | |
|---|---|
order |
The updated state of the Order associated with this session. |
changed |
Output only. Whether the order state has updates. |
AgentText
The text response from the agent.
| JSON representation |
|---|
{ "text": string } |
| Fields | |
|---|---|
text |
The text response from the agent. |
SuggestedOptions
Options to suggest to the customer.
| JSON representation |
|---|
{ "suggestedModifierGroups": { object ( |
| Fields | |
|---|---|
suggestedModifierGroups |
A group of suggested modifiers. |
Union field suggested_options. The suggested options. suggested_options can be only one of the following: |
|
suggestedItems |
A list of items to suggest to the customer. |
suggestedModifiers |
A list of modifiers to suggest to the customer. |
SuggestedItems
A list of items to suggest to the customer.
| JSON representation |
|---|
{
"items": [
{
object ( |
| Fields | |
|---|---|
items[] |
The items to suggest to the customer. |
SuggestedItem
An item to suggest to the customer.
| JSON representation |
|---|
{ "itemId": string, "displayName": string, "image": { object ( |
| Fields | |
|---|---|
itemId |
ID of the item in the menu. |
displayName |
Human-readable name for this tem to be shown on user interfaces. |
image |
Image to display for this item in the UI. |
basePrice |
The base price of the item. This may be affected by the selected modifiers. This is the price per unit of the item. |
integrationAttributes |
Metadata associated with this entity used for downstream integrations. |
SuggestedModifiers
A list of modifiers to suggest to the customer.
| JSON representation |
|---|
{
"modifiers": [
{
object ( |
| Fields | |
|---|---|
modifiers[] |
The modifiers to suggest to the customer. |
parentUid |
The unique identifier of the parent item/modifier to apply the modifiers to. |
SuggestedModifier
A modifier to suggest to the customer.
| JSON representation |
|---|
{ "modifierId": string, "modifierGroupId": string, "modifierGroupDisplayName": string, "displayName": string, "image": { object ( |
| Fields | |
|---|---|
modifierId |
ID of the modifier in the menu. |
modifierGroupId |
ID of the modifier group that this modifier should be added to if the suggestion is accepted. |
modifierGroupDisplayName |
Display name of the modifier group that this modifier belongs to. |
displayName |
Human-readable name for this tem to be shown on user interfaces. |
image |
Image to display for this item in the UI. |
priceAdjustment |
The price adjustment associated with this modifier, if any. This is the price per unit of the modifier. |
integrationAttributes |
Metadata associated with this entity used for downstream integrations. |
alreadyIncluded |
Whether this modifier is already included in the order. |
SuggestedModifierGroups
A list of modifier groups to suggest to the customer.
| JSON representation |
|---|
{
"modifierGroups": [
{
object ( |
| Fields | |
|---|---|
modifierGroups[] |
The modifier groups to suggest to the customer. |
SuggestedModGroup
A modifier group to suggest to the customer.
| JSON representation |
|---|
{
"modifierGroupId": string,
"displayName": string,
"modifiers": [
{
object ( |
| Fields | |
|---|---|
modifierGroupId |
ID of the modifier group in the menu. |
displayName |
The display name of the modifier group. |
modifiers[] |
The modifiers in this group. |
maxSelectionCount |
The maximum number of modifiers that can be selected from this group. |
minSelectionCount |
The minimum number of modifiers that must be selected from this group. |
maxSelectionCountPerModifier |
Limits the number of times each modifier can be applied within this group. |
SentimentMeasurement
The realtime sentiment score measured for this turn.
| JSON representation |
|---|
{ "score": number, "magnitude": number } |
| Fields | |
|---|---|
score |
Optional. Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment). |
magnitude |
Optional. Magnitude of sentiment, regardless of score. |
TurnCompleted
This type has no fields.
Indicates that the Food AI agent has detected the end of the current conversation turn and will provide no further output for this turn.
EndSession
Indicates the agent has terminated the session, due to either successful completion (e.g. user says "Good bye!" ) or an agent escalation.
| JSON representation |
|---|
{ "type": enum ( |
| Fields | |
|---|---|
type |
The type of end session event. |
reason |
The reason for ending the session. |
posResponse |
Optional. The POS response from checking in the order (optional). This is an opaque string payload representing the POS transaction status. |
agentResponse |
Optional. The final agent response message to be spoken/displayed to the user (optional). |
storeSchedule |
Optional. The store schedule. This is only set when the end type is STORE_CLOSED. |
EndType
Type of end session event.
| Enums | |
|---|---|
END_TYPE_UNSPECIFIED |
The end type is not specified. |
DRIVE_OFF |
The customer drove off. |
AGENT_ESCALATION |
The agent escalated the session to a human agent. |
CREW_INTERJECTION |
A crew member interjected in the session. |
ORDER_COMPLETED |
Order was successfully completed and no further action is needed. |
PAYMENT_FLOW_SUCCESS |
The payment flow was successful and no further action is needed. |
PAYMENT_FLOW_FAILURE |
The payment flow failed. |
CLIENT_ESCALATION |
The client escalated the session to a human agent. |
CALLER_HANGUP |
The customer hung up the call prematurely. |
REQUESTED_CHECKOUT |
The customer requested to check out. |
REQUESTED_ORDER_STATUS |
The customer asked about their order status. |
STORE_CLOSED |
The store is closed. |