Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 143 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
# Hermes-Function-Calling Specialist Agents for Langchain Integration

## Overview
This document outlines the specialist agents required for implementing a full Langchain integration with the Hermes-Function-Calling framework. The integration will extend the existing function calling capabilities to leverage Langchain's powerful abstractions for tools, chains, and agents.

## Technology Stack Analysis

### Core Technologies
- **Python 3.8+**: Primary development language
- **Langchain**: Framework for developing applications powered by LLMs
- **Transformers**: HuggingFace library for LLM integration
- **Pydantic**: Data validation and settings management

### Key Dependencies
- `langchain`: Core Langchain library
- `langchain-core`: Core primitives for Langchain
- `transformers`: HuggingFace Transformers
- `pydantic`: Data validation
- `yfinance`: Yahoo Finance data (existing dependency)

## Specialist Agents Required

### 1. Core Framework Development Team

#### **Langchain Integration Specialist**
- **Focus**: Integrating Langchain tools and agents with Hermes function calling
- **Skills**: Langchain framework, Python, function calling patterns
- **Responsibilities**:
- Implement Langchain tool adapters for existing Hermes functions
- Create Langchain-compatible agent for Hermes function calling
- Ensure compatibility between Langchain and Hermes execution loops
- Implement proper error handling and validation

#### **Tool Wrapper Engineer**
- **Focus**: Converting existing functions to Langchain-compatible tools
- **Skills**: Langchain tools, Python decorators, function wrapping
- **Responsibilities**:
- Wrap existing functions in `functions.py` with Langchain `@tool` decorator
- Ensure proper schema generation for all wrapped tools
- Implement tool validation and error handling
- Create new tools using Langchain patterns

### 2. Infrastructure & DevOps Team

#### **Integration Testing Engineer**
- **Focus**: Testing the integration between Hermes and Langchain
- **Skills**: Testing frameworks, CI/CD, Langchain
- **Responsibilities**:
- Create integration tests for Langchain-Hermes interaction
- Validate tool calling and execution across both frameworks
- Implement regression tests for existing functionality
- Performance testing of integrated system

### 3. Data & Evaluation Team

#### **Evaluation Metrics Specialist**
- **Focus**: Measuring the effectiveness of Langchain integration
- **Skills**: Performance metrics, evaluation methodology
- **Responsibilities**:
- Define metrics for comparing Hermes-native vs Langchain-integrated function calling
- Implement evaluation suite for tool calling accuracy
- Benchmark performance differences
- Document best practices for Langchain integration

### 4. Quality Assurance & Testing Team

#### **Compatibility Testing Specialist**
- **Focus**: Ensuring backward compatibility and smooth integration
- **Skills**: Testing, compatibility analysis, regression testing
- **Responsibilities**:
- Verify that existing Hermes functionality remains intact
- Test Langchain tools with Hermes execution loop
- Validate schema generation and parsing for Langchain tools
- Identify and resolve compatibility issues

## Development Workflow

### Phase 1: Tool Integration
1. **Tool Wrapping**: Convert existing functions to Langchain-compatible tools
2. **Schema Generation**: Ensure proper OpenAPI schema generation for all tools
3. **Validation**: Implement validation for tool parameters and return values
4. **Testing**: Validate individual tools work correctly

### Phase 2: Agent Integration
1. **Agent Creation**: Implement Langchain agent that can use Hermes functions
2. **Execution Loop**: Adapt Hermes execution loop to work with Langchain agents
3. **Error Handling**: Implement comprehensive error handling
4. **Testing**: Validate agent can successfully call and execute tools

### Phase 3: Integration Testing
1. **Compatibility Testing**: Ensure existing functionality remains intact
2. **Performance Testing**: Measure performance impact of integration
3. **Regression Testing**: Verify no existing functionality is broken
4. **Documentation**: Create documentation for using Langchain integration

## Key Integration Points

### 1. Tool Registration
- Existing `@tool` decorated functions in `functions.py` should be compatible with Langchain
- Need to ensure `convert_to_openai_tool()` works correctly with all functions
- Implement any necessary adapters for functions that don't conform to Langchain patterns

### 2. Schema Generation
- Use Langchain's built-in schema generation capabilities
- Ensure schemas are compatible with Hermes prompt formatting
- Validate that all required fields are properly included

### 3. Execution Loop
- Adapt `functioncall.py` execution loop to work with Langchain agents
- Ensure tool results are properly formatted for both frameworks
- Implement proper error propagation between frameworks

### 4. Prompt Management
- Integrate Langchain's prompt templating with Hermes' existing prompter
- Ensure system prompts properly describe Langchain tools
- Maintain compatibility with existing prompt formats

## Performance Considerations

- **Latency**: Minimize additional overhead from Langchain integration
- **Memory**: Efficient handling of Langchain objects and data structures
- **Concurrency**: Ensure thread-safety when using Langchain components
- **Scalability**: Design for horizontal scaling of integrated system

## Security Requirements

- **Input Validation**: Proper validation of all tool parameters
- **Output Sanitization**: Sanitize tool outputs before returning to model
- **Access Control**: Ensure proper access controls for sensitive functions
- **Error Handling**: Prevent information leakage through error messages

## Verification & Validation Protocols

### **Integration Verification Specialist**
- **Focus**: Ensuring proper integration between Hermes and Langchain
- **Skills**: Integration testing, validation protocols
- **Responsibilities**:
- Implement verification protocols for all integration points
- Define acceptance criteria for successful integration
- Conduct final validation before release
- Maintain integration quality standards

This framework provides a structured approach to implementing Langchain integration with Hermes-Function-Calling, ensuring a robust, maintainable, and performant solution.
Loading