Package io.jenkins.plugins.aiagentjob
Class AiAgentTypeHandler
java.lang.Object
hudson.model.AbstractDescribableImpl<AiAgentTypeHandler>
io.jenkins.plugins.aiagentjob.AiAgentTypeHandler
- All Implemented Interfaces:
ExtensionPoint,Describable<AiAgentTypeHandler>
- Direct Known Subclasses:
AntigravityAgentHandler,ClaudeCodeAgentHandler,CodexAgentHandler,CursorAgentHandler,GeminiCliAgentHandler,GrokBuildAgentHandler,OpenCodeAgentHandler
public abstract class AiAgentTypeHandler
extends AbstractDescribableImpl<AiAgentTypeHandler>
implements ExtensionPoint
Describable extension point for an AI agent implementation.
Implementations must define:
getId()— stable identifiergetDefaultApiKeyEnvVar()— env var for the API keybuildDefaultCommand(io.jenkins.plugins.aiagentjob.AiAgentConfiguration, java.lang.String)— CLI command to launch the agentgetLogFormat()— parser for the agent's JSONL outputgetStatsExtractor()— usage stats extractor for the agent's JSONL output
Implementations may optionally override prepareExecution(io.jenkins.plugins.aiagentjob.AiAgentConfiguration, hudson.FilePath, hudson.model.TaskListener) to contribute agent-specific
environment setup/cleanup.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classImmutable settings for an Agent Client Protocol execution.static final classImmutable runtime model and reasoning-effort selection.Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns an ACP server command for a bidirectional approval channel, ornullwhen manual approvals are unsupported.buildDefaultCommand(AiAgentConfiguration config, String prompt) abstract StringDefault API-key environment variable, or empty when the agent uses node-level auth.abstract StringgetId()Stable identifier for this agent implementation.abstract AiAgentLogFormatReturns the log format parser for this agent's JSONL output.abstract AiAgentStatsExtractorReturns the stats extractor for this agent's JSONL output.Reasoning efforts recognized when appended to a model identifier.prepareExecution(AiAgentConfiguration config, FilePath workspace, TaskListener listener) intresolveExitCode(int processExitCode, File rawLogFile) Maps process exit status after complete output has been persisted.resolveModelSelection(String configuredModel, String configuredReasoningEffort) Resolves the model and optionalmodel:effortshorthand for this handler.booleanWhether this handler provides a bidirectional Jenkins approval channel.voidRejects unsupported execution settings before any process or temporary file is created.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface hudson.model.Describable
getDescriptor
-
Constructor Details
-
AiAgentTypeHandler
public AiAgentTypeHandler()
-
-
Method Details
-
getId
Stable identifier for this agent implementation. -
getDefaultApiKeyEnvVar
Default API-key environment variable, or empty when the agent uses node-level auth. -
validateExecution
Rejects unsupported execution settings before any process or temporary file is created. -
supportsManualApprovals
public boolean supportsManualApprovals()Whether this handler provides a bidirectional Jenkins approval channel. -
getSupportedReasoningEfforts
Reasoning efforts recognized when appended to a model identifier. -
resolveModelSelection
public final AiAgentTypeHandler.ModelSelection resolveModelSelection(String configuredModel, String configuredReasoningEffort) Resolves the model and optionalmodel:effortshorthand for this handler. -
buildDefaultCommand
-
buildAcpExecution
Returns an ACP server command for a bidirectional approval channel, ornullwhen manual approvals are unsupported. -
prepareExecution
public AiAgentExecutionCustomization prepareExecution(AiAgentConfiguration config, FilePath workspace, TaskListener listener) throws IOException, InterruptedException - Throws:
IOExceptionInterruptedException
-
resolveExitCode
Maps process exit status after complete output has been persisted. Agents that report terminal failures while exiting zero can override this method.- Throws:
IOException
-
getLogFormat
Returns the log format parser for this agent's JSONL output.The returned format's
AiAgentLogFormat.classify(long, net.sf.json.JSONObject)method should returnnullfor any JSON it does not recognise, so the parser can fall through to the shared format and generic fallback. -
getStatsExtractor
Returns the stats extractor for this agent's JSONL output.The returned extractor's
AiAgentStatsExtractor.extract(net.sf.json.JSONObject, io.jenkins.plugins.aiagentjob.AgentUsageStats)method should returnfalsefor any JSON it does not recognise, so the shared extractor handles it as a fallback.
-