Dialogflow v3 API - Class AgentsClient (2.9.0)

public abstract class AgentsClient

Reference documentation and code samples for the Dialogflow v3 API class AgentsClient.

Agents client wrapper, for convenient use.

Inheritance

object > AgentsClient

Derived Types

Namespace

Google.Cloud.Dialogflow.Cx.V3

Assembly

Google.Cloud.Dialogflow.Cx.V3.dll

Remarks

Service for managing [Agents][google.cloud.dialogflow.cx.v3.Agent].

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the Agents service, which is a host of "dialogflow.googleapis.com" and a port of 443.

Property Value
TypeDescription
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default Agents scopes.

Property Value
TypeDescription
IReadOnlyListstring
Remarks

ExportAgentOperationsClient

public virtual OperationsClient ExportAgentOperationsClient { get; }

The long-running operations client for ExportAgent.

Property Value
TypeDescription
OperationsClient

GrpcClient

public virtual Agents.AgentsClient GrpcClient { get; }

The underlying gRPC Agents client

Property Value
TypeDescription
AgentsAgentsClient

LocationsClient

public virtual LocationsClient LocationsClient { get; }

The LocationsClient associated with this client.

Property Value
TypeDescription
LocationsClient

RestoreAgentOperationsClient

public virtual OperationsClient RestoreAgentOperationsClient { get; }

The long-running operations client for RestoreAgent.

Property Value
TypeDescription
OperationsClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
TypeDescription
ServiceMetadata

Methods

Create()

public static AgentsClient Create()

Synchronously creates a AgentsClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use AgentsClientBuilder.

Returns
TypeDescription
AgentsClient

The created AgentsClient.

CreateAgent(LocationName, Agent, CallSettings)

public virtual Agent CreateAgent(LocationName parent, Agent agent, CallSettings callSettings = null)

Creates an agent in the specified location.

Note: You should always train flows prior to sending them queries. See the training documentation.

Parameters
NameDescription
parentLocationName

Required. The location to create a agent for. Format: projects/<Project ID>/locations/<Location ID>.

agentAgent

Required. The agent to create.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Agent

The RPC response.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
Agent agent = new Agent();
// Make the request
Agent response = agentsClient.CreateAgent(parent, agent);

CreateAgent(CreateAgentRequest, CallSettings)

public virtual Agent CreateAgent(CreateAgentRequest request, CallSettings callSettings = null)

Creates an agent in the specified location.

Note: You should always train flows prior to sending them queries. See the training documentation.

Parameters
NameDescription
requestCreateAgentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Agent

The RPC response.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
CreateAgentRequest request = new CreateAgentRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Agent = new Agent(),
};
// Make the request
Agent response = agentsClient.CreateAgent(request);

CreateAgent(string, Agent, CallSettings)

public virtual Agent CreateAgent(string parent, Agent agent, CallSettings callSettings = null)

Creates an agent in the specified location.

Note: You should always train flows prior to sending them queries. See the training documentation.

Parameters
NameDescription
parentstring

Required. The location to create a agent for. Format: projects/<Project ID>/locations/<Location ID>.

agentAgent

Required. The agent to create.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Agent

The RPC response.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
Agent agent = new Agent();
// Make the request
Agent response = agentsClient.CreateAgent(parent, agent);

CreateAgentAsync(LocationName, Agent, CallSettings)

public virtual Task<Agent> CreateAgentAsync(LocationName parent, Agent agent, CallSettings callSettings = null)

Creates an agent in the specified location.

Note: You should always train flows prior to sending them queries. See the training documentation.

Parameters
NameDescription
parentLocationName

Required. The location to create a agent for. Format: projects/<Project ID>/locations/<Location ID>.

agentAgent

Required. The agent to create.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskAgent

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
Agent agent = new Agent();
// Make the request
Agent response = await agentsClient.CreateAgentAsync(parent, agent);

CreateAgentAsync(LocationName, Agent, CancellationToken)

public virtual Task<Agent> CreateAgentAsync(LocationName parent, Agent agent, CancellationToken cancellationToken)

Creates an agent in the specified location.

Note: You should always train flows prior to sending them queries. See the training documentation.

Parameters
NameDescription
parentLocationName

Required. The location to create a agent for. Format: projects/<Project ID>/locations/<Location ID>.

agentAgent

Required. The agent to create.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskAgent

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
Agent agent = new Agent();
// Make the request
Agent response = await agentsClient.CreateAgentAsync(parent, agent);

CreateAgentAsync(CreateAgentRequest, CallSettings)

