curl -N 'http://localhost:8000/run_sse' \
-H 'Content-Type: application/json' \
-d '{"app_name": "harness_agent", "user_id": "user-001", "session_id": "session-001", "new_message": {"role": "user", "parts": [{"text": "Hello"}]}, "streaming": true}'import requests
url = "http://localhost:8000/run_sse"
payload = {
"app_name": "harness_agent",
"user_id": "user-001",
"session_id": "session-001"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({app_name: 'harness_agent', user_id: 'user-001', session_id: 'session-001'})
};
fetch('http://localhost:8000/run_sse', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));"data: {\"content\":{\"role\":\"model\",\"parts\":[{\"text\":\"Hello\"}]},\"author\":\"harness_agent\",\"invocationId\":\"invocation-001\",\"id\":\"event-001\",\"timestamp\":1789603200}\n\n"{
"error": "<string>"
}{
"detail": "<string>"
}{
"error": "CONTENT_LENGTH_REQUIRED"
}{
"error": "REQUEST_TOO_LARGE"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}流式运行 Harness
未提供普通 Harness 覆盖时,通过 SSE 实时返回智能体事件。streaming 默认 false,设为 true 时请求模型增量输出;需先创建 harness_agent 下的会话。仅覆盖 harness.mcp_servers 时保持原有流式行为
KeyAuth 部署支持普通 harness 覆盖,此时服务等待调用完成后返回一个 SSE 事件,不提供逐片段输出,streaming 不改变该行为。普通覆盖仅提取 new_message.parts 中的文本,state_delta 与 invocation_id 不应用于此路径
共享 OAuth 部署仅支持 MCP 覆盖,不提供普通模型、工具或提示词覆盖。SSE 中的失败可能以 data: {"error":"..."} 返回,HTTP 200 不代表整个调用成功。使用 curl -N 观察实时输出
curl -N 'http://localhost:8000/run_sse' \
-H 'Content-Type: application/json' \
-d '{"app_name": "harness_agent", "user_id": "user-001", "session_id": "session-001", "new_message": {"role": "user", "parts": [{"text": "Hello"}]}, "streaming": true}'import requests
url = "http://localhost:8000/run_sse"
payload = {
"app_name": "harness_agent",
"user_id": "user-001",
"session_id": "session-001"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({app_name: 'harness_agent', user_id: 'user-001', session_id: 'session-001'})
};
fetch('http://localhost:8000/run_sse', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));"data: {\"content\":{\"role\":\"model\",\"parts\":[{\"text\":\"Hello\"}]},\"author\":\"harness_agent\",\"invocationId\":\"invocation-001\",\"id\":\"event-001\",\"timestamp\":1789603200}\n\n"{
"error": "<string>"
}{
"detail": "<string>"
}{
"error": "CONTENT_LENGTH_REQUIRED"
}{
"error": "REQUEST_TOO_LARGE"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}app_name: "harness_agent"、user_id、session_id 和 new_message 提交消息。普通调用或仅覆盖 MCP 时,应先创建会话;streaming: true 请求模型增量输出
KeyAuth 部署传入普通 harness 覆盖时,服务等待执行完成后发送单个 SSE 事件,仅提取 new_message.parts 中的文本;不会应用 state_delta 或 invocation_id。顶层 max_llm_calls 仅在这类普通覆盖中生效,并优先于 harness.max_llm_calls
data: <JSON> 并以空行分隔。使用 curl -N 读取到流结束,同时处理文本、状态或制品事件,以及 data: {"error":"..."};HTTP 200 不表示执行成功。普通覆盖的成功事件形如:
data: {"content":{"parts":[{"text":"Hello"}]},"partial":false}
授权
本地未配置网关时可不提供;云部署使用 Runtime API Key 或部署要求的用户池 JWT,不能使用模型 API Key
请求体
应用名称,普通调用应明确提供 harness_agent;本接口不使用 ADK_DEFAULT_APP_NAME 作为缺省应用
用户 ID
会话 ID
本轮输入消息;恢复调用时可省略,具体取决于应用支持的调用方式
Show child attributes
Show child attributes
是否请求模型增量流式输出,默认 false
本次写入的会话状态增量
此字段可被请求模型接受,但所核验 SDK 的 /run_sse 不应用该值
调用 ID
此字段可被请求模型接受,但所核验 SDK 的 /run_sse 不应用该值
仅对本次请求生效的覆盖;未提供的字段继承部署配置;使用覆盖时,顶层请求字段按本页使用 snake_case
Show child attributes
Show child attributes
仅在 KeyAuth 普通 Harness 覆盖中生效;顶层值优先于 harness.max_llm_calls,再其次为部署配置。普通调用与仅 MCP 覆盖不应用此字段
x >= 1响应
请求成功
The response is of type string.