AnthropicAiQueryNodeConfiguration
Namespace: Meshmakers.Octo.MeshAdapter.Nodes.Transform
Configuration for Anthropic AI Query node that uses Claude to extract information from data
public record AnthropicAiQueryNodeConfiguration : SourceTargetPathNodeConfiguration, INodeConfiguration, IEquatable<NodeConfiguration>, ITargetPathNodeConfiguration, IEquatable<TargetPathNodeConfiguration>, IPathNodeConfiguration, IEquatable<SourceTargetPathNodeConfiguration>, IEquatable<AnthropicAiQueryNodeConfiguration>
Inheritance Object → NodeConfiguration → TargetPathNodeConfiguration → SourceTargetPathNodeConfiguration → AnthropicAiQueryNodeConfiguration
Implements INodeConfiguration, IEquatable<NodeConfiguration>, ITargetPathNodeConfiguration, IEquatable<TargetPathNodeConfiguration>, IPathNodeConfiguration, IEquatable<SourceTargetPathNodeConfiguration>, IEquatable<AnthropicAiQueryNodeConfiguration>
Fields
DefaultSystemPrompt
The system prompt used when neither the node nor a prompt template sets one — the text this node has always defaulted to.
public static string DefaultSystemPrompt;
Properties
ApiKeyConfigurationName
Name of the AiConfiguration entity in GlobalConfiguration to load the API key from. When set, the API key is read from the configuration entity and never exposed in the data context. Takes precedence over AnthropicAiQueryNodeConfiguration.ApiKey.
public string ApiKeyConfigurationName { get; set; }
Property Value
ApiKey
The Anthropic API key for authentication. Prefer using AnthropicAiQueryNodeConfiguration.ApiKeyConfigurationName to avoid exposing the key in pipeline definitions.
public string ApiKey { get; set; }
Property Value
Model
The Claude model to use (e.g., "claude-sonnet-4-6", "claude-opus-4-1").
Optional on the node when the promptTemplateName template supplies
DefaultModelId or the referenced AiConfiguration supplies aiModel; those values
take precedence, in that order. There is deliberately no hard-coded default model — a pinned model
id goes out of date, so the model must be provided explicitly (node or AiConfiguration).
public string Model { get; set; }
Property Value
PromptTemplateName
Optional well-known name of a System.Ai/AiPromptTemplate entity with
PromptPurpose``KnowledgeGeneration. The node loads its system prompt
(SystemPromptFragment, plus FewShotExamples), its question (UserTemplate)
and its model settings (DefaultModelId, Temperature, MaxTokens) from it.
public string PromptTemplateName { get; set; }
Property Value
Remarks:
The template is handed over like the AiConfiguration of apiKeyConfigurationName:
the pipeline needs a Uses association to the template entity. The adapter caches
the configuration when the pipeline is registered, so a changed prompt takes effect after
the pipeline is redeployed.
Precedence: an inline question or systemPrompt overrides the
template's text. Model, temperature and max tokens come from the template first, then
from the AiConfiguration, then from the node properties. A named template that is not
handed over, is not an AiPromptTemplate or is not a KnowledgeGeneration template fails
the node with an error naming the template.
Question
The question/prompt to ask the AI about the data. Required unless
promptTemplateName names a template with a UserTemplate; when set, it
overrides the template's UserTemplate.
public string Question { get; set; }
Property Value
DataPaths
Optional context data paths to include in the query (e.g., ["$.ExtractedText", "$.DocumentMetadata"])
public String[] DataPaths { get; set; }
Property Value
SystemPrompt
System prompt to set the context for the AI. When set, it overrides the
SystemPromptFragment of the promptTemplateName template; when neither
is set, the old default text applies (the behaviour in older versions).
public string SystemPrompt { get; set; }
Property Value
MaxTokens
Maximum tokens for the response. A MaxTokens value on the promptTemplateName
template, then a maxTokens value on the referenced AiConfiguration entity take precedence;
this property is the fallback.
public int MaxTokens { get; set; }
Property Value
Temperature
Temperature for response generation (0.0 to 1.0). A Temperature value on the
promptTemplateName template, then a temperature value on the referenced
AiConfiguration entity take precedence; this property is the fallback.
public double Temperature { get; set; }
Property Value
ResponseFormat
Expected response format (e.g., "json", "text")
public string ResponseFormat { get; set; }
Property Value
IncludeRawResponse
Whether to include the raw AI response in the output
public bool IncludeRawResponse { get; set; }
Property Value
RawResponseOutputPath
Output path for the raw AI response (if IncludeRawResponse is true)
public string RawResponseOutputPath { get; set; }
Property Value
ContinueOnError
Whether to continue processing if the AI query fails
public bool ContinueOnError { get; set; }
Property Value
McpServerUrl
Optional URL of the OctoMesh MCP server (e.g. "https://localhost:5017"). When set, Claude can use MCP tools to query live OctoMesh data instead of relying on static context. The tenant ID is appended automatically: {McpServerUrl}/{tenantId}/mcp The AiConfiguration's McpServerUrl (via apiKeyConfigurationName) takes precedence. MCP is only called with an identity — AnthropicAiQueryNodeConfiguration.McpServiceAccountConfigName or delegation to the caller. Without one the node skips MCP with one warning and runs the query without tools.
public string McpServerUrl { get; set; }
Property Value
MaxToolRounds
Maximum number of tool use rounds to prevent infinite loops (default: 10)
public int MaxToolRounds { get; set; }
Property Value
McpToolNames
Optional list of MCP tool names to expose to Claude. If set, only these tools are available. Reduces context size by excluding unused tools (e.g., ["query_entities_simple", "navigate_associations"]).
public String[] McpToolNames { get; set; }
Property Value
McpServiceAccountConfigName
Optional well-known name of a System.Communication/ServiceAccountConfiguration entity
used to authenticate the MCP tool calls. When set, the node acquires an OAuth2
client-credentials token and sends it as a Authorization: Bearer header on the
{McpServerUrl}/{tenantId}/mcp requests. Required for MCP tools: the MCP server enforces
authentication, so without this setting (or delegation to the caller) the node does not
call MCP at all — it warns once and runs the query without tools. The token is that of
exactly this account; when the configuration yields no token (missing, broken, refused)
the node likewise makes no MCP call, warns once and runs the query without tools.
public string McpServiceAccountConfigName { get; set; }
Property Value
McpDelegateToCaller
When true, the MCP calls run under the end user's identity instead of the
service account's: the node exchanges the caller's access token for a delegated one
(OctoMesh on-behalf-of grant) via
AnthropicAiQueryNodeConfiguration.McpServiceAccountConfigName, so the MCP server sees the user's own roles
and data permissions rather than the service account's full octo_api reach.
public bool McpDelegateToCaller { get; set; }
Property Value
Remarks:
Requires a trigger that carries a caller token — today FromHttpRequest@2 with
allowAnonymous: false. Fail-closed: with no caller token, or when the
delegated token cannot be acquired, the node fails; it never falls back to the service
account and never sends an unauthenticated MCP request. Channel assistants (Teams,
Signal, e-mail) have no caller and must leave this off.
Default false keeps the service-account behaviour: a service account that yields
no token means no MCP call and a query without tools, never a failed pipeline.
Identity
The general execution-identity property. On this node it drives the MCP call
identity rather than a repository session:
delegates to the calling user (on-behalf-of, the same as legacy
AnthropicAiQueryNodeConfiguration.McpDelegateToCaller = true);
and use the service account's own token.
public NodeExecutionIdentity Identity { get; set; }
Property Value
NodeExecutionIdentity
Remarks:
The default is — not the
default of the data nodes — because the AI
node's historical behaviour (AnthropicAiQueryNodeConfiguration.McpDelegateToCaller absent) is to call MCP as
the service account. AnthropicAiQueryNodeConfiguration.McpDelegateToCaller stays supported as an alias:
setting either it or identity: Caller selects delegation, so both spellings keep
working.
DelegatesToCaller
Whether this node's MCP calls run on the caller's identity ( alias resolution):
true when either the legacy AnthropicAiQueryNodeConfiguration.McpDelegateToCaller flag is set or
AnthropicAiQueryNodeConfiguration.Identity is . Either "caller"
spelling wins, so a pipeline can use whichever it likes.
public bool DelegatesToCaller { get; }
Property Value
ConversationHistoryPath
Optional JSON path to conversation history array. Each entry should have "role" (user/assistant) and "content" fields. When set, previous messages are included for multi-turn conversations.
public string ConversationHistoryPath { get; set; }
Property Value
JsonFormatSample
Sample JSON format for structured responses
public string JsonFormatSample { get; set; }
Property Value
JsonSchema
Optional JSON Schema (as a JSON string) the answer must satisfy; only used with
responseFormat: json. The node requests constrained decoding with the schema,
validates the parsed answer against it and, if invalid, runs at most
maxJsonRepairAttempts repair calls that resend only the broken answer, the errors and
the schema. An answer that stays invalid fails the node with an error naming the violated
path(s). Without jsonSchema the node behaves as before.
public string JsonSchema { get; set; }
Property Value
Remarks:
When set, the node (1) asks the API for constrained decoding with the schema
(output_config.format, structured outputs), (2) validates the parsed answer
against the full schema after the deterministic repairs (JSON extraction from prose,
mechanical repair of naked quotes, trailing commas and unclosed brackets, repeated
keys), and (3) when the answer still does not parse or violates the schema, runs at
most AnthropicAiQueryNodeConfiguration.MaxJsonRepairAttempts repair calls that send only the broken answer,
the errors and the schema back — never the original prompt or context. If the answer
is still invalid the node fails with an error that names the violated path(s);
AnthropicAiQueryNodeConfiguration.ContinueOnError applies as usual.
Schema keywords the API does not support for constrained decoding (numeric and string
length constraints, pattern, array size constraints) are removed from the copy
sent to the API and enforced by the client-side validation only.
Without jsonSchema the node behaves exactly as before: no constrained decoding,
no validation, no repair calls.
MaxJsonRepairAttempts
Upper bound of repair calls when a jsonSchema answer does not parse or does not
validate (default 1, hard-capped at 2, 0 = no repair call). Each call resends only the
broken answer, the parser or validation errors and the schema. Ignored without
jsonSchema.
public int MaxJsonRepairAttempts { get; set; }
Property Value
UsageOutputPath
Optional JSONPath where the node writes what its API calls used: model,
calls, inputTokens, outputTokens, cacheReadInputTokens,
cacheCreationInputTokens and estimatedCostUsd (with priceListDate), summed
over every call of the execution — tool rounds and JSON repair calls included. Not set = nothing
is written (the behaviour in older versions).
public string UsageOutputPath { get; set; }
Property Value
Remarks:
inputTokens is the uncached remainder; the full prompt size is the sum of the three input
fields. estimatedCostUsd uses the adapter's built-in Anthropic list prices
(first-party API, 5-minute cache writes) and is null for a model the table does not know.
It is an estimate, not the invoice. With continueOnError the usage is written for a failed
query too, since the calls were made and paid.
CacheSource
When true, the main content of the user message (the value at path) is sent as its
own text block with an ephemeral prompt-cache breakpoint, followed by a second block with
the dataPaths context, the caller and the question. Calls whose request is
identical up to the end of that block (same tools, same system prompt, same source) read it from
the cache (cacheReadInputTokens) within its 5-minute lifetime: every MCP tool round of one
execution, and repeated runs of the same node over the same source (e.g. reviewer rounds that only
change the draft in dataPaths). Default false: the user message is a single string,
as before; the text the model reads is the same either way.
public bool CacheSource { get; set; }
Property Value
Remarks:
A cache write costs 1.25× input once; a hit costs about 0.1× (less on newer models). It pays off from the second call over the same source. Prefixes below the model's minimum cacheable length (512–4096 tokens) are silently not cached. The cache is a prefix match (tools, then system prompt, then messages): two nodes with different system prompts never share the cached source. The system prompt and the tool list are cached regardless of this setting.
Path
public string Path { get; set; }
Property Value
TargetPath
public string TargetPath { get; set; }
Property Value
TargetValueWriteMode
public TargetValueWriteModes TargetValueWriteMode { get; set; }
Property Value
TargetValueWriteModes
TargetValueKind
public ValueKinds TargetValueKind { get; set; }
Property Value
ValueKinds
DocumentMode
public DocumentModes DocumentMode { get; set; }
Property Value
DocumentModes
Description
public string Description { get; set; }
Property Value
Constructors
AnthropicAiQueryNodeConfiguration()
public AnthropicAiQueryNodeConfiguration()