# Process input POST https://api.forbocai.com/v1/agents/{agentId}/process Content-Type: application/json Sends input to an agent and receives dialogue + validated actions. Reference: https://docs.forboc.ai/api-reference/endpoints/forboc-ai-sdk-api/agents/process-agent-input ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Process input version: endpoint_agents.processAgentInput paths: /agents/{agentId}/process: post: operationId: process-agent-input summary: Process input description: Sends input to an agent and receives dialogue + validated actions. tags: - - subpackage_agents parameters: - name: agentId in: path required: true schema: type: string responses: '200': description: Agent response content: application/json: schema: $ref: '#/components/schemas/AgentProcessResponse' requestBody: content: application/json: schema: $ref: '#/components/schemas/AgentProcessRequest' components: schemas: AgentProcessRequest: type: object properties: input: type: string context: type: object additionalProperties: description: Any type required: - input AgentProcessResponseAction: type: object properties: type: type: string AgentProcessResponse: type: object properties: dialogue: type: string action: $ref: '#/components/schemas/AgentProcessResponseAction' stateChanges: type: object additionalProperties: description: Any type memoriesRecalled: type: array items: type: string ``` ## SDK Code Examples ```python Trade offer response import requests url = "https://api.forbocai.com/v1/agents/agentId/process" headers = {"Content-Type": "application/json"} response = requests.post(url, headers=headers) print(response.json()) ``` ```javascript Trade offer response const url = 'https://api.forbocai.com/v1/agents/agentId/process'; const options = {method: 'POST', headers: {'Content-Type': 'application/json'}, body: undefined}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Trade offer response package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.forbocai.com/v1/agents/agentId/process" req, _ := http.NewRequest("POST", url, nil) req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Trade offer response require 'uri' require 'net/http' url = URI("https://api.forbocai.com/v1/agents/agentId/process") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Content-Type"] = 'application/json' response = http.request(request) puts response.read_body ``` ```java Trade offer response HttpResponse response = Unirest.post("https://api.forbocai.com/v1/agents/agentId/process") .header("Content-Type", "application/json") .asString(); ``` ```php Trade offer response request('POST', 'https://api.forbocai.com/v1/agents/agentId/process', [ 'headers' => [ 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp Trade offer response var client = new RestClient("https://api.forbocai.com/v1/agents/agentId/process"); var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/json"); IRestResponse response = client.Execute(request); ``` ```swift Trade offer response import Foundation let headers = ["Content-Type": "application/json"] let request = NSMutableURLRequest(url: NSURL(string: "https://api.forbocai.com/v1/agents/agentId/process")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ```python Trade request import requests url = "https://api.forbocai.com/v1/agents/agentId/process" payload = { "input": "I'd like to buy that key from you.", "context": { "playerGold": 50, "playerInventory": ["sword", "shield"] } } headers = {"Content-Type": "application/json"} response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Trade request const url = 'https://api.forbocai.com/v1/agents/agentId/process'; const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"input":"I\'d like to buy that key from you.","context":{"playerGold":50,"playerInventory":["sword","shield"]}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Trade request package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.forbocai.com/v1/agents/agentId/process" payload := strings.NewReader("{\n \"input\": \"I'd like to buy that key from you.\",\n \"context\": {\n \"playerGold\": 50,\n \"playerInventory\": [\n \"sword\",\n \"shield\"\n ]\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Trade request require 'uri' require 'net/http' url = URI("https://api.forbocai.com/v1/agents/agentId/process") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Content-Type"] = 'application/json' request.body = "{\n \"input\": \"I'd like to buy that key from you.\",\n \"context\": {\n \"playerGold\": 50,\n \"playerInventory\": [\n \"sword\",\n \"shield\"\n ]\n }\n}" response = http.request(request) puts response.read_body ``` ```java Trade request HttpResponse response = Unirest.post("https://api.forbocai.com/v1/agents/agentId/process") .header("Content-Type", "application/json") .body("{\n \"input\": \"I'd like to buy that key from you.\",\n \"context\": {\n \"playerGold\": 50,\n \"playerInventory\": [\n \"sword\",\n \"shield\"\n ]\n }\n}") .asString(); ``` ```php Trade request request('POST', 'https://api.forbocai.com/v1/agents/agentId/process', [ 'body' => '{ "input": "I\'d like to buy that key from you.", "context": { "playerGold": 50, "playerInventory": [ "sword", "shield" ] } }', 'headers' => [ 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp Trade request var client = new RestClient("https://api.forbocai.com/v1/agents/agentId/process"); var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"input\": \"I'd like to buy that key from you.\",\n \"context\": {\n \"playerGold\": 50,\n \"playerInventory\": [\n \"sword\",\n \"shield\"\n ]\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Trade request import Foundation let headers = ["Content-Type": "application/json"] let parameters = [ "input": "I'd like to buy that key from you.", "context": [ "playerGold": 50, "playerInventory": ["sword", "shield"] ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.forbocai.com/v1/agents/agentId/process")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```