public virtual Task<Agent> CreateAgentAsync(CreateAgentRequest request, CallSettings callSettings = null)

Creates an agent in the specified location.

Note: You should always train flows prior to sending them queries. See the training documentation.

Parameters
NameDescription
requestCreateAgentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskAgent

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
CreateAgentRequest request = new CreateAgentRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Agent = new Agent(),
};
// Make the request
Agent response = await agentsClient.CreateAgentAsync(request);

CreateAgentAsync(CreateAgentRequest, CancellationToken)

public virtual Task<Agent> CreateAgentAsync(CreateAgentRequest request, CancellationToken cancellationToken)

Creates an agent in the specified location.

Note: You should always train flows prior to sending them queries. See the training documentation.

Parameters
NameDescription
requestCreateAgentRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskAgent

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
CreateAgentRequest request = new CreateAgentRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Agent = new Agent(),
};
// Make the request
Agent response = await agentsClient.CreateAgentAsync(request);

CreateAgentAsync(string, Agent, CallSettings)

public virtual Task<Agent> CreateAgentAsync(string parent, Agent agent, CallSettings callSettings = null)

Creates an agent in the specified location.

Note: You should always train flows prior to sending them queries. See the training documentation.

Parameters
NameDescription
parentstring

Required. The location to create a agent for. Format: projects/<Project ID>/locations/<Location ID>.

agentAgent

Required. The agent to create.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskAgent

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
Agent agent = new Agent();
// Make the request
Agent response = await agentsClient.CreateAgentAsync(parent, agent);

CreateAgentAsync(string, Agent, CancellationToken)

public virtual Task<Agent> CreateAgentAsync(string parent, Agent agent, CancellationToken cancellationToken)

Creates an agent in the specified location.

Note: You should always train flows prior to sending them queries. See the training documentation.

Parameters
NameDescription
parentstring

Required. The location to create a agent for. Format: projects/<Project ID>/locations/<Location ID>.

agentAgent

Required. The agent to create.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskAgent

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
Agent agent = new Agent();
// Make the request
Agent response = await agentsClient.CreateAgentAsync(parent, agent);

CreateAsync(CancellationToken)

public static Task<AgentsClient> CreateAsync(CancellationToken cancellationToken = default)

Asynchronously creates a AgentsClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use AgentsClientBuilder.

Parameter
NameDescription
cancellationTokenCancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
TaskAgentsClient

The task representing the created AgentsClient.

DeleteAgent(AgentName, CallSettings)

public virtual void DeleteAgent(AgentName name, CallSettings callSettings = null)

Deletes the specified agent.

Parameters
NameDescription
nameAgentName

Required. The name of the agent to delete. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
AgentName name = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]");
// Make the request
agentsClient.DeleteAgent(name);

DeleteAgent(DeleteAgentRequest, CallSettings)

public virtual void DeleteAgent(DeleteAgentRequest request, CallSettings callSettings = null)

Deletes the specified agent.

Parameters
NameDescription
requestDeleteAgentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
DeleteAgentRequest request = new DeleteAgentRequest
{
    AgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
};
// Make the request
agentsClient.DeleteAgent(request);

DeleteAgent(string, CallSettings)

public virtual void DeleteAgent(string name, CallSettings callSettings = null)

Deletes the specified agent.

Parameters
NameDescription
namestring

Required. The name of the agent to delete. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/agents/[AGENT]";
// Make the request
agentsClient.DeleteAgent(name);

DeleteAgentAsync(AgentName, CallSettings)

public virtual Task DeleteAgentAsync(AgentName name, CallSettings callSettings = null)

Deletes the specified agent.

Parameters
NameDescription
nameAgentName

Required. The name of the agent to delete. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
AgentName name = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]");
// Make the request
await agentsClient.DeleteAgentAsync(name);

DeleteAgentAsync(AgentName, CancellationToken)

public virtual Task DeleteAgentAsync(AgentName name, CancellationToken cancellationToken)

Deletes the specified agent.

Parameters
NameDescription
nameAgentName

Required. The name of the agent to delete. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
AgentName name = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]");
// Make the request
await agentsClient.DeleteAgentAsync(name);

DeleteAgentAsync(DeleteAgentRequest, CallSettings)

public virtual Task DeleteAgentAsync(DeleteAgentRequest request, CallSettings callSettings = null)

Deletes the specified agent.

Parameters
NameDescription
requestDeleteAgentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
DeleteAgentRequest request = new DeleteAgentRequest
{
    AgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
};
// Make the request
await agentsClient.DeleteAgentAsync(request);

