helios-engine 0.5.5

A powerful and flexible Rust framework for building LLM-powered agents with tool support, both locally and online
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
# Contributing to Helios Engine

Thank you for your interest in contributing to Helios Engine! This document provides guidelines and information for contributors.

## ๐Ÿš€ Quick Start for Contributors

### Development Setup

1. **Clone the repository:**
   ```bash
   git clone https://github.com/Ammar-Alnagar/Helios-Engine.git
   cd Helios-Engine
   ```

2. **Build the project:**
   ```bash
   cargo build
   ```

3. **Run tests:**
   ```bash
   cargo test
   ```

4. **Format code:**
   ```bash
   cargo fmt
   ```

5. **Check for issues:**
   ```bash
   cargo clippy
   ```

### First Contribution

1. Fork the repository on GitHub
2. Create a feature branch: `git checkout -b feature/your-feature-name`
3. Make your changes
4. Run tests: `cargo test`
5. Format code: `cargo fmt`
6. Check for issues: `cargo clippy`
7. Commit your changes: `git commit -m "Add your feature"`
8. Push to your fork: `git push origin feature/your-feature-name`
9. Create a Pull Request

## ๐Ÿ—๏ธ Development Workflow

### Branching Strategy

- `main`: Production-ready code
- `develop`: Integration branch for features
- `feature/*`: New features
- `bugfix/*`: Bug fixes
- `hotfix/*`: Critical fixes for production

### Commit Messages

Follow conventional commit format:

```
type(scope): description

[optional body]

[optional footer]
```

Types:
- `feat`: New features
- `fix`: Bug fixes
- `docs`: Documentation changes
- `style`: Code style changes
- `refactor`: Code refactoring
- `test`: Test additions/modifications
- `chore`: Maintenance tasks

Examples:
```
feat(agent): add memory persistence to agent sessions

fix(tools): resolve memory leak in CalculatorTool

docs(readme): update installation instructions
```

### Pull Request Process

1. **Create PR**: Use descriptive titles and detailed descriptions
2. **Code Review**: Address reviewer feedback
3. **Tests**: Ensure all tests pass and add new tests if needed
4. **Documentation**: Update docs for any user-facing changes
5. **Merge**: Squash merge with clean commit message

## ๐Ÿงช Testing

### Running Tests

```bash
# Run all tests
cargo test

# Run specific test
cargo test test_name

# Run tests with logging
RUST_LOG=debug cargo test

# Run integration tests
cargo test --test integration_tests

# Run tests with coverage (requires tarpaulin)
cargo tarpaulin --out Html
```

### Writing Tests

#### Unit Tests

```rust
#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_calculator_addition() {
        let tool = CalculatorTool;
        let args = serde_json::json!({
            "expression": "2 + 2"
        });

        let result = tokio_test::block_on(tool.execute(args)).unwrap();
        assert_eq!(result.content, "4");
    }
}
```

#### Integration Tests

Add to `tests/` directory:

```rust
// tests/agent_integration.rs
use helios_engine::{Agent, Config};

#[tokio::test]
async fn test_agent_with_tools() {
    let config = Config::from_file("config.test.toml").unwrap();
    let mut agent = Agent::builder("TestAgent")
        .config(config)
        .tool(Box::new(CalculatorTool))
        .build()
        .await
        .unwrap();

    let response = agent.chat("What is 10 + 5?").await.unwrap();
    assert!(response.contains("15"));
}
```

### Test Configuration

Create `config.test.toml` for testing:

```toml
[llm]
model_name = "gpt-3.5-turbo"
base_url = "https://api.openai.com/v1"
api_key = "test-key"
temperature = 0.0  # Deterministic for testing
max_tokens = 100
```

## ๐Ÿ“š Documentation

### Documentation Standards

- Use Markdown for all documentation
- Include code examples where relevant
- Provide both conceptual and practical information
- Keep documentation up-to-date with code changes
- Use clear, concise language accessible to different experience levels

### Updating Documentation

1. **API Documentation**: Update `docs/API.md` for any public API changes
2. **Guides**: Update relevant guides in `docs/` directory
3. **Examples**: Add examples to `examples/` directory
4. **README**: Update main README.md for major changes

### Documentation Checklist

- [ ] Public API changes documented
- [ ] Breaking changes clearly marked
- [ ] Code examples tested and working
- [ ] Cross-references updated
- [ ] Table of contents accurate

## ๐Ÿ› ๏ธ Code Quality

### Formatting

```bash
# Format all code
cargo fmt

# Check formatting without changing files
cargo fmt --check
```

### Linting

```bash
# Run clippy linter
cargo clippy

# Fix auto-fixable issues
cargo clippy --fix
```

### Code Standards

