deer-agent-framework 0.0__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.
- deer_agent_framework-0.0/LICENSE +24 -0
- deer_agent_framework-0.0/PKG-INFO +163 -0
- deer_agent_framework-0.0/README.md +146 -0
- deer_agent_framework-0.0/deer/__init__.py +36 -0
- deer_agent_framework-0.0/deer/builtins/__init__.py +7 -0
- deer_agent_framework-0.0/deer/builtins/python_manager/agent.py +29 -0
- deer_agent_framework-0.0/deer/builtins/python_manager/tools.py +54 -0
- deer_agent_framework-0.0/deer/core/__init__.py +1 -0
- deer_agent_framework-0.0/deer/core/agent.py +463 -0
- deer_agent_framework-0.0/deer/core/ui.py +31 -0
- deer_agent_framework-0.0/deer/drivers/__init__.py +66 -0
- deer_agent_framework-0.0/deer/drivers/base_driver.py +56 -0
- deer_agent_framework-0.0/deer/drivers/gemini_driver.py +62 -0
- deer_agent_framework-0.0/deer/drivers/ollama_driver.py +69 -0
- deer_agent_framework-0.0/deer/executor/__init__.py +1 -0
- deer_agent_framework-0.0/deer/executor/executor.py +168 -0
- deer_agent_framework-0.0/deer/executor/logic.py +75 -0
- deer_agent_framework-0.0/deer/executor/logic_secure.py +102 -0
- deer_agent_framework-0.0/deer/main.py +71 -0
- deer_agent_framework-0.0/deer/planner/__init__.py +1 -0
- deer_agent_framework-0.0/deer/planner/planner.py +71 -0
- deer_agent_framework-0.0/deer/prompts/__init__.py +6 -0
- deer_agent_framework-0.0/deer/prompts/error_explain.py +30 -0
- deer_agent_framework-0.0/deer/prompts/goal_improvement.py +65 -0
- deer_agent_framework-0.0/deer/prompts/goal_validation.py +31 -0
- deer_agent_framework-0.0/deer/prompts/humanizer.py +20 -0
- deer_agent_framework-0.0/deer/prompts/planner.py +92 -0
- deer_agent_framework-0.0/deer/prompts/response_improvement.py +23 -0
- deer_agent_framework-0.0/deer/schema/__init__.py +2 -0
- deer_agent_framework-0.0/deer/schema/io.py +40 -0
- deer_agent_framework-0.0/deer/schema/plan.py +75 -0
- deer_agent_framework-0.0/deer/tools/__init__.py +4 -0
- deer_agent_framework-0.0/deer/tools/base.py +141 -0
- deer_agent_framework-0.0/deer/tools/builtin/__init__.py +3 -0
- deer_agent_framework-0.0/deer/tools/builtin/file_manager.py +136 -0
- deer_agent_framework-0.0/deer/tools/builtin/git_manager.py +67 -0
- deer_agent_framework-0.0/deer/tools/builtin/search_manager.py +123 -0
- deer_agent_framework-0.0/deer/tools/decorators.py +127 -0
- deer_agent_framework-0.0/deer/tools/registry.py +114 -0
- deer_agent_framework-0.0/deer/tracing/__init__.py +2 -0
- deer_agent_framework-0.0/deer/tracing/logging_config.py +20 -0
- deer_agent_framework-0.0/deer/tracing/store.py +21 -0
- deer_agent_framework-0.0/deer/utils/__init__.py +0 -0
- deer_agent_framework-0.0/deer/utils/console.py +11 -0
- deer_agent_framework-0.0/deer/utils/plots/__init__.py +7 -0
- deer_agent_framework-0.0/deer/utils/plots/plot_traces.py +1034 -0
- deer_agent_framework-0.0/deer/validator/__init__.py +1 -0
- deer_agent_framework-0.0/deer/validator/plan_validator.py +23 -0
- deer_agent_framework-0.0/deer/validator/rules.py +98 -0
- deer_agent_framework-0.0/deer_agent_framework.egg-info/PKG-INFO +163 -0
- deer_agent_framework-0.0/deer_agent_framework.egg-info/SOURCES.txt +56 -0
- deer_agent_framework-0.0/deer_agent_framework.egg-info/dependency_links.txt +1 -0
- deer_agent_framework-0.0/deer_agent_framework.egg-info/entry_points.txt +2 -0
- deer_agent_framework-0.0/deer_agent_framework.egg-info/requires.txt +8 -0
- deer_agent_framework-0.0/deer_agent_framework.egg-info/top_level.txt +1 -0
- deer_agent_framework-0.0/pyproject.toml +30 -0
- deer_agent_framework-0.0/setup.cfg +4 -0
- deer_agent_framework-0.0/tests/test_plan_validator.py +62 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
BSD 2-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, DunderLab
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
16
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
17
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
18
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
19
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
20
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
21
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
22
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
23
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
24
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: deer-agent-framework
|
|
3
|
+
Version: 0.0
|
|
4
|
+
Summary: DEER - Deterministic Executable Engine for Runtime-agents
|
|
5
|
+
Author: Yeison
|
|
6
|
+
Requires-Python: >=3.12
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: pydantic>=2.0
|
|
10
|
+
Requires-Dist: rich
|
|
11
|
+
Requires-Dist: prompt_toolkit
|
|
12
|
+
Provides-Extra: debug
|
|
13
|
+
Requires-Dist: matplotlib>=3.10.9; extra == "debug"
|
|
14
|
+
Requires-Dist: pandas>=3.0.3; extra == "debug"
|
|
15
|
+
Requires-Dist: pytest>=9.0.3; extra == "debug"
|
|
16
|
+
Dynamic: license-file
|
|
17
|
+
|
|
18
|
+
# DEER: Deterministic Executable Engine for Runtime Agents
|
|
19
|
+
|
|
20
|
+
### **Stop building "Vibe-based" Agents. Start Engineering Deterministic Agents.**
|
|
21
|
+
|
|
22
|
+
**DEER** is the first framework designed for building **Deterministic Agents** in production environments where "it usually works" isn't good enough. While other frameworks rely on massive system prompts and probabilistic loops, DEER subordinates LLMs to rigid, code-defined software structures.
|
|
23
|
+
|
|
24
|
+
[](LICENSE)
|
|
25
|
+
[](https://www.python.org/downloads/)
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Why DEER?
|
|
30
|
+
|
|
31
|
+
Most agent frameworks suffer from **"Prompt Drift"**: you change one word in a system prompt and the whole logic breaks. DEER replaces "vibes" with **Deterministic Agents** powered by **Code Contracts**.
|
|
32
|
+
|
|
33
|
+
* **Logic over Prompts:** Define your **Deterministic Agent**'s behavior in Python, not in a 2000-word text file.
|
|
34
|
+
* **Typed Tooling:** Every tool has a Pydantic-validated input and output. No more "hallucinated" arguments.
|
|
35
|
+
* **Jailed by Design:** Built-in filesystem sandboxing (Jail) ensures your **Deterministic Agent** can't escape its directory.
|
|
36
|
+
* **Verification Loops:** The agent doesn't just "execute"; it validates the result against the original goal using deterministic traces.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## The DEER Workflow: Code-First Implementation
|
|
41
|
+
|
|
42
|
+
### 1. Define your Deterministic Agent's Identity
|
|
43
|
+
Forget about telling the AI to "act like a specialist." Define a high-level `DeterministicAgent` with clear boundaries and a specific tool registry.
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
from pathlib import Path
|
|
47
|
+
from deer.core.agent import DeterministicAgent
|
|
48
|
+
from deer.drivers import get_driver_from_parser
|
|
49
|
+
from .tools import registry
|
|
50
|
+
|
|
51
|
+
agent = DeterministicAgent(
|
|
52
|
+
description="Python Architecture Specialist",
|
|
53
|
+
identity=(
|
|
54
|
+
"You are a Principal Python Architect. You possess authoritative expertise "
|
|
55
|
+
"in advanced module resolution and dependency management."
|
|
56
|
+
),
|
|
57
|
+
driver=get_driver_from_parser(),
|
|
58
|
+
registry=registry,
|
|
59
|
+
jail_path=Path.cwd() / "sandbox", # Strict security boundary
|
|
60
|
+
format_response="markdown",
|
|
61
|
+
max_tries_for_plan=5
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
if __name__ == "__main__":
|
|
65
|
+
agent.repl() # Instant interactive shell
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 2. Assemble your Tool Registry
|
|
69
|
+
Combine built-in managers (File, Git, Search) into a single, cohesive unit of execution for your **Deterministic Agent**.
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
from deer.tools.registry import ToolRegistry
|
|
73
|
+
from deer.tools.builtin import FileManager, GitManager, SearchManager
|
|
74
|
+
|
|
75
|
+
registry = ToolRegistry()
|
|
76
|
+
|
|
77
|
+
# Add specialized capabilities with zero-config
|
|
78
|
+
registry.register(
|
|
79
|
+
FileManager(),
|
|
80
|
+
GitManager(),
|
|
81
|
+
SearchManager(),
|
|
82
|
+
)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 3. Create Custom Tools with Pydantic Validation
|
|
86
|
+
Extending your **Deterministic Agent** is as simple as writing a class. The `@tool` decorator automatically generates the JSON schema for the LLM, ensuring perfect compatibility.
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
from deer.tools import ToolProvider, tool, Return
|
|
90
|
+
|
|
91
|
+
class MyCustomProvider(ToolProvider):
|
|
92
|
+
@tool(modifies_state=True)
|
|
93
|
+
def deploy_module(self, name: str, version: str) -> Return(status=str, job_id=int):
|
|
94
|
+
"""Deploys a specific python module to the internal repo."""
|
|
95
|
+
# Your deterministic logic here
|
|
96
|
+
return {"status": "success", "job_id": 12345}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Built-in Deterministic Agents
|
|
102
|
+
|
|
103
|
+
The framework includes pre-configured **Deterministic Agents** in the `deer/builtins/` directory. These serve as both ready-to-use tools and reference implementations for building your own specialized architects and managers.
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Technical Differentiation
|
|
108
|
+
|
|
109
|
+
| Feature | Traditional Frameworks (LangChain, etc.) | **DEER Deterministic Agents** |
|
|
110
|
+
| :--- | :--- | :--- |
|
|
111
|
+
| **Execution Flow** | Probabilistic (LLM decides next step) | **Deterministic** (Backend-validated Plan) |
|
|
112
|
+
| **Tool Arguments** | Often Hallucinated | **Strictly Typed** (Pydantic Models) |
|
|
113
|
+
| **Security** | None / Manual | **Built-in Jail (Sandbox)** |
|
|
114
|
+
| **Debugging** | Black box / Tricky logs | **Step-by-Step Trace Replay** |
|
|
115
|
+
| **Output** | Raw Text | **Validated & Humanized Data** |
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## The "Assembly Line" Lifecycle
|
|
120
|
+
|
|
121
|
+
A **Deterministic Agent** in DEER doesn't just "chat". It processes requests through a linear production line:
|
|
122
|
+
|
|
123
|
+
1. **Refinement:** The **Deterministic Agent** improves the user's goal for technical clarity.
|
|
124
|
+
2. **Planning:** The agent generates a complete JSON pipeline *before* executing anything.
|
|
125
|
+
3. **Static Analysis:** The `PlanValidator` checks the plan for cycles or type mismatches.
|
|
126
|
+
4. **Jailed Execution:** Tools run inside a secure sandbox.
|
|
127
|
+
5. **Verification:** A secondary "judge" loop confirms the result matches the goal.
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Empirical Evidence: Engineering vs. Vibes
|
|
132
|
+
|
|
133
|
+
DEER isn't just a "good idea"—it's a measured engineering framework. Below is the data from **100 consecutive executions** of a complex Python architecture task using the `gemma4:31b` model.
|
|
134
|
+
|
|
135
|
+
### 1. Planning Determinism
|
|
136
|
+
While traditional agents hallucinate different paths every time, DEER's planning and validation loop ensures high predictability.
|
|
137
|
+
|
|
138
|
+

|
|
139
|
+
*Figure 1: Path frequency distribution. 90% of executions follow the same validated optimal path, ensuring production-grade reliability.*
|
|
140
|
+
|
|
141
|
+
### 2. Full Trace Introspección
|
|
142
|
+
Every decision, tool call, and validation step is recorded. This allows for deep auditing and performance profiling.
|
|
143
|
+
|
|
144
|
+

|
|
145
|
+
*Figure 2: Multi-trace step analysis showing the density and consistency of the agent's internal logic across multiple runs.*
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Installation
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
pip install git+https://github.com/dunderlab/deer-agent-framework.git
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
*Requires Python 3.12+ and a valid LLM API Key (Gemini, Ollama, etc.).*
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## License
|
|
160
|
+
Licensed under the **BSD 2-Clause License**. See [LICENSE](LICENSE) for details.
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
**Built for developers who trust code, not prompts.**
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# DEER: Deterministic Executable Engine for Runtime Agents
|
|
2
|
+
|
|
3
|
+
### **Stop building "Vibe-based" Agents. Start Engineering Deterministic Agents.**
|
|
4
|
+
|
|
5
|
+
**DEER** is the first framework designed for building **Deterministic Agents** in production environments where "it usually works" isn't good enough. While other frameworks rely on massive system prompts and probabilistic loops, DEER subordinates LLMs to rigid, code-defined software structures.
|
|
6
|
+
|
|
7
|
+
[](LICENSE)
|
|
8
|
+
[](https://www.python.org/downloads/)
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Why DEER?
|
|
13
|
+
|
|
14
|
+
Most agent frameworks suffer from **"Prompt Drift"**: you change one word in a system prompt and the whole logic breaks. DEER replaces "vibes" with **Deterministic Agents** powered by **Code Contracts**.
|
|
15
|
+
|
|
16
|
+
* **Logic over Prompts:** Define your **Deterministic Agent**'s behavior in Python, not in a 2000-word text file.
|
|
17
|
+
* **Typed Tooling:** Every tool has a Pydantic-validated input and output. No more "hallucinated" arguments.
|
|
18
|
+
* **Jailed by Design:** Built-in filesystem sandboxing (Jail) ensures your **Deterministic Agent** can't escape its directory.
|
|
19
|
+
* **Verification Loops:** The agent doesn't just "execute"; it validates the result against the original goal using deterministic traces.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## The DEER Workflow: Code-First Implementation
|
|
24
|
+
|
|
25
|
+
### 1. Define your Deterministic Agent's Identity
|
|
26
|
+
Forget about telling the AI to "act like a specialist." Define a high-level `DeterministicAgent` with clear boundaries and a specific tool registry.
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
from pathlib import Path
|
|
30
|
+
from deer.core.agent import DeterministicAgent
|
|
31
|
+
from deer.drivers import get_driver_from_parser
|
|
32
|
+
from .tools import registry
|
|
33
|
+
|
|
34
|
+
agent = DeterministicAgent(
|
|
35
|
+
description="Python Architecture Specialist",
|
|
36
|
+
identity=(
|
|
37
|
+
"You are a Principal Python Architect. You possess authoritative expertise "
|
|
38
|
+
"in advanced module resolution and dependency management."
|
|
39
|
+
),
|
|
40
|
+
driver=get_driver_from_parser(),
|
|
41
|
+
registry=registry,
|
|
42
|
+
jail_path=Path.cwd() / "sandbox", # Strict security boundary
|
|
43
|
+
format_response="markdown",
|
|
44
|
+
max_tries_for_plan=5
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
if __name__ == "__main__":
|
|
48
|
+
agent.repl() # Instant interactive shell
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### 2. Assemble your Tool Registry
|
|
52
|
+
Combine built-in managers (File, Git, Search) into a single, cohesive unit of execution for your **Deterministic Agent**.
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
from deer.tools.registry import ToolRegistry
|
|
56
|
+
from deer.tools.builtin import FileManager, GitManager, SearchManager
|
|
57
|
+
|
|
58
|
+
registry = ToolRegistry()
|
|
59
|
+
|
|
60
|
+
# Add specialized capabilities with zero-config
|
|
61
|
+
registry.register(
|
|
62
|
+
FileManager(),
|
|
63
|
+
GitManager(),
|
|
64
|
+
SearchManager(),
|
|
65
|
+
)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 3. Create Custom Tools with Pydantic Validation
|
|
69
|
+
Extending your **Deterministic Agent** is as simple as writing a class. The `@tool` decorator automatically generates the JSON schema for the LLM, ensuring perfect compatibility.
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
from deer.tools import ToolProvider, tool, Return
|
|
73
|
+
|
|
74
|
+
class MyCustomProvider(ToolProvider):
|
|
75
|
+
@tool(modifies_state=True)
|
|
76
|
+
def deploy_module(self, name: str, version: str) -> Return(status=str, job_id=int):
|
|
77
|
+
"""Deploys a specific python module to the internal repo."""
|
|
78
|
+
# Your deterministic logic here
|
|
79
|
+
return {"status": "success", "job_id": 12345}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Built-in Deterministic Agents
|
|
85
|
+
|
|
86
|
+
The framework includes pre-configured **Deterministic Agents** in the `deer/builtins/` directory. These serve as both ready-to-use tools and reference implementations for building your own specialized architects and managers.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Technical Differentiation
|
|
91
|
+
|
|
92
|
+
| Feature | Traditional Frameworks (LangChain, etc.) | **DEER Deterministic Agents** |
|
|
93
|
+
| :--- | :--- | :--- |
|
|
94
|
+
| **Execution Flow** | Probabilistic (LLM decides next step) | **Deterministic** (Backend-validated Plan) |
|
|
95
|
+
| **Tool Arguments** | Often Hallucinated | **Strictly Typed** (Pydantic Models) |
|
|
96
|
+
| **Security** | None / Manual | **Built-in Jail (Sandbox)** |
|
|
97
|
+
| **Debugging** | Black box / Tricky logs | **Step-by-Step Trace Replay** |
|
|
98
|
+
| **Output** | Raw Text | **Validated & Humanized Data** |
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## The "Assembly Line" Lifecycle
|
|
103
|
+
|
|
104
|
+
A **Deterministic Agent** in DEER doesn't just "chat". It processes requests through a linear production line:
|
|
105
|
+
|
|
106
|
+
1. **Refinement:** The **Deterministic Agent** improves the user's goal for technical clarity.
|
|
107
|
+
2. **Planning:** The agent generates a complete JSON pipeline *before* executing anything.
|
|
108
|
+
3. **Static Analysis:** The `PlanValidator` checks the plan for cycles or type mismatches.
|
|
109
|
+
4. **Jailed Execution:** Tools run inside a secure sandbox.
|
|
110
|
+
5. **Verification:** A secondary "judge" loop confirms the result matches the goal.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Empirical Evidence: Engineering vs. Vibes
|
|
115
|
+
|
|
116
|
+
DEER isn't just a "good idea"—it's a measured engineering framework. Below is the data from **100 consecutive executions** of a complex Python architecture task using the `gemma4:31b` model.
|
|
117
|
+
|
|
118
|
+
### 1. Planning Determinism
|
|
119
|
+
While traditional agents hallucinate different paths every time, DEER's planning and validation loop ensures high predictability.
|
|
120
|
+
|
|
121
|
+

|
|
122
|
+
*Figure 1: Path frequency distribution. 90% of executions follow the same validated optimal path, ensuring production-grade reliability.*
|
|
123
|
+
|
|
124
|
+
### 2. Full Trace Introspección
|
|
125
|
+
Every decision, tool call, and validation step is recorded. This allows for deep auditing and performance profiling.
|
|
126
|
+
|
|
127
|
+

|
|
128
|
+
*Figure 2: Multi-trace step analysis showing the density and consistency of the agent's internal logic across multiple runs.*
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Installation
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
pip install git+https://github.com/dunderlab/deer-agent-framework.git
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
*Requires Python 3.12+ and a valid LLM API Key (Gemini, Ollama, etc.).*
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## License
|
|
143
|
+
Licensed under the **BSD 2-Clause License**. See [LICENSE](LICENSE) for details.
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
**Built for developers who trust code, not prompts.**
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def load_env_file(env_path: Path) -> None:
|
|
6
|
+
"""Reads a .env file and loads its variables into os.environ natively."""
|
|
7
|
+
try:
|
|
8
|
+
with open(env_path, "r", encoding="utf-8") as f:
|
|
9
|
+
for line in f:
|
|
10
|
+
# Strip whitespace and ignore empty lines or comments
|
|
11
|
+
line = line.strip()
|
|
12
|
+
if not line or line.startswith("#"):
|
|
13
|
+
continue
|
|
14
|
+
|
|
15
|
+
# Split by the first '=' found
|
|
16
|
+
if "=" in line:
|
|
17
|
+
key, value = line.split("=", 1)
|
|
18
|
+
# Strip quotes if the value is wrapped in them
|
|
19
|
+
key = key.strip()
|
|
20
|
+
value = value.strip().strip("'\"")
|
|
21
|
+
|
|
22
|
+
# Set the environment variable
|
|
23
|
+
os.environ[key] = value
|
|
24
|
+
except IOError as e:
|
|
25
|
+
# Log or handle the error if the file exists but can't be read
|
|
26
|
+
pass
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# Your configuration logic remains clean and dependency-free
|
|
30
|
+
local_env = Path(".env")
|
|
31
|
+
user_env = Path.home() / "deer.env"
|
|
32
|
+
|
|
33
|
+
if local_env.exists():
|
|
34
|
+
load_env_file(local_env)
|
|
35
|
+
elif user_env.exists():
|
|
36
|
+
load_env_file(user_env)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
from deer.core.agent import DeterministicAgent
|
|
4
|
+
from deer.drivers import get_driver_from_parser
|
|
5
|
+
|
|
6
|
+
if __package__:
|
|
7
|
+
from .tools import registry
|
|
8
|
+
else:
|
|
9
|
+
from tools import registry
|
|
10
|
+
|
|
11
|
+
agent = DeterministicAgent(
|
|
12
|
+
description="Python Architecture Specialist expert in module lifecycle, dependency management, and package distribution.",
|
|
13
|
+
identity=(
|
|
14
|
+
"You are a Principal Python Architect and Core Ecosystem Specialist. You possess authoritative expertise "
|
|
15
|
+
"in advanced module resolution, dependency management architectures, package distribution, and internal "
|
|
16
|
+
"or public repository management. Your knowledge spans the entire lifecycle of Python code: from how "
|
|
17
|
+
"modules are imported and structured at runtime, to how dependencies are resolved, isolated, packaged, "
|
|
18
|
+
"and deployed across diverse environments."
|
|
19
|
+
),
|
|
20
|
+
driver=get_driver_from_parser(),
|
|
21
|
+
registry=registry,
|
|
22
|
+
jail_path=Path.cwd(),
|
|
23
|
+
format_response="markdown",
|
|
24
|
+
max_tries_for_plan=5,
|
|
25
|
+
rollback=None,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
if __name__ == "__main__":
|
|
29
|
+
agent.repl()
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
from deer.tools.registry import ToolRegistry
|
|
2
|
+
from deer.tools.builtin import FileManager, GitManager, SearchManager
|
|
3
|
+
|
|
4
|
+
jail_path = "/Users/yeison/Development/deer-agent-framework/sandbox/root"
|
|
5
|
+
|
|
6
|
+
registry = ToolRegistry()
|
|
7
|
+
|
|
8
|
+
fileManager = FileManager(
|
|
9
|
+
# tools=[
|
|
10
|
+
# "new_file",
|
|
11
|
+
# "read_file",
|
|
12
|
+
# "delete_file",
|
|
13
|
+
# "create_directory",
|
|
14
|
+
# "get_file_info",
|
|
15
|
+
# "directory_tree",
|
|
16
|
+
# ],
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
gitManager = GitManager(
|
|
20
|
+
# tools=[
|
|
21
|
+
# "git_status",
|
|
22
|
+
# "git_current_branch",
|
|
23
|
+
# "git_log",
|
|
24
|
+
# "git_diff",
|
|
25
|
+
# "git_staged_diff",
|
|
26
|
+
# "git_show",
|
|
27
|
+
# "git_add",
|
|
28
|
+
# "git_commit",
|
|
29
|
+
# "git_restore",
|
|
30
|
+
# ],
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
searchManager = SearchManager(
|
|
34
|
+
# tools=[
|
|
35
|
+
# "search_text",
|
|
36
|
+
# "search_regex",
|
|
37
|
+
# "search_text_ignore_case",
|
|
38
|
+
# "search_regex_ignore_case",
|
|
39
|
+
# "find_files",
|
|
40
|
+
# "search_file_names",
|
|
41
|
+
# "list_files",
|
|
42
|
+
# "search_by_extension",
|
|
43
|
+
# "search_text_in_files",
|
|
44
|
+
# "files_with_matches",
|
|
45
|
+
# "files_without_matches",
|
|
46
|
+
# "count_matches",
|
|
47
|
+
# ],
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
registry.register(
|
|
51
|
+
fileManager,
|
|
52
|
+
gitManager,
|
|
53
|
+
searchManager,
|
|
54
|
+
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .agent import DeterministicAgent
|