DeleteAgentAsync(DeleteAgentRequest, CancellationToken)

public virtual Task DeleteAgentAsync(DeleteAgentRequest request, CancellationToken cancellationToken)

Deletes the specified agent.

Parameters
NameDescription
requestDeleteAgentRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
DeleteAgentRequest request = new DeleteAgentRequest
{
    AgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
};
// Make the request
await agentsClient.DeleteAgentAsync(request);

DeleteAgentAsync(string, CallSettings)

public virtual Task DeleteAgentAsync(string name, CallSettings callSettings = null)

Deletes the specified agent.

Parameters
NameDescription
namestring

Required. The name of the agent to delete. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/agents/[AGENT]";
// Make the request
await agentsClient.DeleteAgentAsync(name);

DeleteAgentAsync(string, CancellationToken)

public virtual Task DeleteAgentAsync(string name, CancellationToken cancellationToken)

Deletes the specified agent.

Parameters
NameDescription
namestring

Required. The name of the agent to delete. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/agents/[AGENT]";
// Make the request
await agentsClient.DeleteAgentAsync(name);

ExportAgent(ExportAgentRequest, CallSettings)

public virtual Operation<ExportAgentResponse, Struct> ExportAgent(ExportAgentRequest request, CallSettings callSettings = null)

Exports the specified agent to a binary file.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: An empty Struct message
  • response: [ExportAgentResponse][google.cloud.dialogflow.cx.v3.ExportAgentResponse]
Parameters
NameDescription
requestExportAgentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationExportAgentResponseStruct

The RPC response.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
ExportAgentRequest request = new ExportAgentRequest
{
    AgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
    AgentUri = "",
    DataFormat = ExportAgentRequest.Types.DataFormat.Unspecified,
    EnvironmentAsEnvironmentName = EnvironmentName.FromProjectLocationAgentEnvironment("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]"),
    GitDestination = new ExportAgentRequest.Types.GitDestination(),
    IncludeBigqueryExportSettings = false,
};
// Make the request
Operation<ExportAgentResponse, Struct> response = agentsClient.ExportAgent(request);

// Poll until the returned long-running operation is complete
Operation<ExportAgentResponse, Struct> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
ExportAgentResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<ExportAgentResponse, Struct> retrievedResponse = agentsClient.PollOnceExportAgent(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    ExportAgentResponse retrievedResult = retrievedResponse.Result;
}

ExportAgentAsync(ExportAgentRequest, CallSettings)

public virtual Task<Operation<ExportAgentResponse, Struct>> ExportAgentAsync(ExportAgentRequest request, CallSettings callSettings = null)

Exports the specified agent to a binary file.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: An empty Struct message
  • response: [ExportAgentResponse][google.cloud.dialogflow.cx.v3.ExportAgentResponse]
Parameters
NameDescription
requestExportAgentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationExportAgentResponseStruct

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
ExportAgentRequest request = new ExportAgentRequest
{
    AgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
    AgentUri = "",
    DataFormat = ExportAgentRequest.Types.DataFormat.Unspecified,
    EnvironmentAsEnvironmentName = EnvironmentName.FromProjectLocationAgentEnvironment("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]"),
    GitDestination = new ExportAgentRequest.Types.GitDestination(),
    IncludeBigqueryExportSettings = false,
};
// Make the request
Operation<ExportAgentResponse, Struct> response = await agentsClient.ExportAgentAsync(request);

// Poll until the returned long-running operation is complete
Operation<ExportAgentResponse, Struct> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
ExportAgentResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<ExportAgentResponse, Struct> retrievedResponse = await agentsClient.PollOnceExportAgentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    ExportAgentResponse retrievedResult = retrievedResponse.Result;
}

ExportAgentAsync(ExportAgentRequest, CancellationToken)

public virtual Task<Operation<ExportAgentResponse, Struct>> ExportAgentAsync(ExportAgentRequest request, CancellationToken cancellationToken)

Exports the specified agent to a binary file.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: An empty Struct message
  • response: [ExportAgentResponse][google.cloud.dialogflow.cx.v3.ExportAgentResponse]
Parameters
NameDescription
requestExportAgentRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationExportAgentResponseStruct

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
ExportAgentRequest request = new ExportAgentRequest
{
    AgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
    AgentUri = "",
    DataFormat = ExportAgentRequest.Types.DataFormat.Unspecified,
    EnvironmentAsEnvironmentName = EnvironmentName.FromProjectLocationAgentEnvironment("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]"),
    GitDestination = new ExportAgentRequest.Types.GitDestination(),
    IncludeBigqueryExportSettings = false,
};
// Make the request
Operation<ExportAgentResponse, Struct> response = await agentsClient.ExportAgentAsync(request);

