Class ContextRenderer

java.lang.Object
com.agentforge4j.runtime.llm.ContextRenderer

public final class ContextRenderer extends Object
Renders the subset of the shared context exposed to an agent as a JSON object — filtering by ContextMapping.inputKeys() when a mapping is provided.

An empty inputKeys list means no filtering is applied and all context values are rendered.

Entries are partitioned by provenance: trusted entries (ContextProvenance.isTrusted()) render at the JSON root with their keys unchanged, while untrusted entries (user- or external-tool-supplied) are isolated under a reserved "untrustedUserInput" object so embedded instructions are structurally separated from trusted content. The envelope is always emitted (stable shape) even when empty.

  • Field Details

    • UNTRUSTED_USER_INPUT_KEY

      public static final String UNTRUSTED_USER_INPUT_KEY
      Reserved root key under which untrusted (user- or external-tool-supplied) context entries are isolated. A trusted context key that collides with this name is rejected.
      See Also:
  • Constructor Details

    • ContextRenderer

      public ContextRenderer(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
  • Method Details