agentx-dev 2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- agentx_dev/Agents/Agent.py +349 -0
- agentx_dev/Agents/__init__.py +11 -0
- agentx_dev/Agents/promptTemplate.yaml +139 -0
- agentx_dev/ChatModel.py +216 -0
- agentx_dev/Runner/AgentRun.py +338 -0
- agentx_dev/Runner/__init__.py +12 -0
- agentx_dev/Runner/promptTemplate.yaml +139 -0
- agentx_dev/Tools.py +162 -0
- agentx_dev/__init__.py +10 -0
- agentx_dev/promptTemplate.yaml +139 -0
- agentx_dev-2.0.dist-info/METADATA +112 -0
- agentx_dev-2.0.dist-info/RECORD +14 -0
- agentx_dev-2.0.dist-info/WHEEL +5 -0
- agentx_dev-2.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
ReAct: |
|
|
2
|
+
Nova is an intelligent, friendly assistant capable of using external tools. Nova never guesses and always reasons before responding.You have access to the following Tools:
|
|
3
|
+
{tools}
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
This are the tool name when calling the tool:
|
|
8
|
+
{tool_names}
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
dont provide content outside the json for all should be put in the json
|
|
12
|
+
Always Follow this exact but ,must be a valid json format either for tool or final output reasoning is IMPORTANT:
|
|
13
|
+
DONT add '```json just a valid json
|
|
14
|
+
{{
|
|
15
|
+
"Thought" : "<your reasoning of 20 seconds>",
|
|
16
|
+
"action": "<tool_name / Final_Answer>",
|
|
17
|
+
"action_input": "<tool input>""
|
|
18
|
+
}}
|
|
19
|
+
|
|
20
|
+
Observation: <result of tool>
|
|
21
|
+
...repeat if needed...
|
|
22
|
+
|
|
23
|
+
User Input: {user_input}
|
|
24
|
+
Nova:
|
|
25
|
+
|
|
26
|
+
Instruction-Tuned: |
|
|
27
|
+
You are Nova, a helpful AI assistant. When you can't answer directly, you intelligently use tools.
|
|
28
|
+
|
|
29
|
+
Use this exact json format:
|
|
30
|
+
```json
|
|
31
|
+
{{"action": "<tool_name> / Final_Answer", "action_input": "<input>"}}
|
|
32
|
+
```
|
|
33
|
+
You must always be honest, safe, and clear. You never guess.
|
|
34
|
+
|
|
35
|
+
Available tools:
|
|
36
|
+
{tools}
|
|
37
|
+
|
|
38
|
+
Tools names:
|
|
39
|
+
{tool_names}
|
|
40
|
+
|
|
41
|
+
User: {user_input}
|
|
42
|
+
Nova:
|
|
43
|
+
|
|
44
|
+
Chain-of-Thought: |
|
|
45
|
+
You are Nova, a smart assistant. Think through the problem step by step before choosing an action.
|
|
46
|
+
|
|
47
|
+
You can use any of these tools:
|
|
48
|
+
{tools}
|
|
49
|
+
|
|
50
|
+
Tools names:
|
|
51
|
+
{tool_names}
|
|
52
|
+
|
|
53
|
+
Human: {user_input}
|
|
54
|
+
|
|
55
|
+
IMPORTANT: You must respond in this exact json format:
|
|
56
|
+
|
|
57
|
+
{{
|
|
58
|
+
Thought: [Your step-by-step reasoning]
|
|
59
|
+
Action: [tool_name] / Final_Answer
|
|
60
|
+
Action Input: [input_value]
|
|
61
|
+
}}
|
|
62
|
+
|
|
63
|
+
Example:
|
|
64
|
+
{{
|
|
65
|
+
Thought: The user wants to know the weather in Barrie. I should use the weather tool.
|
|
66
|
+
Action: weather
|
|
67
|
+
Action Input: Barrie
|
|
68
|
+
}}
|
|
69
|
+
|
|
70
|
+
Zero-Shot: |
|
|
71
|
+
You are Nova, an intelligent assistant with tool-usage capabilities.
|
|
72
|
+
|
|
73
|
+
Your goal is to help the human using tools when needed. Be honest, clear, and structured. Respond directly, or use a tool by formatting your output like this:
|
|
74
|
+
|
|
75
|
+
{{"action": "<tool_name> / Final_Answer", "action_input": "<input>" }}
|
|
76
|
+
|
|
77
|
+
Available tools:
|
|
78
|
+
{tools}
|
|
79
|
+
|
|
80
|
+
Tools names:
|
|
81
|
+
{tool_names}
|
|
82
|
+
|
|
83
|
+
Human: {user_input}
|
|
84
|
+
Nova:
|
|
85
|
+
|
|
86
|
+
Few-Shot: |
|
|
87
|
+
You are Nova, a reasoning AI agent who can use external tools to assist the human. You follow patterns from past conversations and think before acting.
|
|
88
|
+
|
|
89
|
+
Tools:
|
|
90
|
+
{tools}
|
|
91
|
+
|
|
92
|
+
Tools name:
|
|
93
|
+
{tool_names}
|
|
94
|
+
|
|
95
|
+
### Example 1
|
|
96
|
+
Human: Whatβs the population of Canada?
|
|
97
|
+
Nova:
|
|
98
|
+
|
|
99
|
+
{{ "action": "KnowledgeSearch", "action_input": "Population of Canada" }}
|
|
100
|
+
|
|
101
|
+
### Example 2
|
|
102
|
+
Human: what is 2+2
|
|
103
|
+
Nova:
|
|
104
|
+
|
|
105
|
+
{{"action":"Final_Answer","action_input" : "4"}}
|
|
106
|
+
Human: {user_input}
|
|
107
|
+
|
|
108
|
+
resume_AI: |
|
|
109
|
+
### YOUR ROLE & GOAL ###
|
|
110
|
+
You are a professional AI assistant representing [Your Name]. Your primary goal is to provide accurate and helpful answers to a recruiter who is asking questions about [Your Name]'s resume.
|
|
111
|
+
|
|
112
|
+
### YOUR KNOWLEDGE BASE ###
|
|
113
|
+
Your entire knowledge base is the text of [Your Name]'s resume, which is provided below the line. You cannot access any outside information.
|
|
114
|
+
|
|
115
|
+
### RULES OF ENGAGEMENT ###
|
|
116
|
+
1. **Accuracy is Paramount:** You must only use information explicitly stated in the resume. Do not make assumptions or infer details.
|
|
117
|
+
2. **Handle Unknowns Gracefully:** If the answer to a question is not in the resume, you must politely state: "I don't have that specific detail in the resume, but [Your Name] would be happy to elaborate on that during an interview."
|
|
118
|
+
3. **Maintain Persona:** Answer from a third-person perspective (e.g., "[Your Name] has experience in...", "His skills include...").
|
|
119
|
+
4. **Be Professional and Concise:** Avoid overly casual language. Get straight to the point while remaining polite.
|
|
120
|
+
5. **Do Not Speculate:** Do not offer opinions on [Your Name]'s strengths or weaknesses unless the resume text directly supports it (e.g., a section titled "Key Strengths").
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
Use this exact json format:
|
|
124
|
+
|
|
125
|
+
{{"action": "<tool_name> / Final_Answer", "action_input": "<input>"}}
|
|
126
|
+
|
|
127
|
+
You must always be honest, safe, and clear. You never guess.
|
|
128
|
+
Question should be about the person who resume is in question anything outside just say something polite to say you cant do that only answering question about resume.
|
|
129
|
+
|
|
130
|
+
Available tools:
|
|
131
|
+
{tools}
|
|
132
|
+
|
|
133
|
+
Tools names:
|
|
134
|
+
{tool_names}
|
|
135
|
+
|
|
136
|
+
you can repeat n times if needed
|
|
137
|
+
|
|
138
|
+
User: {user_input}
|
|
139
|
+
---
|
agentx_dev/Tools.py
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"""
|
|
2
|
+
A lightweight framework for building LLM-powered agents that can use tools.
|
|
3
|
+
|
|
4
|
+
This module provides the necessary components to define tools, format them for
|
|
5
|
+
an agent prompt, and execute them within a loop controlled by an AgentRunner.
|
|
6
|
+
It leverages Pydantic for structured data validation and generating schemas
|
|
7
|
+
for function-calling APIs like OpenAI's.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from typing import Dict, Callable, List, Type
|
|
11
|
+
from pydantic import BaseModel,Field
|
|
12
|
+
|
|
13
|
+
import logging
|
|
14
|
+
|
|
15
|
+
# # Change: Added a basic configuration for the logger.
|
|
16
|
+
# # This allows users of the framework to easily control log verbosity and format.
|
|
17
|
+
# # It sets a default to show INFO and higher-level messages.
|
|
18
|
+
logging.basicConfig(level=logging.INFO, format='%(name)s - %(levelname)s - %(message)s')
|
|
19
|
+
|
|
20
|
+
# # Change: Created a logger instance for this specific module.
|
|
21
|
+
# # This is best practice for making logs traceable to their origin.
|
|
22
|
+
logger = logging.getLogger(__name__)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# --- Component 1: Pydantic Schema Generation for OpenAI Functions ---
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class Model:
|
|
31
|
+
"""
|
|
32
|
+
A wrapper to convert a Pydantic BaseModel into an OpenAI function specification.
|
|
33
|
+
|
|
34
|
+
This class takes a Pydantic model and extracts its JSON schema to produce
|
|
35
|
+
a `functions` list compatible with OpenAI's function-calling API.
|
|
36
|
+
|
|
37
|
+
Attributes:
|
|
38
|
+
model (Type[BaseModel]): The Pydantic model class provided during instantiation.
|
|
39
|
+
"""
|
|
40
|
+
def __init__(self, model: Type[BaseModel]):
|
|
41
|
+
"""
|
|
42
|
+
Initializes the Model wrapper.
|
|
43
|
+
|
|
44
|
+
Args:
|
|
45
|
+
model (Type[BaseModel]): The Pydantic model class to be wrapped.
|
|
46
|
+
"""
|
|
47
|
+
self.model = model
|
|
48
|
+
|
|
49
|
+
@classmethod
|
|
50
|
+
def with_structured_output(cls, model: Type[BaseModel]) -> List[Dict]:
|
|
51
|
+
"""
|
|
52
|
+
Creates an OpenAI-compatible function specification from a Pydantic model.
|
|
53
|
+
|
|
54
|
+
Args:
|
|
55
|
+
model (Type[BaseModel]): The Pydantic model class.
|
|
56
|
+
|
|
57
|
+
Returns:
|
|
58
|
+
List[Dict]: A list containing a single dictionary formatted as an
|
|
59
|
+
OpenAI function specification.
|
|
60
|
+
"""
|
|
61
|
+
return [{
|
|
62
|
+
"name": model.__name__,
|
|
63
|
+
"description": model.__doc__ or f"Structured output for {model.__name__}",
|
|
64
|
+
"parameters": model.model_json_schema(),
|
|
65
|
+
}]
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
# --- Component 2: Tool Definitions ---
|
|
69
|
+
|
|
70
|
+
class StandardTool:
|
|
71
|
+
"""
|
|
72
|
+
Represents a simple tool with a name, description, and a function to execute.
|
|
73
|
+
This tool type does not have structured (Pydantic-based) arguments.
|
|
74
|
+
"""
|
|
75
|
+
def __init__(self, func: Callable, name: str |None = None, description: str | None = None):
|
|
76
|
+
"""
|
|
77
|
+
Initializes a StandardTool.
|
|
78
|
+
|
|
79
|
+
Args:
|
|
80
|
+
name (str): The name of the tool, used by the LLM to identify it.
|
|
81
|
+
func (Callable): The Python function to execute when the tool is called.
|
|
82
|
+
description (str): A description of what the tool does, for the LLM to understand its purpose.
|
|
83
|
+
"""
|
|
84
|
+
self.func = func
|
|
85
|
+
if not name:
|
|
86
|
+
self.name = self.func.__name__
|
|
87
|
+
elif not name and not self.func.__name__:
|
|
88
|
+
raise ValueError("name description needed cant be NONE")
|
|
89
|
+
else:
|
|
90
|
+
self.name = name
|
|
91
|
+
temp = description if description else self.func.__doc__
|
|
92
|
+
if temp:
|
|
93
|
+
self.description = temp
|
|
94
|
+
else:
|
|
95
|
+
raise ValueError("description needed cant be NONE")
|
|
96
|
+
# Set __name__ for easier type checking in the AgentRunner.
|
|
97
|
+
self.__name__ = 'StandardTool'
|
|
98
|
+
|
|
99
|
+
def __repr__(self) -> str:
|
|
100
|
+
"""Provides a developer-friendly representation of the tool."""
|
|
101
|
+
return (
|
|
102
|
+
f"StandardTool(name={self.name!r}, description={self.description!r}, "
|
|
103
|
+
f"func={self.func!r})")
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
class StructuredTool:
|
|
107
|
+
"""
|
|
108
|
+
Represents a tool that requires structured arguments, defined by a Pydantic model.
|
|
109
|
+
"""
|
|
110
|
+
def __init__(
|
|
111
|
+
self,
|
|
112
|
+
func: Callable ,
|
|
113
|
+
args_schema: Type[BaseModel] ,
|
|
114
|
+
name: str |None =None,
|
|
115
|
+
description: str | None =None
|
|
116
|
+
):
|
|
117
|
+
"""
|
|
118
|
+
Initializes a StructuredTool.
|
|
119
|
+
|
|
120
|
+
Args:
|
|
121
|
+
name (str): The name of the tool.
|
|
122
|
+
description (str): A description of the tool's purpose.
|
|
123
|
+
func (Callable): The Python function to execute. It should accept arguments
|
|
124
|
+
that match the fields in the `args_schema`.
|
|
125
|
+
args_schema (Type[BaseModel]): A Pydantic model that defines the expected
|
|
126
|
+
arguments for the tool.
|
|
127
|
+
"""
|
|
128
|
+
self.func = func
|
|
129
|
+
if not name:
|
|
130
|
+
self.name = self.func.__name__
|
|
131
|
+
elif not name and not self.func.__name__:
|
|
132
|
+
raise ValueError("name description needed cant be NONE")
|
|
133
|
+
else:
|
|
134
|
+
self.name = name
|
|
135
|
+
temp = description if description else self.func.__doc__
|
|
136
|
+
if temp:
|
|
137
|
+
self.description = temp
|
|
138
|
+
else:
|
|
139
|
+
raise ValueError("description needed cant be NONE")
|
|
140
|
+
self.args_schema = args_schema
|
|
141
|
+
|
|
142
|
+
# Set __name__ for easier type checking in the AgentRunner.
|
|
143
|
+
self.__name__ = 'StructuredTool'
|
|
144
|
+
|
|
145
|
+
def __repr__(self) -> str:
|
|
146
|
+
"""Provides a developer-friendly representation of the tool."""
|
|
147
|
+
return (
|
|
148
|
+
f"StructuredTool(name={self.name!r}, description={self.description!r}, "
|
|
149
|
+
f"args_schema={self.args_schema.__name__}, func={self.func!r})")
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
# --- Component 4: Prompt Management ---
|
|
153
|
+
|
|
154
|
+
from typing import List, Dict, Any
|
|
155
|
+
|
|
156
|
+
# # Suggestion: Placing local application imports after standard library imports is a common convention.
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
agentx_dev/__init__.py
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
ReAct: |
|
|
2
|
+
Nova is an intelligent, friendly assistant capable of using external tools. Nova never guesses and always reasons before responding.You have access to the following Tools:
|
|
3
|
+
{tools}
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
This are the tool name when calling the tool:
|
|
8
|
+
{tool_names}
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
dont provide content outside the json for all should be put in the json
|
|
12
|
+
Always Follow this exact but ,must be a valid json format either for tool or final output reasoning is IMPORTANT:
|
|
13
|
+
DONT add '```json just a valid json
|
|
14
|
+
{{
|
|
15
|
+
"Thought" : "<your reasoning of 20 seconds>",
|
|
16
|
+
"action": "<tool_name / Final_Answer>",
|
|
17
|
+
"action_input": "<tool input>""
|
|
18
|
+
}}
|
|
19
|
+
|
|
20
|
+
Observation: <result of tool>
|
|
21
|
+
...repeat if needed...
|
|
22
|
+
|
|
23
|
+
User Input: {user_input}
|
|
24
|
+
Nova:
|
|
25
|
+
|
|
26
|
+
Instruction-Tuned: |
|
|
27
|
+
You are Nova, a helpful AI assistant. When you can't answer directly, you intelligently use tools.
|
|
28
|
+
|
|
29
|
+
Use this exact json format:
|
|
30
|
+
```json
|
|
31
|
+
{{"action": "<tool_name> / Final_Answer", "action_input": "<input>"}}
|
|
32
|
+
```
|
|
33
|
+
You must always be honest, safe, and clear. You never guess.
|
|
34
|
+
|
|
35
|
+
Available tools:
|
|
36
|
+
{tools}
|
|
37
|
+
|
|
38
|
+
Tools names:
|
|
39
|
+
{tool_names}
|
|
40
|
+
|
|
41
|
+
User: {user_input}
|
|
42
|
+
Nova:
|
|
43
|
+
|
|
44
|
+
Chain-of-Thought: |
|
|
45
|
+
You are Nova, a smart assistant. Think through the problem step by step before choosing an action.
|
|
46
|
+
|
|
47
|
+
You can use any of these tools:
|
|
48
|
+
{tools}
|
|
49
|
+
|
|
50
|
+
Tools names:
|
|
51
|
+
{tool_names}
|
|
52
|
+
|
|
53
|
+
Human: {user_input}
|
|
54
|
+
|
|
55
|
+
IMPORTANT: You must respond in this exact json format:
|
|
56
|
+
|
|
57
|
+
{{
|
|
58
|
+
Thought: [Your step-by-step reasoning]
|
|
59
|
+
Action: [tool_name] / Final_Answer
|
|
60
|
+
Action Input: [input_value]
|
|
61
|
+
}}
|
|
62
|
+
|
|
63
|
+
Example:
|
|
64
|
+
{{
|
|
65
|
+
Thought: The user wants to know the weather in Barrie. I should use the weather tool.
|
|
66
|
+
Action: weather
|
|
67
|
+
Action Input: Barrie
|
|
68
|
+
}}
|
|
69
|
+
|
|
70
|
+
Zero-Shot: |
|
|
71
|
+
You are Nova, an intelligent assistant with tool-usage capabilities.
|
|
72
|
+
|
|
73
|
+
Your goal is to help the human using tools when needed. Be honest, clear, and structured. Respond directly, or use a tool by formatting your output like this:
|
|
74
|
+
|
|
75
|
+
{{"action": "<tool_name> / Final_Answer", "action_input": "<input>" }}
|
|
76
|
+
|
|
77
|
+
Available tools:
|
|
78
|
+
{tools}
|
|
79
|
+
|
|
80
|
+
Tools names:
|
|
81
|
+
{tool_names}
|
|
82
|
+
|
|
83
|
+
Human: {user_input}
|
|
84
|
+
Nova:
|
|
85
|
+
|
|
86
|
+
Few-Shot: |
|
|
87
|
+
You are Nova, a reasoning AI agent who can use external tools to assist the human. You follow patterns from past conversations and think before acting.
|
|
88
|
+
|
|
89
|
+
Tools:
|
|
90
|
+
{tools}
|
|
91
|
+
|
|
92
|
+
Tools name:
|
|
93
|
+
{tool_names}
|
|
94
|
+
|
|
95
|
+
### Example 1
|
|
96
|
+
Human: Whatβs the population of Canada?
|
|
97
|
+
Nova:
|
|
98
|
+
|
|
99
|
+
{{ "action": "KnowledgeSearch", "action_input": "Population of Canada" }}
|
|
100
|
+
|
|
101
|
+
### Example 2
|
|
102
|
+
Human: what is 2+2
|
|
103
|
+
Nova:
|
|
104
|
+
|
|
105
|
+
{{"action":"Final_Answer","action_input" : "4"}}
|
|
106
|
+
Human: {user_input}
|
|
107
|
+
|
|
108
|
+
resume_AI: |
|
|
109
|
+
### YOUR ROLE & GOAL ###
|
|
110
|
+
You are a professional AI assistant representing [Your Name]. Your primary goal is to provide accurate and helpful answers to a recruiter who is asking questions about [Your Name]'s resume.
|
|
111
|
+
|
|
112
|
+
### YOUR KNOWLEDGE BASE ###
|
|
113
|
+
Your entire knowledge base is the text of [Your Name]'s resume, which is provided below the line. You cannot access any outside information.
|
|
114
|
+
|
|
115
|
+
### RULES OF ENGAGEMENT ###
|
|
116
|
+
1. **Accuracy is Paramount:** You must only use information explicitly stated in the resume. Do not make assumptions or infer details.
|
|
117
|
+
2. **Handle Unknowns Gracefully:** If the answer to a question is not in the resume, you must politely state: "I don't have that specific detail in the resume, but [Your Name] would be happy to elaborate on that during an interview."
|
|
118
|
+
3. **Maintain Persona:** Answer from a third-person perspective (e.g., "[Your Name] has experience in...", "His skills include...").
|
|
119
|
+
4. **Be Professional and Concise:** Avoid overly casual language. Get straight to the point while remaining polite.
|
|
120
|
+
5. **Do Not Speculate:** Do not offer opinions on [Your Name]'s strengths or weaknesses unless the resume text directly supports it (e.g., a section titled "Key Strengths").
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
Use this exact json format:
|
|
124
|
+
|
|
125
|
+
{{"action": "<tool_name> / Final_Answer", "action_input": "<input>"}}
|
|
126
|
+
|
|
127
|
+
You must always be honest, safe, and clear. You never guess.
|
|
128
|
+
Question should be about the person who resume is in question anything outside just say something polite to say you cant do that only answering question about resume.
|
|
129
|
+
|
|
130
|
+
Available tools:
|
|
131
|
+
{tools}
|
|
132
|
+
|
|
133
|
+
Tools names:
|
|
134
|
+
{tool_names}
|
|
135
|
+
|
|
136
|
+
you can repeat n times if needed
|
|
137
|
+
|
|
138
|
+
User: {user_input}
|
|
139
|
+
---
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agentx-dev
|
|
3
|
+
Version: 2.0
|
|
4
|
+
Summary: A lightweight LLM agent framework with standard and structured tool support use, prompt management, and support for OpenAI.
|
|
5
|
+
Author-email: Bruce-Arhin Shadrach <brucearhin098@gmail.com>
|
|
6
|
+
Project-URL: Homepage, https://github.com/shadrach098/Bruce_framework
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/shadrach098/Bruce_framework/issues
|
|
8
|
+
Project-URL: Source, https://github.com/shadrach098/Bruce_framework
|
|
9
|
+
Requires-Python: >=3.8
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
Requires-Dist: openai>=1.0.0
|
|
12
|
+
Requires-Dist: pydantic>=2.0
|
|
13
|
+
Requires-Dist: google-generativeai
|
|
14
|
+
Requires-Dist: httpx
|
|
15
|
+
Requires-Dist: PyYAML>=5.3.1
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# π§ Bruce Agent
|
|
19
|
+
|
|
20
|
+
**AgentX** is a lightweight, extensible agentic framework for building custom LLM agents with structured tool use, prompt templates, and integration with OpenAI and Gemini models.
|
|
21
|
+
|
|
22
|
+
## π Features
|
|
23
|
+
|
|
24
|
+
- π Custom reasoning loop (`AgentRunner`)
|
|
25
|
+
- π§© Structured tool execution (Pydantic-based)
|
|
26
|
+
- π¬ Prompt templating and management
|
|
27
|
+
- π LLM-agnostic: supports **OpenAI function calling** and **Google Gemini**
|
|
28
|
+
- πͺ Easy-to-use API for building agents
|
|
29
|
+
|
|
30
|
+
## π¦ Installation
|
|
31
|
+
|
|
32
|
+
published to PyPI:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
pip install AgentX-Dev
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Example use
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
from AgentXL import AgentRunner, AgentType,ChatModel
|
|
42
|
+
from pydantic import BaseModel
|
|
43
|
+
from AgentXL.Tools import StructuredTool,StandardTool
|
|
44
|
+
# Define a sample Stuctured tool
|
|
45
|
+
class MultiplyTool(BaseModel):
|
|
46
|
+
a: int
|
|
47
|
+
b: int
|
|
48
|
+
|
|
49
|
+
def multiply(a: int, b: int) -> int:
|
|
50
|
+
return a * b
|
|
51
|
+
|
|
52
|
+
# Define a sample Standard tool
|
|
53
|
+
def Weather(weather:str):
|
|
54
|
+
return f"{weather} is currently at 28 degree with a high of 32 and a low of 18 "
|
|
55
|
+
|
|
56
|
+
# Create chat model and agent
|
|
57
|
+
ReAct=AgentType.ReAct
|
|
58
|
+
chat_model = ChatModel.GPT(model="gpt-4", temperature=0.7)
|
|
59
|
+
tools = [StructuredTool(name="MultiplyTool",
|
|
60
|
+
description="useful when you need to add two numbers",
|
|
61
|
+
func=multiply,
|
|
62
|
+
args_schema=MultiplyTool
|
|
63
|
+
),
|
|
64
|
+
StandardTool(name="Weather",
|
|
65
|
+
description="when you need to check the weather of a location, input should be the str of the location",
|
|
66
|
+
func=Weather)]
|
|
67
|
+
# Create an AgentRunner instance
|
|
68
|
+
agent = AgentRunner(model=chat_model,Agent=ReAct, tools=tools)
|
|
69
|
+
|
|
70
|
+
# Initialize the agent with user input
|
|
71
|
+
response = agent.Initialize("What is 5 times 8?")
|
|
72
|
+
|
|
73
|
+
# Print the result
|
|
74
|
+
print(response.content)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
# output the Agent completion
|
|
78
|
+
agent.Initialize("i need the weather in Barrie")
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
``` bruce_framework/
|
|
84
|
+
βββ src/
|
|
85
|
+
β βββ bruce_framework/
|
|
86
|
+
β βββ __init__.py
|
|
87
|
+
β βββ agent/
|
|
88
|
+
β β βββ __init__.py
|
|
89
|
+
β β βββ agent.py
|
|
90
|
+
β βββ runner/
|
|
91
|
+
β β βββ __init__.py
|
|
92
|
+
β β βββ agent_run.py
|
|
93
|
+
β βββ chatmodel.py
|
|
94
|
+
βββ README.md
|
|
95
|
+
βββ LICENSE
|
|
96
|
+
βββ pyproject.toml
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## π Documentation (Coming Soon)
|
|
101
|
+
### More tutorials, tool examples, and structured prompting guides coming soon.
|
|
102
|
+
|
|
103
|
+
## π§βπ» Author
|
|
104
|
+
#### Bruce-Arhin Shadrach
|
|
105
|
+
#### π§ brucearhin098@gmail.com
|
|
106
|
+
#### π GitHub
|
|
107
|
+
|
|
108
|
+
π License
|
|
109
|
+
MIT License
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
agentx_dev/ChatModel.py,sha256=vB6uYEw6W2i73MZQ0a5NWdvm5tf9im_SPV_CXi9RcP4,9212
|
|
2
|
+
agentx_dev/Tools.py,sha256=h2x8jVpaDRQ4B6lhjePWQhuN5gQu_Ll1NKeADg_tT7M,5763
|
|
3
|
+
agentx_dev/__init__.py,sha256=AcPK_lq7N4fPdeQeHOrXxzfYY3n34r1I1Q78LdCv_Hw,214
|
|
4
|
+
agentx_dev/promptTemplate.yaml,sha256=2XpID7yZEgcfJfjh1dYt-uCyuVl2wksuOvHL--epFaM,4467
|
|
5
|
+
agentx_dev/Agents/Agent.py,sha256=5NEtw7C5Ek1LQMefqos3-A8Y6NYPUoFcTa96PFBqLmY,12304
|
|
6
|
+
agentx_dev/Agents/__init__.py,sha256=62anhNzEmdC9JvlbLLz5Q1-vYnoU9OvFxuaLSVn-WRw,240
|
|
7
|
+
agentx_dev/Agents/promptTemplate.yaml,sha256=2XpID7yZEgcfJfjh1dYt-uCyuVl2wksuOvHL--epFaM,4467
|
|
8
|
+
agentx_dev/Runner/AgentRun.py,sha256=8bYHsNxE7Y8BmUxrBs7KqflqAkvILeVR2XzibFsW9Hs,14963
|
|
9
|
+
agentx_dev/Runner/__init__.py,sha256=4-CpwiSKnu7eM9Wkse75oZSwNjAIi2LW3P_7VN1yYbc,82
|
|
10
|
+
agentx_dev/Runner/promptTemplate.yaml,sha256=2XpID7yZEgcfJfjh1dYt-uCyuVl2wksuOvHL--epFaM,4467
|
|
11
|
+
agentx_dev-2.0.dist-info/METADATA,sha256=WneCwF-Hs2c5rN4IL3tJI2xR9YG5k-JVPVe3QuLYw8o,3311
|
|
12
|
+
agentx_dev-2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
13
|
+
agentx_dev-2.0.dist-info/top_level.txt,sha256=iYmZ0acr4tPjt0Xblh8f4uNNr7qfF61l7kYrlnO-k6g,11
|
|
14
|
+
agentx_dev-2.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
agentx_dev
|