// Poll until the returned long-running operation is complete
Operation<ExportAgentResponse, Struct> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
ExportAgentResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<ExportAgentResponse, Struct> retrievedResponse = await agentsClient.PollOnceExportAgentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    ExportAgentResponse retrievedResult = retrievedResponse.Result;
}

GetAgent(AgentName, CallSettings)

public virtual Agent GetAgent(AgentName name, CallSettings callSettings = null)

Retrieves the specified agent.

Parameters
NameDescription
nameAgentName

Required. The name of the agent. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Agent

The RPC response.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
AgentName name = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]");
// Make the request
Agent response = agentsClient.GetAgent(name);

GetAgent(GetAgentRequest, CallSettings)

public virtual Agent GetAgent(GetAgentRequest request, CallSettings callSettings = null)

Retrieves the specified agent.

Parameters
NameDescription
requestGetAgentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Agent

The RPC response.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
GetAgentRequest request = new GetAgentRequest
{
    AgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
};
// Make the request
Agent response = agentsClient.GetAgent(request);

GetAgent(string, CallSettings)

public virtual Agent GetAgent(string name, CallSettings callSettings = null)

Retrieves the specified agent.

Parameters
NameDescription
namestring

Required. The name of the agent. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Agent

The RPC response.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/agents/[AGENT]";
// Make the request
Agent response = agentsClient.GetAgent(name);

GetAgentAsync(AgentName, CallSettings)

public virtual Task<Agent> GetAgentAsync(AgentName name, CallSettings callSettings = null)

Retrieves the specified agent.

Parameters
NameDescription
nameAgentName

Required. The name of the agent. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskAgent

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
AgentName name = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]");
// Make the request
Agent response = await agentsClient.GetAgentAsync(name);

GetAgentAsync(AgentName, CancellationToken)

public virtual Task<Agent> GetAgentAsync(AgentName name, CancellationToken cancellationToken)

Retrieves the specified agent.

Parameters
NameDescription
nameAgentName

Required. The name of the agent. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskAgent

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
AgentName name = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]");
// Make the request
Agent response = await agentsClient.GetAgentAsync(name);

GetAgentAsync(GetAgentRequest, CallSettings)

public virtual Task<Agent> GetAgentAsync(GetAgentRequest request, CallSettings callSettings = null)

Retrieves the specified agent.

Parameters
NameDescription
requestGetAgentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskAgent

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
GetAgentRequest request = new GetAgentRequest
{
    AgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
};
// Make the request
Agent response = await agentsClient.GetAgentAsync(request);

GetAgentAsync(GetAgentRequest, CancellationToken)

public virtual Task<Agent> GetAgentAsync(GetAgentRequest request, CancellationToken cancellationToken)

Retrieves the specified agent.

Parameters
NameDescription
requestGetAgentRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskAgent

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
GetAgentRequest request = new GetAgentRequest
{
    AgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
};
// Make the request
Agent response = await agentsClient.GetAgentAsync(request);

GetAgentAsync(string, CallSettings)

public virtual Task<Agent> GetAgentAsync(string name, CallSettings callSettings = null)

Retrieves the specified agent.

Parameters
NameDescription
namestring

Required. The name of the agent. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskAgent

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/agents/[AGENT]";
// Make the request
Agent response = await agentsClient.GetAgentAsync(name);

GetAgentAsync(string, CancellationToken)

public virtual Task<Agent> GetAgentAsync(string name, CancellationToken cancellationToken)

Retrieves the specified agent.

Parameters
NameDescription
namestring

Required. The name of the agent. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskAgent

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/agents/[AGENT]";
// Make the request
Agent response = await agentsClient.GetAgentAsync(name);

GetAgentValidationResult(AgentValidationResultName, CallSettings)

public virtual AgentValidationResult GetAgentValidationResult(AgentValidationResultName name, CallSettings callSettings = null)

Gets the latest agent validation result. Agent validation is performed when ValidateAgent is called.

Parameters
NameDescription
nameAgentValidationResultName

Required. The agent name. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/validationResult.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
AgentValidationResult

The RPC response.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
AgentValidationResultName name = AgentValidationResultName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]");
// Make the request
AgentValidationResult response = agentsClient.GetAgentValidationResult(name);

