Interface ResourceAiDelegate
- All Known Implementing Classes:
DefaultResourceAiDelegate
Exposure is opt-out: ResourceTypeMeta.getAiDelegate() returns a delegate at
ResourceAiDelegate.AiCapability.Read unless a resource type replaces it. Resource types holding secrets or
otherwise unsuitable for agent consumption should lower the level. A type that stores a
credential as anything other than SecretConfig must name that field in additionalSensitiveKeys() or stay below ResourceAiDelegate.AiCapability.Read, since name-based redaction
is a heuristic and not a guarantee. For example:
ResourceTypeMeta.newBuilder(MyResourceConfiguration.class)
.resourceType(MyResourceConfiguration.RESOURCE_TYPE)
.categoryNameKey("Resources.MyNewResource")
.buildAiDelegate(builder -> builder
.capability(AiCapability.List)
.description("Connections to my proprietary widget press."))
[...]
As with the REST and scripting subsystems, a capability declared here only takes effect if an
implementation backing it also exists (ResourceTypeMeta.getResourceActionSet()). Removing
the underlying ResourceAction hides the operation regardless of what this delegate
declares.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumHow much of a resource type an AI agent may see. -
Method Summary
Modifier and TypeMethodDescriptionConfiguration field names that must be blanked before this type's configuration is shown to an agent, beyond the ones any resource type has blanked for it.default Optional<com.inductiveautomation.ignition.common.gson.JsonElement> configAsJson(ResourceCodec<?> codec, Resource resource) Renders a stored resource's configuration as the JSON an agent reads.default @NonNull ResourceAiDelegate.AiCapabilityHow much of this resource type AI agents may see.A short prose explanation of what this resource type is and what an agent can do with it, used verbatim as context for a model.default @NonNull ResourceDiagnosticsWhat a diagnostic digest for this resource type should know: how these resources fail, where their log events are, and what live state is worth reporting.
-
Method Details
-
getCapability
How much of this resource type AI agents may see.- Returns:
- the highest capability this resource type grants;
ResourceAiDelegate.AiCapability.Readby default.
-
getDescription
A short prose explanation of what this resource type is and what an agent can do with it, used verbatim as context for a model. Not localized, because it is written for a model and models are prompted in English. When empty, consumers fall back toResourceTypeMeta.getDescription(java.util.Locale)and the resource category name.- Returns:
- the description of this resource type, or an empty optional if none is provided.
-
additionalSensitiveKeys
Configuration field names that must be blanked before this type's configuration is shown to an agent, beyond the ones any resource type has blanked for it.For a field that carries a secret without being named like one: a free-form driver property blob, say, where there is no way to tell a credential from a tuning parameter. Declared here because only the subsystem knows which of its fields those are.
- Returns:
- extra field names to blank, matched case-insensitively; empty by default.
-
configAsJson
default Optional<com.inductiveautomation.ignition.common.gson.JsonElement> configAsJson(ResourceCodec<?> codec, Resource resource) throws DecodingException Renders a stored resource's configuration as the JSON an agent reads. Secrets are redacted from the result afterward, so an override does not need to blank them itself.The default handles any
JsonResourceCodec. Override it when this type's codec stores something other than JSON, so agents can still read it.- Parameters:
codec- this resource type's codec.resource- the stored resource to render.- Returns:
- the configuration as JSON, or an empty optional if this type does not render its configuration for agents.
- Throws:
DecodingException- if the stored configuration cannot be decoded.
-
getDiagnostics
What a diagnostic digest for this resource type should know: how these resources fail, where their log events are, and what live state is worth reporting. Declaring anything here is also what puts a digest panel on this type's page.- Returns:
- this resource type's diagnostic contributions; contributes nothing by default.
- See Also:
-