run_config.go
Overview
The run_config.go file defines configuration types that control the runtime behavior of an agent within the system. Specifically, it introduces the StreamingMode type to specify how agent execution outputs are streamed, and the RunConfig struct which encapsulates runtime options such as streaming mode and input blob artifact saving. This configuration is essential for tailoring the execution characteristics of agents that interact with large language models and other runtime components.
Types and Constants
StreamingMode (type)
StreamingMode is a string-based enumeration that defines the mode of streaming for agent execution outputs. It determines how responses generated by the agent are delivered during runtime.
StreamingMode Constants
StreamingModeNone
Indicates that no streaming will occur. The agent's output is delivered only after completion.StreamingModeSSE
Enables streaming through Server-Sent Events (SSE), allowing one-way streaming where parts of the response from the large language model (LLM) are sent immediately as they are generated. This mode supports real-time partial output delivery.
RunConfig (struct)
RunConfig is a configuration struct used to control the runtime behavior of an agent. It allows fine-tuning of agent execution parameters related to output streaming and artifact management.
Fields
Field Name | Type | Description |
|---|---|---|
|
| Specifies the streaming mode for the agent execution. Determines how output is streamed. |
|
| If true, any parts of the user input that are binary blobs (e.g., images, files) are saved as artifacts by the ADK runner. |
Usage Example
config := RunConfig{
StreamingMode: StreamingModeSSE,
SaveInputBlobsAsArtifacts: true,
}
In this example, the agent will stream LLM responses using SSE and save any input blobs as artifacts.
Implementation Details
The
StreamingModetype is a string alias, enabling easy comparison and serialization.The current supported streaming modes are limited to
"none"and"sse". This design allows extensibility for future streaming modes.The
RunConfigstruct is lightweight and focused solely on runtime behavior control without embedding any execution logic.Saving input blobs as artifacts integrates with the artifact management system, allowing binary user inputs to be tracked, stored, and referenced, which is important for workflows involving files or images.
Interactions with Other System Components
Agent Execution Runner (
80560 - Agent Execution Runner)
TheRunConfigis likely consumed by the agent execution runner component to determine how to handle output streaming and whether to save input blobs as artifacts during the agent's lifecycle.Artifact Management (
80557 - Artifact Management)
WhenSaveInputBlobsAsArtifactsis enabled, the runner interacts with artifact storage services to persist blobs referenced in user input messages.LLM Integration and Agents (
80562 - LLM Integration and Agents)
The streaming mode directly affects how large language model outputs are delivered, influencing user experience and downstream processing.Agent Invocation Context (
80572 - Agent Invocation Context)
Configuration settings fromRunConfigmay influence context initialization and state management during agent invocation.
Mermaid Class Diagram
classDiagram
class RunConfig {
+StreamingMode: StreamingMode
+SaveInputBlobsAsArtifacts: bool
}
class StreamingMode {
<<enumeration>>
+StreamingModeNone
+StreamingModeSSE
}
RunConfig --> StreamingMode