GetAgentValidationResult(GetAgentValidationResultRequest, CallSettings)

public virtual AgentValidationResult GetAgentValidationResult(GetAgentValidationResultRequest request, CallSettings callSettings = null)

Gets the latest agent validation result. Agent validation is performed when ValidateAgent is called.

Parameters
NameDescription
requestGetAgentValidationResultRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
AgentValidationResult

The RPC response.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
GetAgentValidationResultRequest request = new GetAgentValidationResultRequest
{
    AgentValidationResultName = AgentValidationResultName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
    LanguageCode = "",
};
// Make the request
AgentValidationResult response = agentsClient.GetAgentValidationResult(request);

GetAgentValidationResult(string, CallSettings)

public virtual AgentValidationResult GetAgentValidationResult(string name, CallSettings callSettings = null)

Gets the latest agent validation result. Agent validation is performed when ValidateAgent is called.

Parameters
NameDescription
namestring

Required. The agent name. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/validationResult.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
AgentValidationResult

The RPC response.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/agents/[AGENT]/validationResult";
// Make the request
AgentValidationResult response = agentsClient.GetAgentValidationResult(name);

GetAgentValidationResultAsync(AgentValidationResultName, CallSettings)

public virtual Task<AgentValidationResult> GetAgentValidationResultAsync(AgentValidationResultName name, CallSettings callSettings = null)

Gets the latest agent validation result. Agent validation is performed when ValidateAgent is called.

Parameters
NameDescription
nameAgentValidationResultName

Required. The agent name. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/validationResult.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskAgentValidationResult

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
AgentValidationResultName name = AgentValidationResultName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]");
// Make the request
AgentValidationResult response = await agentsClient.GetAgentValidationResultAsync(name);

GetAgentValidationResultAsync(AgentValidationResultName, CancellationToken)

public virtual Task<AgentValidationResult> GetAgentValidationResultAsync(AgentValidationResultName name, CancellationToken cancellationToken)

Gets the latest agent validation result. Agent validation is performed when ValidateAgent is called.

Parameters
NameDescription
nameAgentValidationResultName

Required. The agent name. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/validationResult.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskAgentValidationResult

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
AgentValidationResultName name = AgentValidationResultName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]");
// Make the request
AgentValidationResult response = await agentsClient.GetAgentValidationResultAsync(name);

GetAgentValidationResultAsync(GetAgentValidationResultRequest, CallSettings)

public virtual Task<AgentValidationResult> GetAgentValidationResultAsync(GetAgentValidationResultRequest request, CallSettings callSettings = null)

Gets the latest agent validation result. Agent validation is performed when ValidateAgent is called.

Parameters
NameDescription
requestGetAgentValidationResultRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskAgentValidationResult

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
GetAgentValidationResultRequest request = new GetAgentValidationResultRequest
{
    AgentValidationResultName = AgentValidationResultName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
    LanguageCode = "",
};
// Make the request
AgentValidationResult response = await agentsClient.GetAgentValidationResultAsync(request);

GetAgentValidationResultAsync(GetAgentValidationResultRequest, CancellationToken)

public virtual Task<AgentValidationResult> GetAgentValidationResultAsync(GetAgentValidationResultRequest request, CancellationToken cancellationToken)

Gets the latest agent validation result. Agent validation is performed when ValidateAgent is called.

Parameters
NameDescription
requestGetAgentValidationResultRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskAgentValidationResult

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
GetAgentValidationResultRequest request = new GetAgentValidationResultRequest
{
    AgentValidationResultName = AgentValidationResultName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
    LanguageCode = "",
};
// Make the request
AgentValidationResult response = await agentsClient.GetAgentValidationResultAsync(request);

GetAgentValidationResultAsync(string, CallSettings)

public virtual Task<AgentValidationResult> GetAgentValidationResultAsync(string name, CallSettings callSettings = null)

Gets the latest agent validation result. Agent validation is performed when ValidateAgent is called.

Parameters
NameDescription
namestring

Required. The agent name. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/validationResult.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskAgentValidationResult

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/agents/[AGENT]/validationResult";
// Make the request
AgentValidationResult response = await agentsClient.GetAgentValidationResultAsync(name);

GetAgentValidationResultAsync(string, CancellationToken)

public virtual Task<AgentValidationResult> GetAgentValidationResultAsync(string name, CancellationToken cancellationToken)

Gets the latest agent validation result. Agent validation is performed when ValidateAgent is called.

Parameters
NameDescription
namestring

