Run Agent Stream

Hitachi iQ Studio REST API Reference Guide

Version
1.1.x
File Size
4495 KB
Audience
anonymous
Part Number
MK-26HIQS002-00
ft:lastEdition
2026-09-15
post /public/api/v1/run_agent_stream

This API endpoint allows users to run and query an agent with streaming response. Also supports resuming interrupted executions by providing execution_state_id.

Input:

  • sessionId (str): The session ID for the agent interaction.
  • traceparent (str, optional): W3C Trace Context header for distributed tracing.
  • chat_request : (AgentChatRequest) Input payload to start and query an agent or resume execution.
    • For new execution: provide agent_id and message
    • For resuming: provide execution_state_id (and optionally approval_response)

Output: The response contains a streaming response of the user query or resumed execution.

Authentication: BearerAuth HTTP - bearer scheme
Request headers
sessionId String required

The session ID for the agent interaction.

Example: 7926a636-2fb6-4a0d-96a6-31da00359b02
traceparent String

W3C Trace Context header for distributed tracing.

Example: 00-47b4b549217cde861fb60fe0c276a29b-f39e92d2c8619ae9-01
CLIENT REQUEST
curl -X 'POST'
-H "Authorization: Bearer [[accessToken]]" \
-H 'Accept: text/event-stream,application/json'
-H 'Content-Type: application/json'
-H 'sessionId: 7926a636-2fb6-4a0d-96a6-31da00359b02' -H 'traceparent: 00-47b4b549217cde861fb60fe0c276a29b-f39e92d2c8619ae9-01'
'http://localhost/public/api/v1/run_agent_stream'
-d '{ "time_machine_timestamp" : "time_machine_timestamp", "debug_mode" : true, "agent_id" : "agent_id", "message" : "message", "execution_state_id" : "execution_state_id", "approval_response" : { "key" : "" } }'
import http.client conn = http.client.HTTPConnection("undefinedundefined") payload = "{\"agent_id\":\"string\",\"message\":\"string\",\"execution_state_id\":\"string\",\"approval_response\":{},\"time_machine_timestamp\":\"string\",\"debug_mode\":true}" headers = { 'sessionId': "7926a636-2fb6-4a0d-96a6-31da00359b02", 'traceparent': "00-47b4b549217cde861fb60fe0c276a29b-f39e92d2c8619ae9-01", 'Authorization': "Bearer REPLACE_BEARER_TOKEN", 'content-type': "application/json" } conn.request("POST", "/public/api/v1/run_agent_stream", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8"))
require 'uri' require 'net/http' url = URI("http://undefinedundefined/public/api/v1/run_agent_stream") http = Net::HTTP.new(url.host, url.port) request = Net::HTTP::Post.new(url) request["sessionId"] = '7926a636-2fb6-4a0d-96a6-31da00359b02' request["traceparent"] = '00-47b4b549217cde861fb60fe0c276a29b-f39e92d2c8619ae9-01' request["Authorization"] = 'Bearer REPLACE_BEARER_TOKEN' request["content-type"] = 'application/json' request.body = "{\"agent_id\":\"string\",\"message\":\"string\",\"execution_state_id\":\"string\",\"approval_response\":{},\"time_machine_timestamp\":\"string\",\"debug_mode\":true}" response = http.request(request) puts response.read_body
const data = JSON.stringify({ "agent_id": "string", "message": "string", "execution_state_id": "string", "approval_response": {}, "time_machine_timestamp": "string", "debug_mode": true }); const xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener("readystatechange", function () { if (this.readyState === this.DONE) { console.log(this.responseText); } }); xhr.open("POST", "http://undefinedundefined/public/api/v1/run_agent_stream"); xhr.setRequestHeader("sessionId", "7926a636-2fb6-4a0d-96a6-31da00359b02"); xhr.setRequestHeader("traceparent", "00-47b4b549217cde861fb60fe0c276a29b-f39e92d2c8619ae9-01"); xhr.setRequestHeader("Authorization", "Bearer REPLACE_BEARER_TOKEN"); xhr.setRequestHeader("content-type", "application/json"); xhr.send(data);
HttpResponse<String> response = Unirest.post("http://undefinedundefined/public/api/v1/run_agent_stream") .header("sessionId", "7926a636-2fb6-4a0d-96a6-31da00359b02") .header("traceparent", "00-47b4b549217cde861fb60fe0c276a29b-f39e92d2c8619ae9-01") .header("Authorization", "Bearer REPLACE_BEARER_TOKEN") .header("content-type", "application/json") .body("{\"agent_id\":\"string\",\"message\":\"string\",\"execution_state_id\":\"string\",\"approval_response\":{},\"time_machine_timestamp\":\"string\",\"debug_mode\":true}") .asString();
import Foundation let headers = [ "sessionId": "7926a636-2fb6-4a0d-96a6-31da00359b02", "traceparent": "00-47b4b549217cde861fb60fe0c276a29b-f39e92d2c8619ae9-01", "Authorization": "Bearer REPLACE_BEARER_TOKEN", "content-type": "application/json" ] let parameters = [ "agent_id": "string", "message": "string", "execution_state_id": "string", "approval_response": [], "time_machine_timestamp": "string", "debug_mode": true ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "http://undefinedundefined/public/api/v1/run_agent_stream")! 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) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume()
<?php $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => "http://undefinedundefined/public/api/v1/run_agent_stream", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => "{\"agent_id\":\"string\",\"message\":\"string\",\"execution_state_id\":\"string\",\"approval_response\":{},\"time_machine_timestamp\":\"string\",\"debug_mode\":true}", CURLOPT_HTTPHEADER => [ "Authorization: Bearer REPLACE_BEARER_TOKEN", "content-type: application/json", "sessionId: 7926a636-2fb6-4a0d-96a6-31da00359b02", "traceparent: 00-47b4b549217cde861fb60fe0c276a29b-f39e92d2c8619ae9-01" ], ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }
CURL *hnd = curl_easy_init(); curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST"); curl_easy_setopt(hnd, CURLOPT_URL, "http://undefinedundefined/public/api/v1/run_agent_stream"); struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "sessionId: 7926a636-2fb6-4a0d-96a6-31da00359b02"); headers = curl_slist_append(headers, "traceparent: 00-47b4b549217cde861fb60fe0c276a29b-f39e92d2c8619ae9-01"); headers = curl_slist_append(headers, "Authorization: Bearer REPLACE_BEARER_TOKEN"); headers = curl_slist_append(headers, "content-type: application/json"); curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\"agent_id\":\"string\",\"message\":\"string\",\"execution_state_id\":\"string\",\"approval_response\":{},\"time_machine_timestamp\":\"string\",\"debug_mode\":true}"); CURLcode ret = curl_easy_perform(hnd);
var client = new RestClient("http://undefinedundefined/public/api/v1/run_agent_stream"); var request = new RestRequest(Method.POST); request.AddHeader("sessionId", "7926a636-2fb6-4a0d-96a6-31da00359b02"); request.AddHeader("traceparent", "00-47b4b549217cde861fb60fe0c276a29b-f39e92d2c8619ae9-01"); request.AddHeader("Authorization", "Bearer REPLACE_BEARER_TOKEN"); request.AddHeader("content-type", "application/json"); request.AddParameter("application/json", "{\"agent_id\":\"string\",\"message\":\"string\",\"execution_state_id\":\"string\",\"approval_response\":{},\"time_machine_timestamp\":\"string\",\"debug_mode\":true}", ParameterType.RequestBody); IRestResponse response = client.Execute(request);
Body parameters
required
application/json

