Class DefaultSubAgent

java.lang.Object
ai.tabforge.workshop.agent.SubAgent
ai.tabforge.workshop.agents.DefaultSubAgent
Direct Known Subclasses:
ArchitectureCheckerAgent, PerformanceAnalystAgent, SecurityAuditorAgent, TransactionAnalystAgent

public abstract class DefaultSubAgent extends SubAgent
Base class for all agents. Each agent will have the same analyzeFile() method. This class exists just for that.
  • Constructor Details

    • DefaultSubAgent

      protected DefaultSubAgent(ProgressReporter orchestrator, com.anthropic.client.AnthropicClient client)
      Parameters:
      orchestrator -
      client - : AnthropicClient is thread-safe — a single instance can be shared between all agents. That's why OrchestratorAgent makes one instance and injects it everywhere. There is no need to create a new client for each agent.
  • Method Details

    • analyzeFile

      protected AgentResult analyzeFile(String prompt, String fileContent, int maxOutputTokens)
      What is MessageCreateParams: It is a builder that builds the HTTP request body. Everything you put in the builder goes into JSON that is sent to the API:
      
      { 
      "model": "claude-haiku-4-5-...", 
      "max_tokens": 4096, 
      "system": "You are a security auditor...", 
      "messages": [{ "role": "user", "content": "...Java code..." }] 
      }
      
      Specified by:
      analyzeFile in class SubAgent
      Parameters:
      prompt -
      fileContent -
      Returns: