Class AgentStreamChunk

java.lang.Object
com.google.genkit.ai.agent.AgentStreamChunk

public class AgentStreamChunk extends Object
AgentStreamChunk represents a streaming chunk from an agent execution.

The customPatch field is a JSON array of JSON-patch operations (RFC 6902).

  • Constructor Details

    • AgentStreamChunk

      public AgentStreamChunk()
      Default constructor.
  • Method Details

    • builder

      public static AgentStreamChunk.Builder builder()
      Creates a builder for AgentStreamChunk.
      Returns:
      a new builder
    • getModelChunk

      public ModelResponseChunk getModelChunk()
      Returns the model response chunk.
      Returns:
      the model chunk
    • setModelChunk

      public void setModelChunk(ModelResponseChunk modelChunk)
      Sets the model response chunk.
      Parameters:
      modelChunk - the model chunk
    • getCustomPatch

      public com.fasterxml.jackson.databind.JsonNode getCustomPatch()
      Returns the custom-state patch as a JSON array of patch operations.
      Returns:
      the custom patch node (array)
    • setCustomPatch

      public void setCustomPatch(com.fasterxml.jackson.databind.JsonNode customPatch)
      Sets the custom-state patch.
      Parameters:
      customPatch - a JSON array of patch operations
    • getArtifact

      public Artifact getArtifact()
      Returns the artifact in this chunk.
      Returns:
      the artifact, or null if not present
    • setArtifact

      public void setArtifact(Artifact artifact)
      Sets the artifact.
      Parameters:
      artifact - the artifact
    • getTurnEnd

      public TurnEnd getTurnEnd()
      Returns the turn-end signal.
      Returns:
      the turn end, or null if the turn has not ended
    • setTurnEnd

      public void setTurnEnd(TurnEnd turnEnd)
      Sets the turn-end signal.
      Parameters:
      turnEnd - the turn end