Request payload for starting or resuming an agent chat interaction.

agent_idstringrequired

ID of the agent

messagestringrequired

Message to send to the agent

execution_state_idobject

ID of the execution state to resume (optional for resume functionality)

string

ID of the execution state to resume (optional for resume functionality)

approval_responseobject

Response for pending approvals when resuming execution (optional)

Free-Form object
time_machine_timestampobject

Timestamp to run the time machine agent at a specific point in time (optional)

string

Timestamp to run the time machine agent at a specific point in time (optional)

debug_modeobject

Flag to enable debug mode for detailed LLM logging (optional)

boolean

Flag to enable debug mode for detailed LLM logging (optional)

REQUEST
{ "agent_id": "example", "message": "example", "execution_state_id": null, "approval_response": null, "time_machine_timestamp": null, "debug_mode": null }
Responses

Streaming agent response

Body
text/event-stream

Server-Sent Events stream containing agent responses in JSON format.

string

Server-Sent Events stream containing agent responses in JSON format.

RESPONSE
data: {"type": "chat:completion", "data": {"choices": [{"delta": {"reasoning_content": {"heading": "#### Analyzing Your Request", "content": "Let me think about your request and how I can best help you."}}}]}, "step": 1, "timestamp": 1775751196.347495, "session_id": "2a6fb550-de5a-41e3-90b7-f1cc4d179758", "prompt_id": "b647cc62-c723-43fe-b202-5eed9a1888d1"}

Internal Server Error

Body
application/json

Standard error response returned when a request fails.

statusintegerrequired

HTTP status code of the error.

errorstringrequired

A short description of the error that occurred.

pathstringrequired

The API path where the error occurred.

RESPONSE
{ "status": 0, "error": "example", "path": "example" }

Validation Error

Body
application/json

Response returned when request validation fails.

detailarray

List of validation errors encountered in the request.

[
locarrayrequired

The location of the error in the request (e.g., body, query, path).

[
string
integer
]
msgstringrequired

A human-readable message describing the validation error.

typestringrequired

The type of validation error that occurred.

]
RESPONSE
{ "detail": [ { "loc": [ 0 ], "msg": "example", "type": "example" } ] }