You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: add-new-tool.md
+13-11Lines changed: 13 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
-
# Guide to Adding New Tools in MxToAi
1
+
# Guide to Adding New Tools in MXGo
2
2
3
-
This guide outlines the process for adding new tools to the MxToAi email assistant. It covers architecture considerations, database integration, testing approaches, and best practices based on real implementation experience.
3
+
This guide outlines the process for adding new tools to the MXGo email assistant. It covers architecture considerations, database integration, testing approaches, and best practices based on real implementation experience.
4
4
5
5
## 1. Tool Architecture Overview
6
6
7
-
MxToAi uses the `smolagents` framework for tool implementation, allowing the AI agent to access specialized functionality. Each tool should:
7
+
MXGo uses the `smolagents` framework for tool implementation, allowing the AI agent to access specialized functionality. Each tool should:
8
8
9
9
- Have a clear, single responsibility
10
10
- Be properly integrated with the agent's capabilities
@@ -54,16 +54,17 @@ For tools that interact with the database:
54
54
- Use the `DbConnection` class for database access
55
55
56
56
```python
57
-
frommxtoai.db import init_db_connection
57
+
frommxgo.db import init_db_connection
58
58
59
59
# Initialize at module level for reuse
60
60
db_connection = init_db_connection()
61
61
62
+
62
63
# In your tool:
63
64
defforward(self, ...):
64
65
with db_connection.get_session() as session:
65
-
# Perform database operations
66
-
# ...
66
+
# Perform database operations
67
+
# ...
67
68
```
68
69
69
70
### 2.2 Handling Data Models
@@ -78,7 +79,7 @@ When working with database models:
78
79
# Example of a hybrid approach
79
80
try:
80
81
# Try ORM approach first (good for testing)
81
-
frommxtoai.models import YourModel
82
+
frommxgo.models import YourModel
82
83
83
84
model = YourModel(...)
84
85
session.add(model)
@@ -120,10 +121,11 @@ class ToolInput(BaseModel):
120
121
Implement robust error handling:
121
122
122
123
```python
123
-
frommxtoai.utils import get_logger
124
+
frommxgo.utils import get_logger
124
125
125
126
logger = get_logger(__name__)
126
127
128
+
127
129
defforward(self, ...):
128
130
try:
129
131
# Implementation
@@ -222,7 +224,7 @@ Ensure your tool integrates properly with the email agent:
222
224
223
225
### 7.1 Code Organization
224
226
225
-
- Keep tool implementation in its own module in the `mxtoai/tools/` directory
227
+
- Keep tool implementation in its own module in the `mxgo/tools/` directory
226
228
- Use clear, descriptive names for classes and methods
227
229
- Document public APIs thoroughly with docstrings
228
230
@@ -250,7 +252,7 @@ Ensure your tool integrates properly with the email agent:
250
252
251
253
Here's a simplified version of adding a scheduled tasks tool:
252
254
253
-
1.**Create the tool file** at `mxtoai/tools/scheduled_tasks_tool.py`
255
+
1.**Create the tool file** at `mxgo/tools/scheduled_tasks_tool.py`
254
256
2.**Implement the tool class** with necessary functionality:
255
257
- Input validation
256
258
- Database operations
@@ -273,7 +275,7 @@ Here's a simplified version of adding a scheduled tasks tool:
273
275
274
276
## 10. Conclusion
275
277
276
-
Adding new tools to MxToAi requires careful planning, implementation, and testing. Following these guidelines will help ensure that your tool integrates smoothly with the existing system and provides reliable functionality.
278
+
Adding new tools to MXGo requires careful planning, implementation, and testing. Following these guidelines will help ensure that your tool integrates smoothly with the existing system and provides reliable functionality.
0 commit comments