genai:AgenticHandler
A handler that uses generative AI to execute actions through an iterative reasoning loop.
Extends: actions:Handler
Instances of this handler type are configured with a model, prompt template, and constraints. The handler invokes genai:textComplete to generate SPARQL scripts that accomplish the action's goal.
Properties
genai:agentModel (required, max 1)
The generative AI model to use for this agentic handler.
Agentic handler must have exactly one model configured.
Specifies which model instance (e.g., claude:Haiku, claude:Sonnet) the agent uses for reasoning.
genai:contextWindowSize (optional, max 1)
The context window size in tokens for the agent's compaction budget.
Agentic handler may specify context window size >= 1 (default is 200000).
Used by CompactionPolicy to determine the token budget (budget = contextWindowSize × tokenBudgetRatio). If not specified, defaults to 200,000 tokens.
genai:initialMemory (optional, max 1)
A CONSTRUCT script whose result is merged into the agent's working memory before the first iteration.
Agentic handler may provide a CONSTRUCT runnable for initial working memory.
Executes against the full dataset with ?_process bound to the current execution. Allows the developer to inject relevant instance data into the sub-agent's working memory.
genai:initialSchemas (optional, max 1)
RDF list of class/property URIs whose schema docs are pre-loaded into the agent's semantic memory.
Agentic handler may provide an RDF list of schema URIs to pre-load.
Each URI is resolved via SchemaIndex at invocation time. Pre-loading schemas lets the agent start productive without DEFINE queries.
genai:maxConsecutiveFailures (optional, max 1)
Maximum consecutive failures before the agent aborts.
Agentic handler may specify max consecutive failures >= 1 (default is 3).
Limits retry attempts when the agent repeatedly fails (parse errors, execution errors, or duplicate queries). Prevents infinite loops and token waste. Default is 3 if not specified.
genai:maxIterations (required, max 1)
Maximum number of iterations the agent can perform before failing.
Agentic handler must have max iterations >= 1.
Limits the agent's reasoning loop. Single-shot agents use 1, iterative agents use higher values.
genai:taskPrompt (required, max 1)
Reference to the task-specific prompt artifact for this agent.
Agentic handler must have a task prompt.
The artifact URI containing the task prompt that describes what the agent should accomplish. Combined with a standard system prompt at runtime.
genai:timeoutSeconds (optional, max 1)
Timeout in seconds for LLM completion calls.
Agentic handler may specify timeout in seconds >= 1 (default is 30).
Maximum time to wait for the LLM to generate a response. If exceeded, the iteration fails. Default is 30 seconds if not specified.