curl --request POST \
--url http://localhost:8000/run \
--header 'Content-Type: application/json' \
--data '
{
"userId": "user-001",
"sessionId": "session-001"
}
'import requests
url = "http://localhost:8000/run"
payload = {
"userId": "user-001",
"sessionId": "session-001"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({userId: 'user-001', sessionId: 'session-001'})
};
fetch('http://localhost:8000/run', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));[
{
"modelVersion": "<string>",
"content": {
"parts": [
{
"mediaResolution": {
"level": "MEDIA_RESOLUTION_UNSPECIFIED",
"numTokens": 123
},
"codeExecutionResult": {
"outcome": "OUTCOME_UNSPECIFIED",
"output": "<string>",
"id": "<string>"
},
"executableCode": {
"code": "<string>",
"language": "LANGUAGE_UNSPECIFIED",
"id": "<string>"
},
"fileData": {
"displayName": "<string>",
"fileUri": "<string>",
"mimeType": "<string>"
},
"functionCall": {
"id": "<string>",
"args": {},
"name": "<string>",
"partialArgs": [
{
"boolValue": true,
"jsonPath": "<string>",
"nullValue": "NULL_VALUE",
"numberValue": 123,
"stringValue": "<string>",
"willContinue": true
}
],
"willContinue": true
},
"functionResponse": {
"willContinue": true,
"scheduling": "SCHEDULING_UNSPECIFIED",
"parts": [
{
"inlineData": {
"mimeType": "<string>",
"data": "<string>",
"displayName": "<string>"
},
"fileData": {
"fileUri": "<string>",
"mimeType": "<string>",
"displayName": "<string>"
}
}
],
"id": "<string>",
"name": "<string>",
"response": {}
},
"inlineData": {
"data": "<string>",
"displayName": "<string>",
"mimeType": "<string>"
},
"text": "<string>",
"thought": true,
"thoughtSignature": "<string>",
"videoMetadata": {
"endOffset": "<string>",
"fps": 123,
"startOffset": "<string>"
},
"toolCall": {
"id": "<string>",
"toolType": "TOOL_TYPE_UNSPECIFIED",
"args": {}
},
"toolResponse": {
"id": "<string>",
"toolType": "TOOL_TYPE_UNSPECIFIED",
"response": {}
},
"partMetadata": {}
}
],
"role": "<string>"
},
"groundingMetadata": {
"imageSearchQueries": [
"<string>"
],
"groundingChunks": [
{
"image": {
"sourceUri": "<string>",
"imageUri": "<string>",
"title": "<string>",
"domain": "<string>"
},
"maps": {
"placeAnswerSources": {
"reviewSnippet": [
{
"authorAttribution": {
"displayName": "<string>",
"photoUri": "<string>",
"uri": "<string>"
},
"flagContentUri": "<string>",
"googleMapsUri": "<string>",
"relativePublishTimeDescription": "<string>",
"review": "<string>",
"reviewId": "<string>",
"title": "<string>"
}
],
"flagContentUri": "<string>",
"reviewSnippets": [
{
"authorAttribution": {
"displayName": "<string>",
"photoUri": "<string>",
"uri": "<string>"
},
"flagContentUri": "<string>",
"googleMapsUri": "<string>",
"relativePublishTimeDescription": "<string>",
"review": "<string>",
"reviewId": "<string>",
"title": "<string>"
}
]
},
"placeId": "<string>",
"text": "<string>",
"title": "<string>",
"uri": "<string>",
"route": {
"distanceMeters": 123,
"duration": "<string>",
"encodedPolyline": "<string>"
}
},
"retrievedContext": {
"documentName": "<string>",
"ragChunk": {
"pageSpan": {
"firstPage": 123,
"lastPage": 123
},
"text": "<string>",
"chunkId": "<string>",
"fileId": "<string>"
},
"text": "<string>",
"title": "<string>",
"uri": "<string>",
"customMetadata": [
{
"key": "<string>",
"numericValue": 123,
"stringListValue": {
"values": [
"<string>"
]
},
"stringValue": "<string>"
}
],
"fileSearchStore": "<string>",
"pageNumber": 123,
"mediaId": "<string>"
},
"web": {
"domain": "<string>",
"title": "<string>",
"uri": "<string>"
}
}
],
"groundingSupports": [
{
"confidenceScores": [
123
],
"groundingChunkIndices": [
123
],
"segment": {
"startIndex": 123,
"endIndex": 123,
"partIndex": 123,
"text": "<string>"
},
"renderedParts": [
123
]
}
],
"retrievalMetadata": {
"googleSearchDynamicRetrievalScore": 123
},
"searchEntryPoint": {
"renderedContent": "<string>",
"sdkBlob": "<string>"
},
"webSearchQueries": [
"<string>"
],
"googleMapsWidgetContextToken": "<string>",
"retrievalQueries": [
"<string>"
],
"sourceFlaggingUris": [
{
"flagContentUri": "<string>",
"sourceId": "<string>"
}
]
},
"partial": true,
"turnComplete": true,
"turnCompleteReason": "TURN_COMPLETE_REASON_UNSPECIFIED",
"finishReason": "FINISH_REASON_UNSPECIFIED",
"errorCode": "<string>",
"errorMessage": "<string>",
"interrupted": true,
"customMetadata": {},
"usageMetadata": {
"cacheTokensDetails": [
{
"modality": "MODALITY_UNSPECIFIED",
"tokenCount": 123
}
],
"cachedContentTokenCount": 123,
"candidatesTokenCount": 123,
"candidatesTokensDetails": [
{
"modality": "MODALITY_UNSPECIFIED",
"tokenCount": 123
}
],
"promptTokenCount": 123,
"promptTokensDetails": [
{
"modality": "MODALITY_UNSPECIFIED",
"tokenCount": 123
}
],
"thoughtsTokenCount": 123,
"toolUsePromptTokenCount": 123,
"toolUsePromptTokensDetails": [
{
"modality": "MODALITY_UNSPECIFIED",
"tokenCount": 123
}
],
"totalTokenCount": 123,
"trafficType": "TRAFFIC_TYPE_UNSPECIFIED"
},
"liveSessionResumptionUpdate": {
"newHandle": "<string>",
"resumable": true,
"lastConsumedClientMessageIndex": 123
},
"liveSessionId": "<string>",
"goAway": {
"timeLeft": "<string>"
},
"inputTranscription": {
"text": "<string>",
"finished": true,
"languageCode": "<string>"
},
"outputTranscription": {
"text": "<string>",
"finished": true,
"languageCode": "<string>"
},
"avgLogprobs": 123,
"logprobsResult": {
"chosenCandidates": [
{
"logProbability": 123,
"token": "<string>",
"tokenId": 123
}
],
"topCandidates": [
{
"candidates": [
{
"logProbability": 123,
"token": "<string>",
"tokenId": 123
}
]
}
],
"logProbabilitySum": 123
},
"cacheMetadata": {
"fingerprint": "<string>",
"contents_count": 1,
"cache_name": "<string>",
"expire_time": 123,
"invocations_used": 1,
"created_at": 123
},
"citationMetadata": {
"citations": [
{
"endIndex": 123,
"license": "<string>",
"publicationDate": {
"day": 123,
"month": 123,
"year": 123
},
"startIndex": 123,
"title": "<string>",
"uri": "<string>"
}
]
},
"interactionId": "<string>",
"invocationId": "",
"author": "",
"actions": {
"skipSummarization": true,
"stateDelta": {},
"artifactDelta": {},
"transferToAgent": "<string>",
"escalate": true,
"requestedAuthConfigs": {},
"requestedToolConfirmations": {},
"compaction": {
"startTimestamp": 123,
"endTimestamp": 123,
"compactedContent": {
"parts": [
{
"mediaResolution": {
"level": "MEDIA_RESOLUTION_UNSPECIFIED",
"numTokens": 123
},
"codeExecutionResult": {
"outcome": "OUTCOME_UNSPECIFIED",
"output": "<string>",
"id": "<string>"
},
"executableCode": {
"code": "<string>",
"language": "LANGUAGE_UNSPECIFIED",
"id": "<string>"
},
"fileData": {
"displayName": "<string>",
"fileUri": "<string>",
"mimeType": "<string>"
},
"functionCall": {
"id": "<string>",
"args": {},
"name": "<string>",
"partialArgs": [
{
"boolValue": true,
"jsonPath": "<string>",
"nullValue": "NULL_VALUE",
"numberValue": 123,
"stringValue": "<string>",
"willContinue": true
}
],
"willContinue": true
},
"functionResponse": {
"willContinue": true,
"scheduling": "SCHEDULING_UNSPECIFIED",
"parts": [
{
"inlineData": {
"mimeType": "<string>",
"data": "<string>",
"displayName": "<string>"
},
"fileData": {
"fileUri": "<string>",
"mimeType": "<string>",
"displayName": "<string>"
}
}
],
"id": "<string>",
"name": "<string>",
"response": {}
},
"inlineData": {
"data": "<string>",
"displayName": "<string>",
"mimeType": "<string>"
},
"text": "<string>",
"thought": true,
"thoughtSignature": "<string>",
"videoMetadata": {
"endOffset": "<string>",
"fps": 123,
"startOffset": "<string>"
},
"toolCall": {
"id": "<string>",
"toolType": "TOOL_TYPE_UNSPECIFIED",
"args": {}
},
"toolResponse": {
"id": "<string>",
"toolType": "TOOL_TYPE_UNSPECIFIED",
"response": {}
},
"partMetadata": {}
}
],
"role": "<string>"
}
},
"endOfAgent": true,
"agentState": {},
"rewindBeforeInvocationId": "<string>",
"route": true,
"renderUiWidgets": [
{
"id": "<string>",
"provider": "<string>",
"payload": {}
}
],
"setModelResponse": null
},
"output": null,
"nodeInfo": {
"path": "",
"outputFor": [
"<string>"
],
"messageAsOutput": true
},
"longRunningToolIds": [
"<string>"
],
"branch": "<string>",
"isolationScope": "<string>",
"id": "",
"timestamp": 123
}
]{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Run an agent
Run one invocation and return all events as a JSON array after completion; streaming does not change this response format
Create the session first by default; --auto_create_session allows automatic creation. appName may be omitted when ADK_DEFAULT_APP_NAME is configured
curl --request POST \
--url http://localhost:8000/run \
--header 'Content-Type: application/json' \
--data '
{
"userId": "user-001",
"sessionId": "session-001"
}
'import requests
url = "http://localhost:8000/run"
payload = {
"userId": "user-001",
"sessionId": "session-001"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({userId: 'user-001', sessionId: 'session-001'})
};
fetch('http://localhost:8000/run', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));[
{
"modelVersion": "<string>",
"content": {
"parts": [
{
"mediaResolution": {
"level": "MEDIA_RESOLUTION_UNSPECIFIED",
"numTokens": 123
},
"codeExecutionResult": {
"outcome": "OUTCOME_UNSPECIFIED",
"output": "<string>",
"id": "<string>"
},
"executableCode": {
"code": "<string>",
"language": "LANGUAGE_UNSPECIFIED",
"id": "<string>"
},
"fileData": {
"displayName": "<string>",
"fileUri": "<string>",
"mimeType": "<string>"
},
"functionCall": {
"id": "<string>",
"args": {},
"name": "<string>",
"partialArgs": [
{
"boolValue": true,
"jsonPath": "<string>",
"nullValue": "NULL_VALUE",
"numberValue": 123,
"stringValue": "<string>",
"willContinue": true
}
],
"willContinue": true
},
"functionResponse": {
"willContinue": true,
"scheduling": "SCHEDULING_UNSPECIFIED",
"parts": [
{
"inlineData": {
"mimeType": "<string>",
"data": "<string>",
"displayName": "<string>"
},
"fileData": {
"fileUri": "<string>",
"mimeType": "<string>",
"displayName": "<string>"
}
}
],
"id": "<string>",
"name": "<string>",
"response": {}
},
"inlineData": {
"data": "<string>",
"displayName": "<string>",
"mimeType": "<string>"
},
"text": "<string>",
"thought": true,
"thoughtSignature": "<string>",
"videoMetadata": {
"endOffset": "<string>",
"fps": 123,
"startOffset": "<string>"
},
"toolCall": {
"id": "<string>",
"toolType": "TOOL_TYPE_UNSPECIFIED",
"args": {}
},
"toolResponse": {
"id": "<string>",
"toolType": "TOOL_TYPE_UNSPECIFIED",
"response": {}
},
"partMetadata": {}
}
],
"role": "<string>"
},
"groundingMetadata": {
"imageSearchQueries": [
"<string>"
],
"groundingChunks": [
{
"image": {
"sourceUri": "<string>",
"imageUri": "<string>",
"title": "<string>",
"domain": "<string>"
},
"maps": {
"placeAnswerSources": {
"reviewSnippet": [
{
"authorAttribution": {
"displayName": "<string>",
"photoUri": "<string>",
"uri": "<string>"
},
"flagContentUri": "<string>",
"googleMapsUri": "<string>",
"relativePublishTimeDescription": "<string>",
"review": "<string>",
"reviewId": "<string>",
"title": "<string>"
}
],
"flagContentUri": "<string>",
"reviewSnippets": [
{
"authorAttribution": {
"displayName": "<string>",
"photoUri": "<string>",
"uri": "<string>"
},
"flagContentUri": "<string>",
"googleMapsUri": "<string>",
"relativePublishTimeDescription": "<string>",
"review": "<string>",
"reviewId": "<string>",
"title": "<string>"
}
]
},
"placeId": "<string>",
"text": "<string>",
"title": "<string>",
"uri": "<string>",
"route": {
"distanceMeters": 123,
"duration": "<string>",
"encodedPolyline": "<string>"
}
},
"retrievedContext": {
"documentName": "<string>",
"ragChunk": {
"pageSpan": {
"firstPage": 123,
"lastPage": 123
},
"text": "<string>",
"chunkId": "<string>",
"fileId": "<string>"
},
"text": "<string>",
"title": "<string>",
"uri": "<string>",
"customMetadata": [
{
"key": "<string>",
"numericValue": 123,
"stringListValue": {
"values": [
"<string>"
]
},
"stringValue": "<string>"
}
],
"fileSearchStore": "<string>",
"pageNumber": 123,
"mediaId": "<string>"
},
"web": {
"domain": "<string>",
"title": "<string>",
"uri": "<string>"
}
}
],
"groundingSupports": [
{
"confidenceScores": [
123
],
"groundingChunkIndices": [
123
],
"segment": {
"startIndex": 123,
"endIndex": 123,
"partIndex": 123,
"text": "<string>"
},
"renderedParts": [
123
]
}
],
"retrievalMetadata": {
"googleSearchDynamicRetrievalScore": 123
},
"searchEntryPoint": {
"renderedContent": "<string>",
"sdkBlob": "<string>"
},
"webSearchQueries": [
"<string>"
],
"googleMapsWidgetContextToken": "<string>",
"retrievalQueries": [
"<string>"
],
"sourceFlaggingUris": [
{
"flagContentUri": "<string>",
"sourceId": "<string>"
}
]
},
"partial": true,
"turnComplete": true,
"turnCompleteReason": "TURN_COMPLETE_REASON_UNSPECIFIED",
"finishReason": "FINISH_REASON_UNSPECIFIED",
"errorCode": "<string>",
"errorMessage": "<string>",
"interrupted": true,
"customMetadata": {},
"usageMetadata": {
"cacheTokensDetails": [
{
"modality": "MODALITY_UNSPECIFIED",
"tokenCount": 123
}
],
"cachedContentTokenCount": 123,
"candidatesTokenCount": 123,
"candidatesTokensDetails": [
{
"modality": "MODALITY_UNSPECIFIED",
"tokenCount": 123
}
],
"promptTokenCount": 123,
"promptTokensDetails": [
{
"modality": "MODALITY_UNSPECIFIED",
"tokenCount": 123
}
],
"thoughtsTokenCount": 123,
"toolUsePromptTokenCount": 123,
"toolUsePromptTokensDetails": [
{
"modality": "MODALITY_UNSPECIFIED",
"tokenCount": 123
}
],
"totalTokenCount": 123,
"trafficType": "TRAFFIC_TYPE_UNSPECIFIED"
},
"liveSessionResumptionUpdate": {
"newHandle": "<string>",
"resumable": true,
"lastConsumedClientMessageIndex": 123
},
"liveSessionId": "<string>",
"goAway": {
"timeLeft": "<string>"
},
"inputTranscription": {
"text": "<string>",
"finished": true,
"languageCode": "<string>"
},
"outputTranscription": {
"text": "<string>",
"finished": true,
"languageCode": "<string>"
},
"avgLogprobs": 123,
"logprobsResult": {
"chosenCandidates": [
{
"logProbability": 123,
"token": "<string>",
"tokenId": 123
}
],
"topCandidates": [
{
"candidates": [
{
"logProbability": 123,
"token": "<string>",
"tokenId": 123
}
]
}
],
"logProbabilitySum": 123
},
"cacheMetadata": {
"fingerprint": "<string>",
"contents_count": 1,
"cache_name": "<string>",
"expire_time": 123,
"invocations_used": 1,
"created_at": 123
},
"citationMetadata": {
"citations": [
{
"endIndex": 123,
"license": "<string>",
"publicationDate": {
"day": 123,
"month": 123,
"year": 123
},
"startIndex": 123,
"title": "<string>",
"uri": "<string>"
}
]
},
"interactionId": "<string>",
"invocationId": "",
"author": "",
"actions": {
"skipSummarization": true,
"stateDelta": {},
"artifactDelta": {},
"transferToAgent": "<string>",
"escalate": true,
"requestedAuthConfigs": {},
"requestedToolConfirmations": {},
"compaction": {
"startTimestamp": 123,
"endTimestamp": 123,
"compactedContent": {
"parts": [
{
"mediaResolution": {
"level": "MEDIA_RESOLUTION_UNSPECIFIED",
"numTokens": 123
},
"codeExecutionResult": {
"outcome": "OUTCOME_UNSPECIFIED",
"output": "<string>",
"id": "<string>"
},
"executableCode": {
"code": "<string>",
"language": "LANGUAGE_UNSPECIFIED",
"id": "<string>"
},
"fileData": {
"displayName": "<string>",
"fileUri": "<string>",
"mimeType": "<string>"
},
"functionCall": {
"id": "<string>",
"args": {},
"name": "<string>",
"partialArgs": [
{
"boolValue": true,
"jsonPath": "<string>",
"nullValue": "NULL_VALUE",
"numberValue": 123,
"stringValue": "<string>",
"willContinue": true
}
],
"willContinue": true
},
"functionResponse": {
"willContinue": true,
"scheduling": "SCHEDULING_UNSPECIFIED",
"parts": [
{
"inlineData": {
"mimeType": "<string>",
"data": "<string>",
"displayName": "<string>"
},
"fileData": {
"fileUri": "<string>",
"mimeType": "<string>",
"displayName": "<string>"
}
}
],
"id": "<string>",
"name": "<string>",
"response": {}
},
"inlineData": {
"data": "<string>",
"displayName": "<string>",
"mimeType": "<string>"
},
"text": "<string>",
"thought": true,
"thoughtSignature": "<string>",
"videoMetadata": {
"endOffset": "<string>",
"fps": 123,
"startOffset": "<string>"
},
"toolCall": {
"id": "<string>",
"toolType": "TOOL_TYPE_UNSPECIFIED",
"args": {}
},
"toolResponse": {
"id": "<string>",
"toolType": "TOOL_TYPE_UNSPECIFIED",
"response": {}
},
"partMetadata": {}
}
],
"role": "<string>"
}
},
"endOfAgent": true,
"agentState": {},
"rewindBeforeInvocationId": "<string>",
"route": true,
"renderUiWidgets": [
{
"id": "<string>",
"provider": "<string>",
"payload": {}
}
],
"setModelResponse": null
},
"output": null,
"nodeInfo": {
"path": "",
"outputFor": [
"<string>"
],
"messageAsOutput": true
},
"longRunningToolIds": [
"<string>"
],
"branch": "<string>",
"isolationScope": "<string>",
"id": "",
"timestamp": 123
}
]{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}streaming: true does not change it to SSE. Use Run an agent with SSE to consume events as they arriveBody
User ID
Session ID
Application name; falls back to ADK_DEFAULT_APP_NAME when omitted and returns 400 if no default is configured
Input message for this turn; it may be omitted when resuming an invocation supported by the application
Show child attributes
Show child attributes
Request incremental model streaming; defaults to false
Session state changes to apply
Event ID of the function call, used for streaming function-response handling
Invocation ID
Custom metadata
Response
Successful response
Model version
Message content
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Whether this event contains partial content
Whether the current turn is complete
TURN_COMPLETE_REASON_UNSPECIFIED, MALFORMED_FUNCTION_CALL, RESPONSE_REJECTED, NEED_MORE_INPUT, PROHIBITED_INPUT_CONTENT, IMAGE_PROHIBITED_INPUT_CONTENT, INPUT_TEXT_CONTAIN_PROMINENT_PERSON_PROHIBITED, INPUT_IMAGE_CELEBRITY, INPUT_IMAGE_PHOTO_REALISTIC_CHILD_PROHIBITED, INPUT_TEXT_NCII_PROHIBITED, INPUT_OTHER, INPUT_IP_PROHIBITED, BLOCKLIST, UNSAFE_PROMPT_FOR_IMAGE_GENERATION, GENERATED_IMAGE_SAFETY, GENERATED_CONTENT_SAFETY, GENERATED_AUDIO_SAFETY, GENERATED_VIDEO_SAFETY, GENERATED_CONTENT_PROHIBITED, GENERATED_CONTENT_BLOCKLIST, GENERATED_IMAGE_PROHIBITED, GENERATED_IMAGE_CELEBRITY, GENERATED_IMAGE_PROMINENT_PEOPLE_DETECTED_BY_REWRITER, GENERATED_IMAGE_IDENTIFIABLE_PEOPLE, GENERATED_IMAGE_MINORS, OUTPUT_IMAGE_IP_PROHIBITED, GENERATED_OTHER, MAX_REGENERATION_REACHED Reason generation ended
FINISH_REASON_UNSPECIFIED, STOP, MAX_TOKENS, SAFETY, RECITATION, LANGUAGE, OTHER, BLOCKLIST, PROHIBITED_CONTENT, SPII, MALFORMED_FUNCTION_CALL, IMAGE_SAFETY, UNEXPECTED_TOOL_CALL, IMAGE_PROHIBITED_CONTENT, NO_IMAGE, IMAGE_RECITATION, IMAGE_OTHER Error code
Error message
Whether the response was interrupted
Custom metadata
Model usage information
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Interaction ID
Invocation ID
Event author, usually user or an agent name
State, artifact, and control actions carried by the event
Show child attributes
Show child attributes
Show child attributes
Show child attributes
IDs of long-running tool calls awaiting results
Execution branch associated with the event
Identifier
Event time as a Unix timestamp in seconds