processAgent
Get a chat completion from an agent
This endpoint processes a chat interaction with a specified agent. It supports both streaming and non-streaming operations based on the provided parameters.
/agent/{id}
Usage and SDK Samples
curl -X POST\
-H "Authorization: Bearer [[accessToken]]"\
-H "Accept: application/json"\
-H "Content-Type: application/json"\
"https://api.easybeam.ai/v1/agent/{id}"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.AgentApi;
import java.io.File;
import java.util.*;
public class AgentApiExample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
AgentApi apiInstance = new AgentApi();
GetAgentRequest body = {
"summary" : "Sample request",
"value" : {
"variables" : {
"keyA" : "valueA",
"keyB" : "valueB"
},
"chatId" : "chat-12345",
"messages" : [ {
"content" : "Can you help me with this task?",
"role" : "USER",
"createdAt" : "2024-04-27T13:00:00Z",
"id" : "msg-3"
} ],
"stream" : false,
"userId" : "user-67890",
"consolidateStream" : true,
"userSecrets" : { }
}
}; // GetAgentRequest | Payload containing the chat details and parameters for processing the agent interaction
String id = id_example; // String | Unique identifier for the agent
try {
GetChatResponse result = apiInstance.processAgent(body, id);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AgentApi#processAgent");
e.printStackTrace();
}
}
}
import io.swagger.client.api.AgentApi;
public class AgentApiExample {
public static void main(String[] args) {
AgentApi apiInstance = new AgentApi();
GetAgentRequest body = {
"summary" : "Sample request",
"value" : {
"variables" : {
"keyA" : "valueA",
"keyB" : "valueB"
},
"chatId" : "chat-12345",
"messages" : [ {
"content" : "Can you help me with this task?",
"role" : "USER",
"createdAt" : "2024-04-27T13:00:00Z",
"id" : "msg-3"
} ],
"stream" : false,
"userId" : "user-67890",
"consolidateStream" : true,
"userSecrets" : { }
}
}; // GetAgentRequest | Payload containing the chat details and parameters for processing the agent interaction
String id = id_example; // String | Unique identifier for the agent
try {
GetChatResponse result = apiInstance.processAgent(body, id);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AgentApi#processAgent");
e.printStackTrace();
}
}
}
Configuration *apiConfig = [Configuration sharedConfig];
GetAgentRequest *body = {
"summary" : "Sample request",
"value" : {
"variables" : {
"keyA" : "valueA",
"keyB" : "valueB"
},
"chatId" : "chat-12345",
"messages" : [ {
"content" : "Can you help me with this task?",
"role" : "USER",
"createdAt" : "2024-04-27T13:00:00Z",
"id" : "msg-3"
} ],
"stream" : false,
"userId" : "user-67890",
"consolidateStream" : true,
"userSecrets" : { }
}
}; // Payload containing the chat details and parameters for processing the agent interaction
String *id = id_example; // Unique identifier for the agent
AgentApi *apiInstance = [[AgentApi alloc] init];
// Get a chat completion from an agent
[apiInstance processAgentWith:body
id:id
completionHandler: ^(GetChatResponse output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
var EasybeamBackendApi = require('easybeam_backend_api');
var defaultClient = EasybeamBackendApi.ApiClient.instance;
var api = new EasybeamBackendApi.AgentApi()
var body = {
"summary" : "Sample request",
"value" : {
"variables" : {
"keyA" : "valueA",
"keyB" : "valueB"
},
"chatId" : "chat-12345",
"messages" : [ {
"content" : "Can you help me with this task?",
"role" : "USER",
"createdAt" : "2024-04-27T13:00:00Z",
"id" : "msg-3"
} ],
"stream" : false,
"userId" : "user-67890",
"consolidateStream" : true,
"userSecrets" : { }
}
}; // {{GetAgentRequest}} Payload containing the chat details and parameters for processing the agent interaction
var id = id_example; // {{String}} Unique identifier for the agent
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.processAgent(bodyid, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class processAgentExample
{
public void main()
{
var apiInstance = new AgentApi();
var body = new GetAgentRequest(); // GetAgentRequest | Payload containing the chat details and parameters for processing the agent interaction
var id = id_example; // String | Unique identifier for the agent
try
{
// Get a chat completion from an agent
GetChatResponse result = apiInstance.processAgent(body, id);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling AgentApi.processAgent: " + e.Message );
}
}
}
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new Swagger\Client\ApiAgentApi();
$body = {
"summary" : "Sample request",
"value" : {
"variables" : {
"keyA" : "valueA",
"keyB" : "valueB"
},
"chatId" : "chat-12345",
"messages" : [ {
"content" : "Can you help me with this task?",
"role" : "USER",
"createdAt" : "2024-04-27T13:00:00Z",
"id" : "msg-3"
} ],
"stream" : false,
"userId" : "user-67890",
"consolidateStream" : true,
"userSecrets" : { }
}
}; // GetAgentRequest | Payload containing the chat details and parameters for processing the agent interaction
$id = id_example; // String | Unique identifier for the agent
try {
$result = $api_instance->processAgent($body, $id);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AgentApi->processAgent: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::AgentApi;
my $api_instance = WWW::SwaggerClient::AgentApi->new();
my $body = WWW::SwaggerClient::Object::GetAgentRequest->new(); # GetAgentRequest | Payload containing the chat details and parameters for processing the agent interaction
my $id = id_example; # String | Unique identifier for the agent
eval {
my $result = $api_instance->processAgent(body => $body, id => $id);
print Dumper($result);
};
if ($@) {
warn "Exception when calling AgentApi->processAgent: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.AgentApi()
body = {
"summary" : "Sample request",
"value" : {
"variables" : {
"keyA" : "valueA",
"keyB" : "valueB"
},
"chatId" : "chat-12345",
"messages" : [ {
"content" : "Can you help me with this task?",
"role" : "USER",
"createdAt" : "2024-04-27T13:00:00Z",
"id" : "msg-3"
} ],
"stream" : false,
"userId" : "user-67890",
"consolidateStream" : true,
"userSecrets" : { }
}
} # GetAgentRequest | Payload containing the chat details and parameters for processing the agent interaction
id = id_example # String | Unique identifier for the agent
try:
# Get a chat completion from an agent
api_response = api_instance.process_agent(body, id)
pprint(api_response)
except ApiException as e:
print("Exception when calling AgentApi->processAgent: %s\n" % e)
Parameters
Path parameters
Name | Description |
---|---|
id* |
String
Unique identifier for the agent
Required
|
Body parameters
Name | Description |
---|---|
body * |