- Follow Rust naming conventions
- Use meaningful variable and function names
- Add documentation comments for public APIs
- Handle errors gracefully
- Write comprehensive tests

### Performance Guidelines

- Minimize allocations in hot paths
- Use async/await appropriately
- Consider memory usage for large data structures
- Profile performance-critical code
- Use appropriate data structures

## ๐Ÿ”ง Tool Development

### Adding New Tools

1. **Implement the Tool trait:**
   ```rust
   use async_trait::async_trait;
   use helios_engine::{Tool, ToolParameter, ToolResult};

   struct MyTool;

   #[async_trait]
   impl Tool for MyTool {
       fn name(&self) -> &str { "my_tool" }

       fn description(&self) -> &str {
           "Description of what my tool does"
       }

       fn parameters(&self) -> HashMap<String, ToolParameter> {
           // Define tool parameters
       }

       async fn execute(&self, args: Value) -> Result<ToolResult> {
           // Implement tool logic
       }
   }
   ```

2. **Add to tool registry** in `tools.rs`

3. **Write comprehensive tests**

4. **Update documentation** in `docs/TOOLS.md`

### Tool Best Practices

- Validate all inputs
- Handle errors gracefully
- Provide meaningful error messages
- Document parameter formats
- Consider security implications
- Test edge cases thoroughly

## ๐Ÿ›๏ธ Architecture Guidelines

### Module Organization

- `agent.rs`: Agent implementation and builder pattern
- `chat.rs`: Chat messages and session management
- `config.rs`: Configuration loading and validation
- `error.rs`: Error types and handling
- `llm.rs`: LLM client and provider implementations
- `tools.rs`: Tool registry and implementations
- `serve.rs`: HTTP server for API endpoints

### Design Principles

- **Separation of Concerns**: Each module has a single responsibility
- **Dependency Injection**: Use constructor injection for dependencies
- **Error Handling**: Use `Result<T, Error>` consistently
- **Async/Await**: Use async/await for I/O operations
- **Type Safety**: Leverage Rust's type system

### API Design

- Use builder patterns for complex construction
- Provide sensible defaults
- Make APIs hard to misuse
- Document preconditions and postconditions
- Version APIs appropriately

## ๐Ÿ”’ Security

### Security Checklist

- [ ] Input validation on all user inputs
- [ ] No hardcoded secrets or credentials
- [ ] Safe handling of file paths
- [ ] Proper error message sanitization
- [ ] No sensitive data in logs
- [ ] Secure default configurations

### Reporting Security Issues

- **DO NOT** create public GitHub issues for security vulnerabilities
- Email security concerns to: [security email or maintainer contact]
- Provide detailed reproduction steps
- Allow time for fixes before public disclosure

## ๐Ÿš€ Release Process

### Version Numbering

Follow [Semantic Versioning](https://semver.org/):

- **MAJOR**: Breaking changes
- **MINOR**: New features (backward compatible)
- **PATCH**: Bug fixes (backward compatible)

### Release Checklist

- [ ] Update version in `Cargo.toml`
- [ ] Update changelog
- [ ] Run full test suite
- [ ] Update documentation
- [ ] Create git tag
- [ ] Publish to crates.io
- [ ] Create GitHub release

### Publishing to Crates.io

```bash
# Update version
cargo release [patch|minor|major]

# Or manually:
cargo test
cargo publish
```

## ๐Ÿ“ž Communication

### Discussion Channels

- **GitHub Issues**: Bug reports and feature requests
- **GitHub Discussions**: General questions and discussions
- **Pull Request Comments**: Code review discussions

### Getting Help

- Check existing issues and documentation first
- Use clear, descriptive issue titles
- Provide minimal reproduction cases
- Include relevant version information

## ๐ŸŽฏ Areas for Contribution

### High Priority

- [ ] Performance optimizations
- [ ] Additional LLM provider support
- [ ] More built-in tools
- [ ] Improved error messages
- [ ] Better documentation

### Medium Priority

- [ ] Web UI interface
- [ ] Plugin system for tools
- [ ] Advanced RAG features
- [ ] Multi-modal support
- [ ] Integration with popular frameworks

### Future Ideas

- [ ] Mobile SDKs
- [ ] Desktop applications
- [ ] Cloud deployment templates
- [ ] Advanced orchestration features

## ๐Ÿ“‹ Code of Conduct

### Our Standards

- Be respectful and inclusive
- Focus on constructive feedback
- Help newcomers learn
- Maintain professional communication
- Respect differing viewpoints

### Enforcement

Violations of the code of conduct may result in:
- Warning
- Temporary ban
- Permanent ban from the project

## ๐Ÿ™ Recognition

Contributors are recognized through:
- GitHub contributor statistics
- Mention in release notes
- Attribution in documentation
- Community recognition

Thank you for contributing to Helios Engine! ๐ŸŽ‰