Skip to Content
Enthusiast 1.6.0 is released 🎉

Agent Types

Enthusiast provides a flexible and extensible agent system built on abstract base classes that define the core architecture and capabilities. The system supports multiple agent types, each designed for different use cases and reasoning strategies.

Overview

The agent system in Enthusiast is built on a foundation of abstract base classes that provide:

  • Standardized Interface: Common methods and properties all agents must implement
  • Configuration Management: Runtime configuration through structured schemas
  • Tool Integration: Seamless integration with the tool system
  • Memory Management: Built-in conversation memory and context management
  • Extensibility: Easy creation of custom agent types

Base Agent

Core Components

Every agent in Enthusiast consists of:

  • Language Model: The underlying LLM for reasoning and text generation
  • Tools: Collection of tools the agent can use
  • Prompt Template: Instructions and context for the agent
  • Injector: Access to external resources and services
  • Callback Handlers(Optional): Handling LLM and agent events

Core Interface

The BaseAgent class defines the fundamental interface all agents must implement:

Required Class Variables

The ExtraArgsClassBaseMeta metaclass enforces that all agent implementations define:

AGENT_ARGS (RequiredFieldsModel)

Configuration schema for agent-specific parameters:

class AgentConfiguration(RequiredFieldsModel): max_iterations: int = Field(title="Max Iterations", description="Maximum reasoning steps", default=10) enable_debugging: bool = Field(title="Enable Debugging", description="Enable detailed logging", default=False) class ExampleAgent(BaseAgent): AGENT_ARGS = AgentConfiguration

PROMPT_INPUT (RequiredFieldsModel)

Schema for prompt input variables:

class PromptInputSchema(RequiredFieldsModel): product_type: str = Field(title="Product type", description="Product type agent with work with") context: str = Field(title="Context", description="Additional context information") output_format: str = Field(title="Output Format", description="Expected response format") class ExampleAgent(BaseAgent): PROMPT_INPUT = PromptInputSchema

PROMPT_EXTENSION (RequiredFieldsModel)

Schema for prompt extension variables:

class PromptExtensionSchema(RequiredFieldsModel): system_instructions: str = Field(title="System Instructions", description="Agent behavior instructions") restrictions: str = Field(title="Restriction instructions", description="Restricted agent behaviours") class ExampleAgent(BaseAgent): PROMPT_EXTENSION = PromptExtensionSchema

TOOLS (list[BaseTool])

List of tools configurations:

class ExampleAgent(BaseAgent): TOOLS = [ LLMToolConfig(tools_class=ExampleTool), LLMToolConfig(tools_class=ExampleTool), ]

Those arguments can be accessed by agent like this:

def get_answer(self, input_text: str) -> str: agent_output = self._agent_executor.invoke( {"input": input_text, "product_type": self.PROMPT_INPUT.product_type} ) return agent_output["output"]

Tool Calling Agent

Overview

The BaseToolCallingAgent implements the standard tool calling pattern, leveraging native function calling support built into all modern LLMs. It is the recommended base class for all custom agents.

Implementation

class BaseToolCallingAgent(BaseAgent): def get_answer(self, input_text: str) -> str: # Build and execute the agent agent_executor = self._build_agent_executor() response = agent_executor.invoke( {"input": input_text}, config=self._build_invoke_config() ) return response["output"] def _build_tools(self) -> list[BaseTool]: """Convert internal tools to LangChain tools""" return [tool.as_tool() for tool in self._tools] def _build_memory(self) -> BaseMemory: """Use limited memory for ReAct reasoning""" return self._injector.chat_limited_memory def _build_invoke_config(self) -> dict[str, Any]: """Configure callback handlers""" if self._callback_handler: return {"callbacks": [self._callback_handler]} return {} def _build_agent_executor(self) -> AgentExecutor: """Create the LangChain agent executor""" tools = self._build_tools() agent = create_tool_calling_agent( tools=tools, llm=self._llm, prompt=self._prompt, ) return AgentExecutor( agent=agent, tools=tools, verbose=True, memory=self._build_memory(), return_intermediate_steps=True )

Summary

The Enthusiast agent system provides a robust foundation for building intelligent, tool-using agents:

  • BaseAgent: Abstract base class with required interface and validation
  • BaseToolCallingAgent: Standard implementation using native LLM tool calling

By following the established patterns and implementing the required interfaces, developers can create powerful, specialized agents that leverage the full capabilities of the Enthusiast framework.

Last updated on