post/run

Request

  • The document declares no server URL.
  • Auth
    none declared

Request body

RunAgentRequest required

Request body for the /run and /run_sse endpoints.

appName, string nullable
userId, string required
sessionId, string required
newMessage, Content nullable

Contains the multi-part content of a message.

streaming, boolean
stateDelta, object nullable
functionCallEventId, string nullable
invocationId, string nullable
customMetadata, object nullable
serviceTier, union

Response

Successful Response

EventOutput[] required
modelVersion, string nullable
content, Content nullable

Contains the multi-part content of a message.

groundingMetadata, GroundingMetadata nullable

Information for various kinds of grounding.

partial, boolean nullable
turnComplete, boolean nullable
turnCompleteReason, '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' nullable

The reason why the turn is complete.

interactionStatus, 'INTERACTION_STATUS_UNSPECIFIED' | 'IN_PROGRESS' | 'REQUIRES_ACTION' | 'IDLE' nullable

The different activity states of the live session.

finishReason, 'FINISH_REASON_UNSPECIFIED' | 'STOP' | 'MAX_TOKENS' | 'SAFETY' | 'RECITATION' | 'LANGUAGE' | 'OTHER' | 'BLOCKLIST' | 'PROHIBITED_CONTENT' | 'SPII' | 'MALFORMED_FUNCTION_CALL' | 'IMAGE_SAFETY' | 'IMAGE_PROHIBITED_CONTENT' | 'IMAGE_OTHER' | 'NO_IMAGE' | 'IMAGE_RECITATION' | 'UNEXPECTED_TOOL_CALL' | 'TOO_MANY_TOOL_CALLS' | 'MISSING_THOUGHT_SIGNATURE' | 'MALFORMED_RESPONSE' | 'ESCALATION' | 'PUP_LIMITED_DISABLED' | 'CONTINUATION' | 'MODEL_ARMOR' nullable

Output only.

The reason why the model stopped generating tokens. If empty, the model has not stopped generating.

errorCode, string nullable
errorMessage, string nullable
interrupted, boolean nullable
customMetadata, object nullable
usageMetadata, GenerateContentResponseUsageMetadata nullable

Usage metadata about the content generation request and response.

This message provides a detailed breakdown of token usage and other relevant metrics. This data type is not supported in Gemini API.

cacheCreationTokenCount, integer nullable
liveSessionResumptionUpdate, LiveServerSessionResumptionUpdate nullable

Update of the session resumption state.

Only sent if session_resumption was set in the connection config.

liveSessionId, string nullable
goAway, LiveServerGoAway nullable

Server will not be able to service client soon.

voiceActivity, VoiceActivity nullable

Voice activity signal.

inputTranscription, Transcription nullable

Audio transcription in Server Content.

outputTranscription, Transcription nullable

Audio transcription in Server Content.

avgLogprobs, number nullable
logprobsResult, LogprobsResult nullable

The log probabilities of the tokens generated by the model.

This is useful for understanding the model's confidence in its predictions and for debugging. For example, you can use log probabilities to identify when the model is making a less confident prediction or to explore alternative responses that the model considered. A low log probability can also indicate that the model is "hallucinating" or generating factually incorrect information.

cacheMetadata, CacheMetadata nullable

Metadata for context cache associated with LLM responses.

This class stores cache identification, usage tracking, and lifecycle information for a particular cache instance. It can be in two states:

  1. Active cache state: cache_name is set, all fields populated, except created_at when ADK did not create the cache
  2. Fingerprint-only state: cache_name is None, only fingerprint and contents_count are set for prefix matching

Token counts (cached and total) are available in the LlmResponse.usage_metadata and should be accessed from there to avoid duplication. Cache-creation (write) token counts, when reported by the provider, are available on LlmResponse.cache_creation_token_count.

Attributes: cache_name: The full resource name of the cached content (e.g., 'projects/123/locations/us-central1/cachedContents/456'). None when no active cache exists (fingerprint-only state). expire_time: Unix timestamp when the cache expires. None when no active cache exists. fingerprint: Hash of cacheable contents (instruction + tools + contents). Always present for prefix matching. invocations_used: Number of invocations this cache has been used for. None when no active cache exists. contents_count: Number of contents. When active cache exists, this is the count of cached contents. When no active cache exists, this is the count of the cacheable content prefix used for fingerprinting. created_at: Unix timestamp when ADK created the cache. None when no active cache exists, or when the active cache was created outside ADK. ADK only deletes caches it created.

citationMetadata, CitationMetadata nullable

Citation information when the model quotes another source.

interactionId, string nullable
environmentId, string nullable
id, string
invocationId, string
author, string
actions, EventActionsOutput

Represents the actions attached to an event.

output, unknown
nodeInfo, NodeInfo

Workflow node metadata attached to an Event.

longRunningToolIds, string[] nullable
branch, string nullable
isolationScope, string nullable
timestamp, number

Changes

    • warning

      added the new ESCALATION enum value to the items/finishReason/anyOf[subschema #1: FinishReason] response property for the response status

    • warning

      added the new MALFORMED_RESPONSE enum value to the items/finishReason/anyOf[subschema #1: FinishReason] response property for the response status

    • warning

      added the new MISSING_THOUGHT_SIGNATURE enum value to the items/finishReason/anyOf[subschema #1: FinishReason] response property for the response status

    32 more changes in this revision