agentlys 0.19.2__tar.gz
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.
- agentlys-0.19.2/LICENSE +21 -0
- agentlys-0.19.2/PKG-INFO +242 -0
- agentlys-0.19.2/README.md +196 -0
- agentlys-0.19.2/pyproject.toml +66 -0
- agentlys-0.19.2/setup.cfg +4 -0
- agentlys-0.19.2/src/agentlys/__init__.py +9 -0
- agentlys-0.19.2/src/agentlys/base.py +14 -0
- agentlys-0.19.2/src/agentlys/chat.py +456 -0
- agentlys-0.19.2/src/agentlys/mcp.py +94 -0
- agentlys-0.19.2/src/agentlys/model.py +359 -0
- agentlys-0.19.2/src/agentlys/providers/anthropic.py +213 -0
- agentlys-0.19.2/src/agentlys/providers/base_provider.py +56 -0
- agentlys-0.19.2/src/agentlys/providers/default.py +62 -0
- agentlys-0.19.2/src/agentlys/providers/openai.py +194 -0
- agentlys-0.19.2/src/agentlys/providers/openai_function_legacy.py +151 -0
- agentlys-0.19.2/src/agentlys/providers/openai_function_shim.py +135 -0
- agentlys-0.19.2/src/agentlys/providers/utils.py +108 -0
- agentlys-0.19.2/src/agentlys/utils.py +282 -0
- agentlys-0.19.2/src/agentlys.egg-info/PKG-INFO +242 -0
- agentlys-0.19.2/src/agentlys.egg-info/SOURCES.txt +33 -0
- agentlys-0.19.2/src/agentlys.egg-info/dependency_links.txt +1 -0
- agentlys-0.19.2/src/agentlys.egg-info/requires.txt +20 -0
- agentlys-0.19.2/src/agentlys.egg-info/top_level.txt +1 -0
- agentlys-0.19.2/tests/test_add_tool.py +63 -0
- agentlys-0.19.2/tests/test_anthropic.py +66 -0
- agentlys-0.19.2/tests/test_base.py +59 -0
- agentlys-0.19.2/tests/test_call_async.py +120 -0
- agentlys-0.19.2/tests/test_callback_image.py +33 -0
- agentlys-0.19.2/tests/test_calls_function.py +44 -0
- agentlys-0.19.2/tests/test_calls_image.py +40 -0
- agentlys-0.19.2/tests/test_none_return.py +71 -0
- agentlys-0.19.2/tests/test_openai_function_shim.py +29 -0
- agentlys-0.19.2/tests/test_terminal_output.py +52 -0
- agentlys-0.19.2/tests/test_tool_repr.py +131 -0
- agentlys-0.19.2/tests/test_utils.py +388 -0
agentlys-0.19.2/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
agentlys-0.19.2/PKG-INFO
ADDED
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agentlys
|
|
3
|
+
Version: 0.19.2
|
|
4
|
+
Summary: Small OpenAI/Anthropic library to support chat templates, and function calls.
|
|
5
|
+
Author-email: Benjamin Derville <benderville@gmail.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2024
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Repository, https://github.com/myriade-ai/agentlys
|
|
29
|
+
Project-URL: Changelog, https://github.com/myriade-ai/agentlys/blob/master/CHANGELOG.md
|
|
30
|
+
Requires-Python: >=3.9
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
License-File: LICENSE
|
|
33
|
+
Requires-Dist: pillow==11.3.0
|
|
34
|
+
Requires-Dist: pydantic==2.12.3
|
|
35
|
+
Provides-Extra: anthropic
|
|
36
|
+
Requires-Dist: anthropic>=0.46.0; extra == "anthropic"
|
|
37
|
+
Provides-Extra: openai
|
|
38
|
+
Requires-Dist: openai>=1.63.2; extra == "openai"
|
|
39
|
+
Provides-Extra: mcp
|
|
40
|
+
Requires-Dist: mcp>=1.6.0; python_version >= "3.10" and extra == "mcp"
|
|
41
|
+
Provides-Extra: all
|
|
42
|
+
Requires-Dist: anthropic>=0.46.0; extra == "all"
|
|
43
|
+
Requires-Dist: openai>=1.63.2; extra == "all"
|
|
44
|
+
Requires-Dist: mcp>=1.6.0; python_version >= "3.10" and extra == "all"
|
|
45
|
+
Dynamic: license-file
|
|
46
|
+
|
|
47
|
+
# Agentlys
|
|
48
|
+
|
|
49
|
+
[](https://pypi.python.org/pypi/agentlys)
|
|
50
|
+
[](https://github.com/myriade-ai/agentlys/blob/master/LICENSE)
|
|
51
|
+
[](https://github.com/myriade-ai/agentlys/actions)
|
|
52
|
+
|
|
53
|
+
> ⚠️ **Warning**: Since agentic capabilities are evolving fast, expect the API to change.
|
|
54
|
+
|
|
55
|
+
A lightweight Python library for building AI agents. Turn any Python function or class into AI tools. Supports OpenAI, Anthropic, async operations, and streaming conversations.
|
|
56
|
+
|
|
57
|
+
## Features
|
|
58
|
+
|
|
59
|
+
- Add functions: `agent.add_function(my_function)`
|
|
60
|
+
- Add classes: `agent.add_tool(my_class_instance)`
|
|
61
|
+
- MCP support
|
|
62
|
+
- Multiple providers: OpenAI, Anthropic, ...
|
|
63
|
+
- Async/await support
|
|
64
|
+
- Image processing
|
|
65
|
+
- Conversation streaming
|
|
66
|
+
- Template system
|
|
67
|
+
|
|
68
|
+
## Real-World Example: Code Development Agent
|
|
69
|
+
|
|
70
|
+
Agentlys excels at building development agents. Here's how [agentlys-dev](https://github.com/myriade-ai/agentlys-dev) uses agentlys to create an AI developer:
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
from agentlys import Agentlys
|
|
74
|
+
# pip install 'agentlys-tools[all]'
|
|
75
|
+
from agentlys_tools.code_editor import CodeEditor
|
|
76
|
+
from agentlys_tools.terminal import Terminal
|
|
77
|
+
|
|
78
|
+
# Create a developer agent
|
|
79
|
+
agent = Agentlys(
|
|
80
|
+
instruction="""You are a developer agent equipped with tools to:
|
|
81
|
+
1. Edit code files
|
|
82
|
+
2. Run terminal commands
|
|
83
|
+
3. Test and debug applications""",
|
|
84
|
+
provider="anthropic",
|
|
85
|
+
model="claude-sonnet-4-20250514",
|
|
86
|
+
name="Developer"
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
# Add development tools
|
|
90
|
+
code_editor = CodeEditor()
|
|
91
|
+
agent.add_tool(code_editor)
|
|
92
|
+
|
|
93
|
+
terminal = Terminal()
|
|
94
|
+
agent.add_tool(terminal)
|
|
95
|
+
|
|
96
|
+
# The agent can now autonomously develop, test, and deploy code
|
|
97
|
+
for message in agent.run_conversation("Create a FastAPI hello world app with tests"):
|
|
98
|
+
print(message.to_markdown())
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Installation
|
|
102
|
+
|
|
103
|
+
Install agentlys with all providers and features:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
pip install 'agentlys[all]'
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Or install with specific providers:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
# OpenAI only
|
|
113
|
+
pip install 'agentlys[openai]'
|
|
114
|
+
|
|
115
|
+
# Anthropic only
|
|
116
|
+
pip install 'agentlys[anthropic]'
|
|
117
|
+
|
|
118
|
+
# With MCP support (Python 3.10+)
|
|
119
|
+
pip install 'agentlys[mcp]'
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Usage
|
|
123
|
+
|
|
124
|
+
### Functions
|
|
125
|
+
|
|
126
|
+
Turn regular Python functions into tools by using `add_function()`
|
|
127
|
+
|
|
128
|
+
- Methods docstring, args and return type will be used to generate the tool description.
|
|
129
|
+
|
|
130
|
+
```python
|
|
131
|
+
from agentlys import Agentlys
|
|
132
|
+
|
|
133
|
+
def get_weather(city: str) -> str:
|
|
134
|
+
return f"Sunny in {city}"
|
|
135
|
+
|
|
136
|
+
agent = Agentlys()
|
|
137
|
+
agent.add_function(get_weather)
|
|
138
|
+
agent.ask("What's the weather in Tokyo?")
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Classes (the killer feature)
|
|
142
|
+
|
|
143
|
+
Turn entire classes into tools by using `add_tool()`
|
|
144
|
+
|
|
145
|
+
- Methods docstring, args and return type will be used to generate the tool description.
|
|
146
|
+
- \_\_llm\_\_ method will be used to give AI the last state of the tool at each interaction.
|
|
147
|
+
|
|
148
|
+
```python
|
|
149
|
+
import os
|
|
150
|
+
|
|
151
|
+
class FileManager:
|
|
152
|
+
def __llm__(self):
|
|
153
|
+
return "Files:\n" + "\n".join(os.listdir(self.directory))
|
|
154
|
+
|
|
155
|
+
def read_file(self, path: str) -> str:
|
|
156
|
+
"""Read a file
|
|
157
|
+
Args:
|
|
158
|
+
path: Path is relative to the directory or absolute
|
|
159
|
+
"""
|
|
160
|
+
with open(path) as f:
|
|
161
|
+
return f.read()
|
|
162
|
+
|
|
163
|
+
def write_file(self, path: str, content: str):
|
|
164
|
+
with open(path, 'w') as f:
|
|
165
|
+
f.write(content)
|
|
166
|
+
|
|
167
|
+
file_manager = FileManager()
|
|
168
|
+
agent = Agentlys()
|
|
169
|
+
agent.add_tool(file_manager)
|
|
170
|
+
|
|
171
|
+
# AI can now read/write files
|
|
172
|
+
for msg in agent.run_conversation("Read config.json and update the port to 8080"):
|
|
173
|
+
print(msg.content)
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Advanced Features
|
|
177
|
+
|
|
178
|
+
### Image Support
|
|
179
|
+
|
|
180
|
+
```python
|
|
181
|
+
from agentlys import Agentlys, Message
|
|
182
|
+
from PIL import Image
|
|
183
|
+
|
|
184
|
+
agent = Agentlys()
|
|
185
|
+
image = Image.open("examples/image.jpg")
|
|
186
|
+
message = Message(role="user", content="Describe this image", image=image)
|
|
187
|
+
response = agent.ask(message)
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Template System
|
|
191
|
+
|
|
192
|
+
```python
|
|
193
|
+
# Load agent from markdown template
|
|
194
|
+
agent = Agentlys.from_template("./agent_template.md")
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Async Support
|
|
198
|
+
|
|
199
|
+
```python
|
|
200
|
+
# Async operations
|
|
201
|
+
response = await agent.ask_async("Hello")
|
|
202
|
+
async for message in agent.run_conversation_async("Help me code"):
|
|
203
|
+
print(message.content)
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## Configuration
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
# Set up your API keys
|
|
210
|
+
export OPENAI_API_KEY="your-key"
|
|
211
|
+
export ANTHROPIC_API_KEY="your-key"
|
|
212
|
+
|
|
213
|
+
# Choose your model (optional)
|
|
214
|
+
export AGENTLYS_MODEL="claude-sonnet-4-20250514" # or gpt-5-mini
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
💡 **Recommendation**: Use Anthropic's Claude models for complex agentic behavior and tool use.
|
|
218
|
+
|
|
219
|
+
## Use Cases
|
|
220
|
+
|
|
221
|
+
- **🤖 AI Assistants**: Build conversational assistants with tool access
|
|
222
|
+
- **🛠️ Development Agents**: Create agents that can code, test, and deploy (like [agentlys-dev](https://github.com/myriade-ai/agentlys-dev))
|
|
223
|
+
- **📊 Data Analysis**: Agents that can query databases, generate reports, visualize data
|
|
224
|
+
- **🌐 Web Automation**: Agents that interact with web APIs and services
|
|
225
|
+
- **📋 Task Automation**: Automate complex workflows with AI decision-making
|
|
226
|
+
- **🎯 Custom Tools**: Integrate your existing Python tools with AI
|
|
227
|
+
|
|
228
|
+
## Documentation
|
|
229
|
+
|
|
230
|
+
- [API Reference](docs/api-reference.md) - Complete API documentation
|
|
231
|
+
- [Examples](examples/) - More example implementations
|
|
232
|
+
- [Provider Guide](docs/providers.md) - Working with different LLM providers
|
|
233
|
+
- [Tool Development](docs/tool-development.md) - Creating custom tools
|
|
234
|
+
- [Best Practices](docs/best-practices.md) - Tips for building robust agents
|
|
235
|
+
|
|
236
|
+
## Support
|
|
237
|
+
|
|
238
|
+
If you encounter any issues or have questions, please file an issue on the GitHub project page.
|
|
239
|
+
|
|
240
|
+
## License
|
|
241
|
+
|
|
242
|
+
This project is licensed under the terms of the MIT license.
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# Agentlys
|
|
2
|
+
|
|
3
|
+
[](https://pypi.python.org/pypi/agentlys)
|
|
4
|
+
[](https://github.com/myriade-ai/agentlys/blob/master/LICENSE)
|
|
5
|
+
[](https://github.com/myriade-ai/agentlys/actions)
|
|
6
|
+
|
|
7
|
+
> ⚠️ **Warning**: Since agentic capabilities are evolving fast, expect the API to change.
|
|
8
|
+
|
|
9
|
+
A lightweight Python library for building AI agents. Turn any Python function or class into AI tools. Supports OpenAI, Anthropic, async operations, and streaming conversations.
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- Add functions: `agent.add_function(my_function)`
|
|
14
|
+
- Add classes: `agent.add_tool(my_class_instance)`
|
|
15
|
+
- MCP support
|
|
16
|
+
- Multiple providers: OpenAI, Anthropic, ...
|
|
17
|
+
- Async/await support
|
|
18
|
+
- Image processing
|
|
19
|
+
- Conversation streaming
|
|
20
|
+
- Template system
|
|
21
|
+
|
|
22
|
+
## Real-World Example: Code Development Agent
|
|
23
|
+
|
|
24
|
+
Agentlys excels at building development agents. Here's how [agentlys-dev](https://github.com/myriade-ai/agentlys-dev) uses agentlys to create an AI developer:
|
|
25
|
+
|
|
26
|
+
```python
|
|
27
|
+
from agentlys import Agentlys
|
|
28
|
+
# pip install 'agentlys-tools[all]'
|
|
29
|
+
from agentlys_tools.code_editor import CodeEditor
|
|
30
|
+
from agentlys_tools.terminal import Terminal
|
|
31
|
+
|
|
32
|
+
# Create a developer agent
|
|
33
|
+
agent = Agentlys(
|
|
34
|
+
instruction="""You are a developer agent equipped with tools to:
|
|
35
|
+
1. Edit code files
|
|
36
|
+
2. Run terminal commands
|
|
37
|
+
3. Test and debug applications""",
|
|
38
|
+
provider="anthropic",
|
|
39
|
+
model="claude-sonnet-4-20250514",
|
|
40
|
+
name="Developer"
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
# Add development tools
|
|
44
|
+
code_editor = CodeEditor()
|
|
45
|
+
agent.add_tool(code_editor)
|
|
46
|
+
|
|
47
|
+
terminal = Terminal()
|
|
48
|
+
agent.add_tool(terminal)
|
|
49
|
+
|
|
50
|
+
# The agent can now autonomously develop, test, and deploy code
|
|
51
|
+
for message in agent.run_conversation("Create a FastAPI hello world app with tests"):
|
|
52
|
+
print(message.to_markdown())
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Installation
|
|
56
|
+
|
|
57
|
+
Install agentlys with all providers and features:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pip install 'agentlys[all]'
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Or install with specific providers:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# OpenAI only
|
|
67
|
+
pip install 'agentlys[openai]'
|
|
68
|
+
|
|
69
|
+
# Anthropic only
|
|
70
|
+
pip install 'agentlys[anthropic]'
|
|
71
|
+
|
|
72
|
+
# With MCP support (Python 3.10+)
|
|
73
|
+
pip install 'agentlys[mcp]'
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Usage
|
|
77
|
+
|
|
78
|
+
### Functions
|
|
79
|
+
|
|
80
|
+
Turn regular Python functions into tools by using `add_function()`
|
|
81
|
+
|
|
82
|
+
- Methods docstring, args and return type will be used to generate the tool description.
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
from agentlys import Agentlys
|
|
86
|
+
|
|
87
|
+
def get_weather(city: str) -> str:
|
|
88
|
+
return f"Sunny in {city}"
|
|
89
|
+
|
|
90
|
+
agent = Agentlys()
|
|
91
|
+
agent.add_function(get_weather)
|
|
92
|
+
agent.ask("What's the weather in Tokyo?")
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Classes (the killer feature)
|
|
96
|
+
|
|
97
|
+
Turn entire classes into tools by using `add_tool()`
|
|
98
|
+
|
|
99
|
+
- Methods docstring, args and return type will be used to generate the tool description.
|
|
100
|
+
- \_\_llm\_\_ method will be used to give AI the last state of the tool at each interaction.
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
import os
|
|
104
|
+
|
|
105
|
+
class FileManager:
|
|
106
|
+
def __llm__(self):
|
|
107
|
+
return "Files:\n" + "\n".join(os.listdir(self.directory))
|
|
108
|
+
|
|
109
|
+
def read_file(self, path: str) -> str:
|
|
110
|
+
"""Read a file
|
|
111
|
+
Args:
|
|
112
|
+
path: Path is relative to the directory or absolute
|
|
113
|
+
"""
|
|
114
|
+
with open(path) as f:
|
|
115
|
+
return f.read()
|
|
116
|
+
|
|
117
|
+
def write_file(self, path: str, content: str):
|
|
118
|
+
with open(path, 'w') as f:
|
|
119
|
+
f.write(content)
|
|
120
|
+
|
|
121
|
+
file_manager = FileManager()
|
|
122
|
+
agent = Agentlys()
|
|
123
|
+
agent.add_tool(file_manager)
|
|
124
|
+
|
|
125
|
+
# AI can now read/write files
|
|
126
|
+
for msg in agent.run_conversation("Read config.json and update the port to 8080"):
|
|
127
|
+
print(msg.content)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Advanced Features
|
|
131
|
+
|
|
132
|
+
### Image Support
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
from agentlys import Agentlys, Message
|
|
136
|
+
from PIL import Image
|
|
137
|
+
|
|
138
|
+
agent = Agentlys()
|
|
139
|
+
image = Image.open("examples/image.jpg")
|
|
140
|
+
message = Message(role="user", content="Describe this image", image=image)
|
|
141
|
+
response = agent.ask(message)
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Template System
|
|
145
|
+
|
|
146
|
+
```python
|
|
147
|
+
# Load agent from markdown template
|
|
148
|
+
agent = Agentlys.from_template("./agent_template.md")
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Async Support
|
|
152
|
+
|
|
153
|
+
```python
|
|
154
|
+
# Async operations
|
|
155
|
+
response = await agent.ask_async("Hello")
|
|
156
|
+
async for message in agent.run_conversation_async("Help me code"):
|
|
157
|
+
print(message.content)
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Configuration
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
# Set up your API keys
|
|
164
|
+
export OPENAI_API_KEY="your-key"
|
|
165
|
+
export ANTHROPIC_API_KEY="your-key"
|
|
166
|
+
|
|
167
|
+
# Choose your model (optional)
|
|
168
|
+
export AGENTLYS_MODEL="claude-sonnet-4-20250514" # or gpt-5-mini
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
💡 **Recommendation**: Use Anthropic's Claude models for complex agentic behavior and tool use.
|
|
172
|
+
|
|
173
|
+
## Use Cases
|
|
174
|
+
|
|
175
|
+
- **🤖 AI Assistants**: Build conversational assistants with tool access
|
|
176
|
+
- **🛠️ Development Agents**: Create agents that can code, test, and deploy (like [agentlys-dev](https://github.com/myriade-ai/agentlys-dev))
|
|
177
|
+
- **📊 Data Analysis**: Agents that can query databases, generate reports, visualize data
|
|
178
|
+
- **🌐 Web Automation**: Agents that interact with web APIs and services
|
|
179
|
+
- **📋 Task Automation**: Automate complex workflows with AI decision-making
|
|
180
|
+
- **🎯 Custom Tools**: Integrate your existing Python tools with AI
|
|
181
|
+
|
|
182
|
+
## Documentation
|
|
183
|
+
|
|
184
|
+
- [API Reference](docs/api-reference.md) - Complete API documentation
|
|
185
|
+
- [Examples](examples/) - More example implementations
|
|
186
|
+
- [Provider Guide](docs/providers.md) - Working with different LLM providers
|
|
187
|
+
- [Tool Development](docs/tool-development.md) - Creating custom tools
|
|
188
|
+
- [Best Practices](docs/best-practices.md) - Tips for building robust agents
|
|
189
|
+
|
|
190
|
+
## Support
|
|
191
|
+
|
|
192
|
+
If you encounter any issues or have questions, please file an issue on the GitHub project page.
|
|
193
|
+
|
|
194
|
+
## License
|
|
195
|
+
|
|
196
|
+
This project is licensed under the terms of the MIT license.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "agentlys"
|
|
3
|
+
version = "0.19.2"
|
|
4
|
+
description = "Small OpenAI/Anthropic library to support chat templates, and function calls."
|
|
5
|
+
authors = [
|
|
6
|
+
{name = "Benjamin Derville", email = "benderville@gmail.com"}
|
|
7
|
+
]
|
|
8
|
+
license = { file = "LICENSE" }
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
dependencies = [
|
|
12
|
+
"pillow==11.3.0",
|
|
13
|
+
"pydantic==2.12.3",
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
[project.urls]
|
|
17
|
+
Repository = "https://github.com/myriade-ai/agentlys"
|
|
18
|
+
Changelog = "https://github.com/myriade-ai/agentlys/blob/master/CHANGELOG.md"
|
|
19
|
+
|
|
20
|
+
[project.optional-dependencies]
|
|
21
|
+
anthropic = ["anthropic>=0.46.0"]
|
|
22
|
+
openai = ["openai>=1.63.2"]
|
|
23
|
+
mcp = [
|
|
24
|
+
"mcp>=1.6.0; python_version >= '3.10'",
|
|
25
|
+
]
|
|
26
|
+
all = [
|
|
27
|
+
"anthropic>=0.46.0",
|
|
28
|
+
"openai>=1.63.2",
|
|
29
|
+
"mcp>=1.6.0; python_version >= '3.10'",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[tool.semantic_release]
|
|
33
|
+
version_source = "commit"
|
|
34
|
+
version_toml = [
|
|
35
|
+
"pyproject.toml:project.version",
|
|
36
|
+
]
|
|
37
|
+
branch = "master"
|
|
38
|
+
upload_to_pypi = false
|
|
39
|
+
upload_to_release = true
|
|
40
|
+
build_command = "pip install build && python -m build"
|
|
41
|
+
changelog_file = "CHANGELOG.md"
|
|
42
|
+
dist_path = "dist/"
|
|
43
|
+
commit_message = "chore(release): bump version to {version}"
|
|
44
|
+
|
|
45
|
+
[tool.uv.sources]
|
|
46
|
+
agentlys = { workspace = true }
|
|
47
|
+
vcrpy = { git = "https://github.com/tysonholub/vcrpy.git", rev = "fix.httpx-async" }
|
|
48
|
+
|
|
49
|
+
[build-system]
|
|
50
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
51
|
+
build-backend = "setuptools.build_meta"
|
|
52
|
+
|
|
53
|
+
[dependency-groups]
|
|
54
|
+
dev = [
|
|
55
|
+
"anthropic>=0.46.0",
|
|
56
|
+
"openai>=1.63.2",
|
|
57
|
+
"pytest-asyncio>=0.26.0",
|
|
58
|
+
"vcrpy",
|
|
59
|
+
"pytest-recording>=0.13.2",
|
|
60
|
+
"pytest>=8.3.4",
|
|
61
|
+
"ruff>=0.8.3",
|
|
62
|
+
"mcp>=1.6.0; python_version >= '3.10'",
|
|
63
|
+
"pre-commit>=4.2.0",
|
|
64
|
+
"build>=1.2.2.post1",
|
|
65
|
+
"twine>=6.1.0",
|
|
66
|
+
]
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import typing
|
|
2
|
+
|
|
3
|
+
from agentlys.model import Message
|
|
4
|
+
from agentlys.providers.base_provider import BaseProvider
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class AgentlysBase: # TODO: rename ?
|
|
8
|
+
instruction: str = (None,)
|
|
9
|
+
examples: typing.Union[list[Message], None]
|
|
10
|
+
messages: typing.Union[list[Message], None]
|
|
11
|
+
context: str
|
|
12
|
+
max_interactions: int
|
|
13
|
+
model: str
|
|
14
|
+
provider: BaseProvider
|