Required. The agent name. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/validationResult.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskAgentValidationResult

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/agents/[AGENT]/validationResult";
// Make the request
AgentValidationResult response = await agentsClient.GetAgentValidationResultAsync(name);

ListAgents(LocationName, string, int?, CallSettings)

public virtual PagedEnumerable<ListAgentsResponse, Agent> ListAgents(LocationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Returns the list of all agents in the specified location.

Parameters
NameDescription
parentLocationName

Required. The location to list all agents for. Format: projects/<Project ID>/locations/<Location ID>.

pageTokenstring

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeint

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerableListAgentsResponseAgent

A pageable sequence of Agent resources.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
PagedEnumerable<ListAgentsResponse, Agent> response = agentsClient.ListAgents(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (Agent item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListAgentsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Agent item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Agent> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Agent item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListAgents(ListAgentsRequest, CallSettings)

public virtual PagedEnumerable<ListAgentsResponse, Agent> ListAgents(ListAgentsRequest request, CallSettings callSettings = null)

Returns the list of all agents in the specified location.

Parameters
NameDescription
requestListAgentsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerableListAgentsResponseAgent

A pageable sequence of Agent resources.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
ListAgentsRequest request = new ListAgentsRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
};
// Make the request
PagedEnumerable<ListAgentsResponse, Agent> response = agentsClient.ListAgents(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (Agent item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListAgentsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Agent item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Agent> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Agent item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListAgents(string, string, int?, CallSettings)

public virtual PagedEnumerable<ListAgentsResponse, Agent> ListAgents(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Returns the list of all agents in the specified location.

Parameters
NameDescription
parentstring

Required. The location to list all agents for. Format: projects/<Project ID>/locations/<Location ID>.

pageTokenstring

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeint

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerableListAgentsResponseAgent

A pageable sequence of Agent resources.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
PagedEnumerable<ListAgentsResponse, Agent> response = agentsClient.ListAgents(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (Agent item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListAgentsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Agent item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Agent> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Agent item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListAgentsAsync(LocationName, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListAgentsResponse, Agent> ListAgentsAsync(LocationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Returns the list of all agents in the specified location.

Parameters
NameDescription
parentLocationName

Required. The location to list all agents for. Format: projects/<Project ID>/locations/<Location ID>.

pageTokenstring

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeint

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerableListAgentsResponseAgent

A pageable asynchronous sequence of Agent resources.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
PagedAsyncEnumerable<ListAgentsResponse, Agent> response = agentsClient.ListAgentsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Agent item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListAgentsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Agent item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Agent> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Agent item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListAgentsAsync(ListAgentsRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListAgentsResponse, Agent> ListAgentsAsync(ListAgentsRequest request, CallSettings callSettings = null)

Returns the list of all agents in the specified location.

Parameters
NameDescription
requestListAgentsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerableListAgentsResponseAgent

A pageable asynchronous sequence of Agent resources.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
ListAgentsRequest request = new ListAgentsRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
};
// Make the request
PagedAsyncEnumerable<ListAgentsResponse, Agent> response = agentsClient.ListAgentsAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Agent item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListAgentsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Agent item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Agent> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Agent item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListAgentsAsync(string, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListAgentsResponse, Agent> ListAgentsAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Returns the list of all agents in the specified location.

Parameters
NameDescription
parentstring

Required. The location to list all agents for. Format: projects/<Project ID>/locations/<Location ID>.

pageTokenstring

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeint

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerableListAgentsResponseAgent

A pageable asynchronous sequence of Agent resources.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
PagedAsyncEnumerable<ListAgentsResponse, Agent> response = agentsClient.ListAgentsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Agent item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListAgentsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Agent item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Agent> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Agent item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

PollOnceExportAgent(string, CallSettings)

public virtual Operation<ExportAgentResponse, Struct> PollOnceExportAgent(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of ExportAgent.

Parameters
NameDescription
operationNamestring

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationExportAgentResponseStruct

The result of polling the operation.

PollOnceExportAgentAsync(string, CallSettings)

public virtual Task<Operation<ExportAgentResponse, Struct>> PollOnceExportAgentAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of ExportAgent.

Parameters
NameDescription
operationNamestring

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationExportAgentResponseStruct

A task representing the result of polling the operation.

PollOnceRestoreAgent(string, CallSettings)

public virtual Operation<Empty, Struct> PollOnceRestoreAgent(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of RestoreAgent.

Parameters
NameDescription
operationNamestring

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationEmptyStruct

The result of polling the operation.

PollOnceRestoreAgentAsync(string, CallSettings)

public virtual Task<Operation<Empty, Struct>> PollOnceRestoreAgentAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of RestoreAgent.

Parameters
NameDescription
operationNamestring

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationEmptyStruct

A task representing the result of polling the operation.

RestoreAgent(RestoreAgentRequest, CallSettings)

public virtual Operation<Empty, Struct> RestoreAgent(RestoreAgentRequest request, CallSettings callSettings = null)

Restores the specified agent from a binary file.

Replaces the current agent with a new one. Note that all existing resources in agent (e.g. intents, entity types, flows) will be removed.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

Note: You should always train flows prior to sending them queries. See the training documentation.

Parameters
NameDescription
requestRestoreAgentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationEmptyStruct

The RPC response.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
RestoreAgentRequest request = new RestoreAgentRequest
{
    AgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
    AgentUri = "",
    RestoreOption = RestoreAgentRequest.Types.RestoreOption.Unspecified,
};
// Make the request
Operation<Empty, Struct> response = agentsClient.RestoreAgent(request);

// Poll until the returned long-running operation is complete
Operation<Empty, Struct> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Empty result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, Struct> retrievedResponse = agentsClient.PollOnceRestoreAgent(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Empty retrievedResult = retrievedResponse.Result;
}

RestoreAgentAsync(RestoreAgentRequest, CallSettings)

public virtual Task<Operation<Empty, Struct>> RestoreAgentAsync(RestoreAgentRequest request, CallSettings callSettings = null)

Restores the specified agent from a binary file.

Replaces the current agent with a new one. Note that all existing resources in agent (e.g. intents, entity types, flows) will be removed.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

Note: You should always train flows prior to sending them queries. See the training documentation.

Parameters
NameDescription
requestRestoreAgentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationEmptyStruct

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
RestoreAgentRequest request = new RestoreAgentRequest
{
    AgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
    AgentUri = "",
    RestoreOption = RestoreAgentRequest.Types.RestoreOption.Unspecified,
};
// Make the request
Operation<Empty, Struct> response = await agentsClient.RestoreAgentAsync(request);

// Poll until the returned long-running operation is complete
Operation<Empty, Struct> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, Struct> retrievedResponse = await agentsClient.PollOnceRestoreAgentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Empty retrievedResult = retrievedResponse.Result;
}

RestoreAgentAsync(RestoreAgentRequest, CancellationToken)

public virtual Task<Operation<Empty, Struct>> RestoreAgentAsync(RestoreAgentRequest request, CancellationToken cancellationToken)

Restores the specified agent from a binary file.

Replaces the current agent with a new one. Note that all existing resources in agent (e.g. intents, entity types, flows) will be removed.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

Note: You should always train flows prior to sending them queries. See the training documentation.

Parameters
NameDescription
requestRestoreAgentRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationEmptyStruct

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
RestoreAgentRequest request = new RestoreAgentRequest
{
    AgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
    AgentUri = "",
    RestoreOption = RestoreAgentRequest.Types.RestoreOption.Unspecified,
};
// Make the request
Operation<Empty, Struct> response = await agentsClient.RestoreAgentAsync(request);

// Poll until the returned long-running operation is complete
Operation<Empty, Struct> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, Struct> retrievedResponse = await agentsClient.PollOnceRestoreAgentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Empty retrievedResult = retrievedResponse.Result;
}

ShutdownDefaultChannelsAsync()

public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.

Returns
TypeDescription
Task

A task representing the asynchronous shutdown operation.

Remarks

After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.

UpdateAgent(Agent, FieldMask, CallSettings)

public virtual Agent UpdateAgent(Agent agent, FieldMask updateMask, CallSettings callSettings = null)

Updates the specified agent.

Note: You should always train flows prior to sending them queries. See the training documentation.

Parameters
NameDescription
agentAgent

Required. The agent to update.

updateMaskFieldMask

The mask to control which fields get updated. If the mask is not present, all fields will be updated.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Agent

The RPC response.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
Agent agent = new Agent();
FieldMask updateMask = new FieldMask();
// Make the request
Agent response = agentsClient.UpdateAgent(agent, updateMask);

UpdateAgent(UpdateAgentRequest, CallSettings)

public virtual Agent UpdateAgent(UpdateAgentRequest request, CallSettings callSettings = null)

Updates the specified agent.

Note: You should always train flows prior to sending them queries. See the training documentation.

Parameters
NameDescription
requestUpdateAgentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Agent

The RPC response.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
UpdateAgentRequest request = new UpdateAgentRequest
{
    Agent = new Agent(),
    UpdateMask = new FieldMask(),
};
// Make the request
Agent response = agentsClient.UpdateAgent(request);

UpdateAgentAsync(Agent, FieldMask, CallSettings)

public virtual Task<Agent> UpdateAgentAsync(Agent agent, FieldMask updateMask, CallSettings callSettings = null)

Updates the specified agent.

Note: You should always train flows prior to sending them queries. See the training documentation.

Parameters
NameDescription
agentAgent

Required. The agent to update.

updateMaskFieldMask

The mask to control which fields get updated. If the mask is not present, all fields will be updated.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskAgent

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
Agent agent = new Agent();
FieldMask updateMask = new FieldMask();
// Make the request
Agent response = await agentsClient.UpdateAgentAsync(agent, updateMask);

UpdateAgentAsync(Agent, FieldMask, CancellationToken)

public virtual Task<Agent> UpdateAgentAsync(Agent agent, FieldMask updateMask, CancellationToken cancellationToken)

Updates the specified agent.

Note: You should always train flows prior to sending them queries. See the training documentation.

Parameters
NameDescription
agentAgent

Required. The agent to update.

updateMaskFieldMask

The mask to control which fields get updated. If the mask is not present, all fields will be updated.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskAgent

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
Agent agent = new Agent();
FieldMask updateMask = new FieldMask();
// Make the request
Agent response = await agentsClient.UpdateAgentAsync(agent, updateMask);

UpdateAgentAsync(UpdateAgentRequest, CallSettings)

public virtual Task<Agent> UpdateAgentAsync(UpdateAgentRequest request, CallSettings callSettings = null)

Updates the specified agent.

Note: You should always train flows prior to sending them queries. See the training documentation.

Parameters
NameDescription
requestUpdateAgentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskAgent

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
UpdateAgentRequest request = new UpdateAgentRequest
{
    Agent = new Agent(),
    UpdateMask = new FieldMask(),
};
// Make the request
Agent response = await agentsClient.UpdateAgentAsync(request);

UpdateAgentAsync(UpdateAgentRequest, CancellationToken)

public virtual Task<Agent> UpdateAgentAsync(UpdateAgentRequest request, CancellationToken cancellationToken)

Updates the specified agent.

Note: You should always train flows prior to sending them queries. See the training documentation.

Parameters
NameDescription
requestUpdateAgentRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskAgent

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
UpdateAgentRequest request = new UpdateAgentRequest
{
    Agent = new Agent(),
    UpdateMask = new FieldMask(),
};
// Make the request
Agent response = await agentsClient.UpdateAgentAsync(request);

ValidateAgent(ValidateAgentRequest, CallSettings)

public virtual AgentValidationResult ValidateAgent(ValidateAgentRequest request, CallSettings callSettings = null)

Validates the specified agent and creates or updates validation results. The agent in draft version is validated. Please call this API after the training is completed to get the complete validation results.

Parameters
NameDescription
requestValidateAgentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
AgentValidationResult

The RPC response.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
ValidateAgentRequest request = new ValidateAgentRequest
{
    AgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
    LanguageCode = "",
};
// Make the request
AgentValidationResult response = agentsClient.ValidateAgent(request);

ValidateAgentAsync(ValidateAgentRequest, CallSettings)

public virtual Task<AgentValidationResult> ValidateAgentAsync(ValidateAgentRequest request, CallSettings callSettings = null)

Validates the specified agent and creates or updates validation results. The agent in draft version is validated. Please call this API after the training is completed to get the complete validation results.

Parameters
NameDescription
requestValidateAgentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskAgentValidationResult

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
ValidateAgentRequest request = new ValidateAgentRequest
{
    AgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
    LanguageCode = "",
};
// Make the request
AgentValidationResult response = await agentsClient.ValidateAgentAsync(request);

ValidateAgentAsync(ValidateAgentRequest, CancellationToken)

public virtual Task<AgentValidationResult> ValidateAgentAsync(ValidateAgentRequest request, CancellationToken cancellationToken)

Validates the specified agent and creates or updates validation results. The agent in draft version is validated. Please call this API after the training is completed to get the complete validation results.

Parameters
NameDescription
requestValidateAgentRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskAgentValidationResult

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
ValidateAgentRequest request = new ValidateAgentRequest
{
    AgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
    LanguageCode = "",
};
// Make the request
AgentValidationResult response = await agentsClient.ValidateAgentAsync(request);