deer-agent-framework 0.1a4__tar.gz → 0.2.3__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.2.3/PKG-INFO +240 -0
- deer_agent_framework-0.2.3/README.md +205 -0
- {deer_agent_framework-0.1a4 → deer_agent_framework-0.2.3}/deer/__init__.py +3 -2
- deer_agent_framework-0.2.3/deer/builtins_agents/__init__.py +6 -0
- deer_agent_framework-0.2.3/deer/builtins_agents/operating_system.py +40 -0
- deer_agent_framework-0.2.3/deer/builtins_agents/python_architect.py +45 -0
- deer_agent_framework-0.2.3/deer/cli/__init__.py +2 -0
- {deer_agent_framework-0.1a4/deer → deer_agent_framework-0.2.3/deer/cli}/main.py +7 -7
- deer_agent_framework-0.2.3/deer/cli/parser.py +108 -0
- deer_agent_framework-0.2.3/deer/cli/repl.py +368 -0
- deer_agent_framework-0.2.3/deer/core/agent.py +327 -0
- deer_agent_framework-0.2.3/deer/core/executor.py +133 -0
- deer_agent_framework-0.2.3/deer/core/planner.py +143 -0
- deer_agent_framework-0.2.3/deer/core/validator.py +135 -0
- deer_agent_framework-0.2.3/deer/drivers/__init__.py +5 -0
- deer_agent_framework-0.1a4/deer/drivers/azure_driver.py → deer_agent_framework-0.2.3/deer/drivers/azure.py +9 -10
- deer_agent_framework-0.2.3/deer/drivers/base.py +160 -0
- deer_agent_framework-0.2.3/deer/drivers/gemini.py +32 -0
- deer_agent_framework-0.2.3/deer/drivers/ollama.py +106 -0
- deer_agent_framework-0.1a4/deer/drivers/openai_driver.py → deer_agent_framework-0.2.3/deer/drivers/openai.py +8 -3
- deer_agent_framework-0.2.3/deer/evals/__init__.py +2 -0
- deer_agent_framework-0.2.3/deer/evals/runner.py +21 -0
- deer_agent_framework-0.2.3/deer/memory/__init__.py +1 -0
- deer_agent_framework-0.2.3/deer/memory/vector.py +329 -0
- deer_agent_framework-0.2.3/deer/models.py +149 -0
- {deer_agent_framework-0.1a4 → deer_agent_framework-0.2.3}/deer/tools/__init__.py +0 -1
- {deer_agent_framework-0.1a4 → deer_agent_framework-0.2.3}/deer/tools/decorators.py +39 -25
- deer_agent_framework-0.2.3/deer/tools/presets.py +109 -0
- deer_agent_framework-0.2.3/deer/tools/providers/__init__.py +18 -0
- deer_agent_framework-0.2.3/deer/tools/providers/code_searcher.py +218 -0
- deer_agent_framework-0.2.3/deer/tools/providers/csv_manager.py +135 -0
- deer_agent_framework-0.2.3/deer/tools/providers/dependency_analyzer.py +184 -0
- deer_agent_framework-0.2.3/deer/tools/providers/file_manager.py +354 -0
- {deer_agent_framework-0.1a4/deer/tools/builtin → deer_agent_framework-0.2.3/deer/tools/providers}/git_manager.py +24 -14
- deer_agent_framework-0.2.3/deer/tools/providers/http_client.py +108 -0
- deer_agent_framework-0.2.3/deer/tools/providers/json_editor.py +325 -0
- deer_agent_framework-0.2.3/deer/tools/providers/logic_provider.py +328 -0
- deer_agent_framework-0.2.3/deer/tools/providers/process_manager.py +111 -0
- deer_agent_framework-0.2.3/deer/tools/providers/python_struct_editor.py +557 -0
- deer_agent_framework-0.2.3/deer/tools/providers/runtime_manager.py +147 -0
- deer_agent_framework-0.2.3/deer/tools/providers/sqlite_manager.py +100 -0
- deer_agent_framework-0.2.3/deer/tools/providers/system_observer.py +109 -0
- deer_agent_framework-0.2.3/deer/tools/providers/toml_editor.py +405 -0
- deer_agent_framework-0.2.3/deer/tools/providers/xml_editor.py +407 -0
- deer_agent_framework-0.2.3/deer/tools/providers/yaml_editor.py +383 -0
- deer_agent_framework-0.2.3/deer/tools/registry.py +177 -0
- deer_agent_framework-0.2.3/deer/tools/schemas.py +34 -0
- deer_agent_framework-0.2.3/deer/utils/console.py +32 -0
- {deer_agent_framework-0.1a4 → deer_agent_framework-0.2.3}/deer/utils/plots/plot_traces.py +15 -17
- deer_agent_framework-0.2.3/deer_agent_framework.egg-info/PKG-INFO +240 -0
- deer_agent_framework-0.2.3/deer_agent_framework.egg-info/SOURCES.txt +66 -0
- deer_agent_framework-0.2.3/deer_agent_framework.egg-info/entry_points.txt +2 -0
- {deer_agent_framework-0.1a4 → deer_agent_framework-0.2.3}/deer_agent_framework.egg-info/requires.txt +1 -0
- {deer_agent_framework-0.1a4 → deer_agent_framework-0.2.3}/pyproject.toml +3 -2
- deer_agent_framework-0.2.3/tests/test_driver.py +18 -0
- deer_agent_framework-0.2.3/tests/test_executor.py +40 -0
- deer_agent_framework-0.2.3/tests/test_planner.py +46 -0
- deer_agent_framework-0.2.3/tests/test_tools.py +137 -0
- deer_agent_framework-0.2.3/tests/test_tools_definition.py +41 -0
- deer_agent_framework-0.2.3/tests/test_vector_memory.py +129 -0
- deer_agent_framework-0.1a4/PKG-INFO +0 -198
- deer_agent_framework-0.1a4/README.md +0 -164
- deer_agent_framework-0.1a4/deer/builtins/__init__.py +0 -7
- deer_agent_framework-0.1a4/deer/builtins/python_manager/agent.py +0 -31
- deer_agent_framework-0.1a4/deer/core/agent.py +0 -603
- deer_agent_framework-0.1a4/deer/core/ui.py +0 -37
- deer_agent_framework-0.1a4/deer/drivers/__init__.py +0 -71
- deer_agent_framework-0.1a4/deer/drivers/base_driver.py +0 -191
- deer_agent_framework-0.1a4/deer/drivers/gemini_driver.py +0 -82
- deer_agent_framework-0.1a4/deer/drivers/ollama_driver.py +0 -65
- deer_agent_framework-0.1a4/deer/executor/__init__.py +0 -1
- deer_agent_framework-0.1a4/deer/executor/executor.py +0 -168
- deer_agent_framework-0.1a4/deer/executor/logic.py +0 -75
- deer_agent_framework-0.1a4/deer/executor/logic_secure.py +0 -102
- deer_agent_framework-0.1a4/deer/planner/__init__.py +0 -1
- deer_agent_framework-0.1a4/deer/planner/planner.py +0 -73
- deer_agent_framework-0.1a4/deer/prompts/__init__.py +0 -6
- deer_agent_framework-0.1a4/deer/prompts/error_explain.py +0 -30
- deer_agent_framework-0.1a4/deer/prompts/goal_improvement.py +0 -65
- deer_agent_framework-0.1a4/deer/prompts/goal_validation.py +0 -31
- deer_agent_framework-0.1a4/deer/prompts/humanizer.py +0 -20
- deer_agent_framework-0.1a4/deer/prompts/planner.py +0 -92
- deer_agent_framework-0.1a4/deer/prompts/response_improvement.py +0 -23
- deer_agent_framework-0.1a4/deer/schema/__init__.py +0 -2
- deer_agent_framework-0.1a4/deer/schema/io.py +0 -43
- deer_agent_framework-0.1a4/deer/schema/plan.py +0 -75
- deer_agent_framework-0.1a4/deer/states/__init__.py +0 -2
- deer_agent_framework-0.1a4/deer/states/base.py +0 -50
- deer_agent_framework-0.1a4/deer/states/parallel_state_manager.py +0 -129
- deer_agent_framework-0.1a4/deer/tools/builtin/__init__.py +0 -14
- deer_agent_framework-0.1a4/deer/tools/builtin/file_manager.py +0 -202
- deer_agent_framework-0.1a4/deer/tools/builtin/json_editor.py +0 -150
- deer_agent_framework-0.1a4/deer/tools/builtin/memory_manager.py +0 -73
- deer_agent_framework-0.1a4/deer/tools/builtin/network_manager.py +0 -92
- deer_agent_framework-0.1a4/deer/tools/builtin/python_editor.py +0 -552
- deer_agent_framework-0.1a4/deer/tools/builtin/runtime_manager.py +0 -181
- deer_agent_framework-0.1a4/deer/tools/builtin/search_manager.py +0 -124
- deer_agent_framework-0.1a4/deer/tools/builtin/structured_data_inspector.py +0 -112
- deer_agent_framework-0.1a4/deer/tools/builtin/system_inspector.py +0 -56
- deer_agent_framework-0.1a4/deer/tools/builtin/toml_editor.py +0 -122
- deer_agent_framework-0.1a4/deer/tools/builtin/xml_editor.py +0 -126
- deer_agent_framework-0.1a4/deer/tools/builtin/yaml_editor.py +0 -150
- deer_agent_framework-0.1a4/deer/tools/presets.py +0 -71
- deer_agent_framework-0.1a4/deer/tools/registry.py +0 -115
- deer_agent_framework-0.1a4/deer/tracing/__init__.py +0 -2
- deer_agent_framework-0.1a4/deer/tracing/logging_config.py +0 -20
- deer_agent_framework-0.1a4/deer/tracing/store.py +0 -21
- deer_agent_framework-0.1a4/deer/utils/console.py +0 -11
- deer_agent_framework-0.1a4/deer/validator/__init__.py +0 -1
- deer_agent_framework-0.1a4/deer/validator/plan_validator.py +0 -23
- deer_agent_framework-0.1a4/deer/validator/rules.py +0 -98
- deer_agent_framework-0.1a4/deer_agent_framework.egg-info/PKG-INFO +0 -198
- deer_agent_framework-0.1a4/deer_agent_framework.egg-info/SOURCES.txt +0 -72
- deer_agent_framework-0.1a4/deer_agent_framework.egg-info/entry_points.txt +0 -2
- deer_agent_framework-0.1a4/tests/test_plan_validator.py +0 -62
- deer_agent_framework-0.1a4/tests/test_python_editor.py +0 -68
- {deer_agent_framework-0.1a4 → deer_agent_framework-0.2.3}/LICENSE +0 -0
- {deer_agent_framework-0.1a4 → deer_agent_framework-0.2.3}/deer/core/__init__.py +0 -0
- {deer_agent_framework-0.1a4 → deer_agent_framework-0.2.3}/deer/tools/base.py +0 -0
- {deer_agent_framework-0.1a4 → deer_agent_framework-0.2.3}/deer/utils/__init__.py +0 -0
- {deer_agent_framework-0.1a4 → deer_agent_framework-0.2.3}/deer/utils/plots/__init__.py +0 -0
- {deer_agent_framework-0.1a4 → deer_agent_framework-0.2.3}/deer_agent_framework.egg-info/dependency_links.txt +0 -0
- {deer_agent_framework-0.1a4 → deer_agent_framework-0.2.3}/deer_agent_framework.egg-info/top_level.txt +0 -0
- {deer_agent_framework-0.1a4 → deer_agent_framework-0.2.3}/setup.cfg +0 -0
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: deer-agent-framework
|
|
3
|
+
Version: 0.2.3
|
|
4
|
+
Summary: DEER - Deterministic Executable Engine for Runtime-agents
|
|
5
|
+
Author: Yeison
|
|
6
|
+
License: BSD-2-Clause
|
|
7
|
+
Classifier: Development Status :: 3 - Alpha
|
|
8
|
+
Classifier: Environment :: Console
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Intended Audience :: Science/Research
|
|
11
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
12
|
+
Classifier: Natural Language :: English
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
18
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
19
|
+
Requires-Python: >=3.12
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: pydantic>=2.0
|
|
23
|
+
Requires-Dist: rich>=15.0.0
|
|
24
|
+
Requires-Dist: prompt_toolkit>=3.0.52
|
|
25
|
+
Requires-Dist: libcst>=1.8.6
|
|
26
|
+
Requires-Dist: tomlkit>=0.15.0
|
|
27
|
+
Requires-Dist: ruamel.yaml>=0.19.1
|
|
28
|
+
Requires-Dist: lxml>=6.1.1
|
|
29
|
+
Requires-Dist: chromadb>=1.5.9
|
|
30
|
+
Provides-Extra: debug
|
|
31
|
+
Requires-Dist: matplotlib>=3.10.9; extra == "debug"
|
|
32
|
+
Requires-Dist: pandas>=3.0.3; extra == "debug"
|
|
33
|
+
Requires-Dist: pytest>=9.0.3; extra == "debug"
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
|
|
36
|
+
# DEER: Deterministic Executable Engine for Runtime Agents
|
|
37
|
+
|
|
38
|
+
### **Stop building "Vibe-based" Agents. Start Engineering Deterministic Systems.**
|
|
39
|
+
|
|
40
|
+
**DEER** is a professional-grade framework designed to transform LLMs from probabilistic text-generators into
|
|
41
|
+
**Deterministic Autonomous Engineers**. While other frameworks rely on massive, fragile system prompts and hope for the
|
|
42
|
+
best, DEER subordinates the LLM to a rigid, code-defined execution pipeline where every action is typed, validated, and
|
|
43
|
+
physically verified.
|
|
44
|
+
|
|
45
|
+

|
|
46
|
+

|
|
47
|
+

|
|
48
|
+

|
|
49
|
+

|
|
50
|
+

|
|
51
|
+

|
|
52
|
+

|
|
53
|
+

|
|
54
|
+

|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Why DEER?
|
|
59
|
+
|
|
60
|
+
* **Execution over Prompts:** Behavior is defined by a rigid pipeline of validated tool calls, not by massive, fragile
|
|
61
|
+
text prompts.
|
|
62
|
+
* **Typed Contracts:** Every tool uses Pydantic models for input and output, ensuring zero hallucinated arguments.
|
|
63
|
+
* **Multi-Layered Security:** Combines a filesystem jail with an AST-whitelist sandbox to block dangerous code
|
|
64
|
+
injection.
|
|
65
|
+
* **Evidence-Based Verification:** The agent doesn't just "claim" success; it executes a separate verification plan to
|
|
66
|
+
physically prove the goal was achieved.
|
|
67
|
+
|
|
68
|
+
DEER decouples an agent's **Identity** from its **Capabilities**. You do not change a prompt to give an agent new
|
|
69
|
+
powers; you extend its `ToolRegistry` or enrich its `VectorMemory`. This transforms the agent's evolution from a
|
|
70
|
+
probabilistic exercise in prompt engineering into a programmatic and traceable process.
|
|
71
|
+
|
|
72
|
+
* **Execution over Prompts:** Behavior is governed by a rigid pipeline of validated tool calls, not by massive, fragile
|
|
73
|
+
system prompts. The agent's logic is subordinate to the code.
|
|
74
|
+
* **Surgical Precision:** Unlike agents that overwrite files or use fragile regex, DEER employs Concrete Syntax Tree
|
|
75
|
+
(CST) transformations. This allows the agent to perform semantic surgery—updating functions and refactoring
|
|
76
|
+
classes—while preserving the original code's integrity.
|
|
77
|
+
* **Strict Typed Contracts:** Every tool is governed by Pydantic models for both input and output. This eliminates
|
|
78
|
+
hallucinated arguments and ensures that data flowing between tools is always valid.
|
|
79
|
+
* **Principle of Least Privilege:** Security is implemented at the tool level. Through specialized runners, an agent's
|
|
80
|
+
access is scoped to its role (e.g., a Developer cannot execute system-level chmod commands), combining a filesystem
|
|
81
|
+
jail with a strict binary allow-list.
|
|
82
|
+
* **Evidence-Based Verification:** DEER eliminates "hallucinated success." The agent does not simply claim a goal is
|
|
83
|
+
achieved; it must execute a separate, read-only verification plan to physically prove the result.
|
|
84
|
+
|
|
85
|
+
> **No Arbitrary Execution**
|
|
86
|
+
> DEER strictly forbids the execution of raw, LLM-generated code. An agent's capabilities are defined programmatically
|
|
87
|
+
> through its `ToolRegistry`. If a capability is not explicitly defined as a typed Tool, it does not exist for the
|
|
88
|
+
> agent.
|
|
89
|
+
> This ensures that the model can only interact with the world through secure, validated, and audited interfaces.
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## The DEER Workflow: Architecting Deterministic Agents
|
|
94
|
+
|
|
95
|
+
DEER decouples an agent's reasoning from its capabilities. You do not build an agent by writing a massive prompt; you
|
|
96
|
+
architect it by assembling three core pillars: **Identity**, **Capabilities**, and **Knowledge**.
|
|
97
|
+
|
|
98
|
+
### 1. Assembling the Agent's Core
|
|
99
|
+
|
|
100
|
+
The agent is initialized by combining a driver (reasoning engine), a memory system (long-term knowledge), and a tool
|
|
101
|
+
registry (operational capabilities). This ensures the agent's behavior is a result of its configured infrastructure, not
|
|
102
|
+
probabilistic luck.
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
from pathlib import Path
|
|
106
|
+
from deer.core.agent import DeterministicAgent
|
|
107
|
+
from deer.memory import VectorMemory
|
|
108
|
+
from deer.drivers import OllamaDriver
|
|
109
|
+
from deer.tools import ToolRegistry
|
|
110
|
+
from deer.tools.presets import Preset
|
|
111
|
+
|
|
112
|
+
# Infrastructure
|
|
113
|
+
driver = OllamaDriver(model_name="llama3")
|
|
114
|
+
memory = VectorMemory(path="./agent_memory")
|
|
115
|
+
registry = ToolRegistry(Preset.CODE_REPAIR | Preset.CODE_EDITOR | Preset.DATA_ANALYST)
|
|
116
|
+
|
|
117
|
+
agent = DeterministicAgent(
|
|
118
|
+
description="Python Architecture Specialist",
|
|
119
|
+
identity=(
|
|
120
|
+
"You are a Principal Python Architect. You possess authoritative expertise "
|
|
121
|
+
"in advanced module resolution and dependency management."
|
|
122
|
+
),
|
|
123
|
+
driver=driver,
|
|
124
|
+
memory=memory,
|
|
125
|
+
tool_registry=registry,
|
|
126
|
+
jail_path=Path.cwd() / "sandbox",
|
|
127
|
+
max_attempts=5,
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
if __name__ == "__main__":
|
|
131
|
+
# Run a deterministic goal
|
|
132
|
+
result = agent.run("Create a project structure for a data processor")
|
|
133
|
+
print(result)
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### 2. Extending Capabilities via Tool Registries
|
|
137
|
+
|
|
138
|
+
Capabilities are modular. You can extend an agent's reach by registering specialized tool providers. This allows you to
|
|
139
|
+
scale an agent's power from basic file operations to complex system management without altering the core agent logic.
|
|
140
|
+
|
|
141
|
+
```python
|
|
142
|
+
from deer.tools.registry import ToolRegistry
|
|
143
|
+
from deer.tools.providers import FileManager, GitManager, CodeSearcher
|
|
144
|
+
|
|
145
|
+
tool_registry = ToolRegistry({FileManager | GitManager | CodeSearcher})
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### 3. Defining Custom Deterministic Logic
|
|
150
|
+
|
|
151
|
+
The framework is an open canvas. You can define entirely new capabilities by inheriting from `ToolProvider`. By using
|
|
152
|
+
Pydantic-style return types and strict type hints, you ensure that the agent's interactions with the external world are
|
|
153
|
+
typed, validated, and predictable.
|
|
154
|
+
|
|
155
|
+
```python
|
|
156
|
+
from deer.tools import ToolProvider, tool
|
|
157
|
+
from deer.tools.schemas import Return
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
class MyCustomProvider(ToolProvider):
|
|
161
|
+
@tool(modifies_state=True)
|
|
162
|
+
def deploy_module(self, name: str, version: str) -> Return(status=str, job_id=int):
|
|
163
|
+
"""Deploys a specific python module to the internal repo."""
|
|
164
|
+
# Implement the deterministic execution logic here
|
|
165
|
+
return {"status": "success", "job_id": 12345}
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Built-in Deterministic Agents
|
|
172
|
+
|
|
173
|
+
The framework includes pre-configured **Deterministic Agents** in the `deer/builtins/` directory. These serve as both
|
|
174
|
+
ready-to-use tools and reference implementations for building your own specialized architects and managers.
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Technical Differentiation
|
|
179
|
+
|
|
180
|
+
| Feature | Traditional Frameworks (LangChain, etc.) | **DEER Deterministic Agents** |
|
|
181
|
+
|:----------------------|:-----------------------------------------|:-------------------------------------------------|
|
|
182
|
+
| **Execution Flow** | Probabilistic (LLM decides next step) | **Deterministic** (Plan-Validate-Execute-Verify) |
|
|
183
|
+
| **Tool Arguments** | Often Hallucinated | **Strictly Typed** (Pydantic Models) |
|
|
184
|
+
| **Code Modification** | Text-based / Full-file Overwrites | **Surgical CST Transformation** (Semantic Edits) |
|
|
185
|
+
| **Impact Analysis** | Grep-based / None | **Semantic Dependency Mapping** |
|
|
186
|
+
| **Security** | None / Manual | **Built-in Jail + AST-Whitelist Sandbox** |
|
|
187
|
+
| **Debugging** | Black box / Tricky logs | **Step-by-Step Execution Trace Replay** |
|
|
188
|
+
| **Output** | Raw Text | **Validated & Humanized Synthesis** |
|
|
189
|
+
| **Memory** | Static Window / Basic RAG | **Adaptive** (Popularity-Aware & Auto-Pruning) |
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## The "Assembly Line" Lifecycle
|
|
194
|
+
|
|
195
|
+
A **Deterministic Agent** in DEER does not "guess" its way to a solution. It processes every request through a linear,
|
|
196
|
+
audited production line:
|
|
197
|
+
|
|
198
|
+
1. **Contextual Grounding:** The agent queries the popularity-aware vector memory to retrieve the most relevant domain
|
|
199
|
+
knowledge and architectural constraints.
|
|
200
|
+
1. **Deterministic Planning:** A structured JSON pipeline is generated. This is not a suggestion, but a strict sequence
|
|
201
|
+
of tool
|
|
202
|
+
calls with explicitly defined expected return types.
|
|
203
|
+
1. **Static Audit:** The `PlanValidator` audits the pipeline for type-safety, reference integrity, and security
|
|
204
|
+
compliance before
|
|
205
|
+
a single line of code is executed.
|
|
206
|
+
1. **Surgical Execution:** Tools are executed within a secure, isolated jail. Whether performing a CST-based code
|
|
207
|
+
transformation or a system-level mutation, every action is routed through a validated `ToolProvider`.
|
|
208
|
+
1. **Physical Evidence Verification:** To eliminate "hallucinated success," a separate, read-only verification plan is
|
|
209
|
+
executed. The agent must physically prove the goal was achieved (e.g., by verifying the file exists or the process is
|
|
210
|
+
running).
|
|
211
|
+
1. **Professional Synthesis:** The complete `ExecutionTrace` is analyzed to provide a final, human-readable conclusion,
|
|
212
|
+
backed by
|
|
213
|
+
the evidence gathered during the verification phase.
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## Installation
|
|
218
|
+
|
|
219
|
+
From PyPI:
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
pip install deer-agent-framework
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
From GitHub (development version):
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
pip install git+https://github.com/dunderlab/deer-agent-framework.git
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
*Requires Python 3.12+ and a valid LLM API Key (Gemini, Ollama, etc.).*
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## License
|
|
236
|
+
|
|
237
|
+
Licensed under the **BSD 2-Clause License**. See [LICENSE](LICENSE) for details.
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
**Built for developers who trust code, not prompts.**
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# DEER: Deterministic Executable Engine for Runtime Agents
|
|
2
|
+
|
|
3
|
+
### **Stop building "Vibe-based" Agents. Start Engineering Deterministic Systems.**
|
|
4
|
+
|
|
5
|
+
**DEER** is a professional-grade framework designed to transform LLMs from probabilistic text-generators into
|
|
6
|
+
**Deterministic Autonomous Engineers**. While other frameworks rely on massive, fragile system prompts and hope for the
|
|
7
|
+
best, DEER subordinates the LLM to a rigid, code-defined execution pipeline where every action is typed, validated, and
|
|
8
|
+
physically verified.
|
|
9
|
+
|
|
10
|
+

|
|
11
|
+

|
|
12
|
+

|
|
13
|
+

|
|
14
|
+

|
|
15
|
+

|
|
16
|
+

|
|
17
|
+

|
|
18
|
+

|
|
19
|
+

|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Why DEER?
|
|
24
|
+
|
|
25
|
+
* **Execution over Prompts:** Behavior is defined by a rigid pipeline of validated tool calls, not by massive, fragile
|
|
26
|
+
text prompts.
|
|
27
|
+
* **Typed Contracts:** Every tool uses Pydantic models for input and output, ensuring zero hallucinated arguments.
|
|
28
|
+
* **Multi-Layered Security:** Combines a filesystem jail with an AST-whitelist sandbox to block dangerous code
|
|
29
|
+
injection.
|
|
30
|
+
* **Evidence-Based Verification:** The agent doesn't just "claim" success; it executes a separate verification plan to
|
|
31
|
+
physically prove the goal was achieved.
|
|
32
|
+
|
|
33
|
+
DEER decouples an agent's **Identity** from its **Capabilities**. You do not change a prompt to give an agent new
|
|
34
|
+
powers; you extend its `ToolRegistry` or enrich its `VectorMemory`. This transforms the agent's evolution from a
|
|
35
|
+
probabilistic exercise in prompt engineering into a programmatic and traceable process.
|
|
36
|
+
|
|
37
|
+
* **Execution over Prompts:** Behavior is governed by a rigid pipeline of validated tool calls, not by massive, fragile
|
|
38
|
+
system prompts. The agent's logic is subordinate to the code.
|
|
39
|
+
* **Surgical Precision:** Unlike agents that overwrite files or use fragile regex, DEER employs Concrete Syntax Tree
|
|
40
|
+
(CST) transformations. This allows the agent to perform semantic surgery—updating functions and refactoring
|
|
41
|
+
classes—while preserving the original code's integrity.
|
|
42
|
+
* **Strict Typed Contracts:** Every tool is governed by Pydantic models for both input and output. This eliminates
|
|
43
|
+
hallucinated arguments and ensures that data flowing between tools is always valid.
|
|
44
|
+
* **Principle of Least Privilege:** Security is implemented at the tool level. Through specialized runners, an agent's
|
|
45
|
+
access is scoped to its role (e.g., a Developer cannot execute system-level chmod commands), combining a filesystem
|
|
46
|
+
jail with a strict binary allow-list.
|
|
47
|
+
* **Evidence-Based Verification:** DEER eliminates "hallucinated success." The agent does not simply claim a goal is
|
|
48
|
+
achieved; it must execute a separate, read-only verification plan to physically prove the result.
|
|
49
|
+
|
|
50
|
+
> **No Arbitrary Execution**
|
|
51
|
+
> DEER strictly forbids the execution of raw, LLM-generated code. An agent's capabilities are defined programmatically
|
|
52
|
+
> through its `ToolRegistry`. If a capability is not explicitly defined as a typed Tool, it does not exist for the
|
|
53
|
+
> agent.
|
|
54
|
+
> This ensures that the model can only interact with the world through secure, validated, and audited interfaces.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## The DEER Workflow: Architecting Deterministic Agents
|
|
59
|
+
|
|
60
|
+
DEER decouples an agent's reasoning from its capabilities. You do not build an agent by writing a massive prompt; you
|
|
61
|
+
architect it by assembling three core pillars: **Identity**, **Capabilities**, and **Knowledge**.
|
|
62
|
+
|
|
63
|
+
### 1. Assembling the Agent's Core
|
|
64
|
+
|
|
65
|
+
The agent is initialized by combining a driver (reasoning engine), a memory system (long-term knowledge), and a tool
|
|
66
|
+
registry (operational capabilities). This ensures the agent's behavior is a result of its configured infrastructure, not
|
|
67
|
+
probabilistic luck.
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
from pathlib import Path
|
|
71
|
+
from deer.core.agent import DeterministicAgent
|
|
72
|
+
from deer.memory import VectorMemory
|
|
73
|
+
from deer.drivers import OllamaDriver
|
|
74
|
+
from deer.tools import ToolRegistry
|
|
75
|
+
from deer.tools.presets import Preset
|
|
76
|
+
|
|
77
|
+
# Infrastructure
|
|
78
|
+
driver = OllamaDriver(model_name="llama3")
|
|
79
|
+
memory = VectorMemory(path="./agent_memory")
|
|
80
|
+
registry = ToolRegistry(Preset.CODE_REPAIR | Preset.CODE_EDITOR | Preset.DATA_ANALYST)
|
|
81
|
+
|
|
82
|
+
agent = DeterministicAgent(
|
|
83
|
+
description="Python Architecture Specialist",
|
|
84
|
+
identity=(
|
|
85
|
+
"You are a Principal Python Architect. You possess authoritative expertise "
|
|
86
|
+
"in advanced module resolution and dependency management."
|
|
87
|
+
),
|
|
88
|
+
driver=driver,
|
|
89
|
+
memory=memory,
|
|
90
|
+
tool_registry=registry,
|
|
91
|
+
jail_path=Path.cwd() / "sandbox",
|
|
92
|
+
max_attempts=5,
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
if __name__ == "__main__":
|
|
96
|
+
# Run a deterministic goal
|
|
97
|
+
result = agent.run("Create a project structure for a data processor")
|
|
98
|
+
print(result)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### 2. Extending Capabilities via Tool Registries
|
|
102
|
+
|
|
103
|
+
Capabilities are modular. You can extend an agent's reach by registering specialized tool providers. This allows you to
|
|
104
|
+
scale an agent's power from basic file operations to complex system management without altering the core agent logic.
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
from deer.tools.registry import ToolRegistry
|
|
108
|
+
from deer.tools.providers import FileManager, GitManager, CodeSearcher
|
|
109
|
+
|
|
110
|
+
tool_registry = ToolRegistry({FileManager | GitManager | CodeSearcher})
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### 3. Defining Custom Deterministic Logic
|
|
115
|
+
|
|
116
|
+
The framework is an open canvas. You can define entirely new capabilities by inheriting from `ToolProvider`. By using
|
|
117
|
+
Pydantic-style return types and strict type hints, you ensure that the agent's interactions with the external world are
|
|
118
|
+
typed, validated, and predictable.
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
from deer.tools import ToolProvider, tool
|
|
122
|
+
from deer.tools.schemas import Return
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
class MyCustomProvider(ToolProvider):
|
|
126
|
+
@tool(modifies_state=True)
|
|
127
|
+
def deploy_module(self, name: str, version: str) -> Return(status=str, job_id=int):
|
|
128
|
+
"""Deploys a specific python module to the internal repo."""
|
|
129
|
+
# Implement the deterministic execution logic here
|
|
130
|
+
return {"status": "success", "job_id": 12345}
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Built-in Deterministic Agents
|
|
137
|
+
|
|
138
|
+
The framework includes pre-configured **Deterministic Agents** in the `deer/builtins/` directory. These serve as both
|
|
139
|
+
ready-to-use tools and reference implementations for building your own specialized architects and managers.
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Technical Differentiation
|
|
144
|
+
|
|
145
|
+
| Feature | Traditional Frameworks (LangChain, etc.) | **DEER Deterministic Agents** |
|
|
146
|
+
|:----------------------|:-----------------------------------------|:-------------------------------------------------|
|
|
147
|
+
| **Execution Flow** | Probabilistic (LLM decides next step) | **Deterministic** (Plan-Validate-Execute-Verify) |
|
|
148
|
+
| **Tool Arguments** | Often Hallucinated | **Strictly Typed** (Pydantic Models) |
|
|
149
|
+
| **Code Modification** | Text-based / Full-file Overwrites | **Surgical CST Transformation** (Semantic Edits) |
|
|
150
|
+
| **Impact Analysis** | Grep-based / None | **Semantic Dependency Mapping** |
|
|
151
|
+
| **Security** | None / Manual | **Built-in Jail + AST-Whitelist Sandbox** |
|
|
152
|
+
| **Debugging** | Black box / Tricky logs | **Step-by-Step Execution Trace Replay** |
|
|
153
|
+
| **Output** | Raw Text | **Validated & Humanized Synthesis** |
|
|
154
|
+
| **Memory** | Static Window / Basic RAG | **Adaptive** (Popularity-Aware & Auto-Pruning) |
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## The "Assembly Line" Lifecycle
|
|
159
|
+
|
|
160
|
+
A **Deterministic Agent** in DEER does not "guess" its way to a solution. It processes every request through a linear,
|
|
161
|
+
audited production line:
|
|
162
|
+
|
|
163
|
+
1. **Contextual Grounding:** The agent queries the popularity-aware vector memory to retrieve the most relevant domain
|
|
164
|
+
knowledge and architectural constraints.
|
|
165
|
+
1. **Deterministic Planning:** A structured JSON pipeline is generated. This is not a suggestion, but a strict sequence
|
|
166
|
+
of tool
|
|
167
|
+
calls with explicitly defined expected return types.
|
|
168
|
+
1. **Static Audit:** The `PlanValidator` audits the pipeline for type-safety, reference integrity, and security
|
|
169
|
+
compliance before
|
|
170
|
+
a single line of code is executed.
|
|
171
|
+
1. **Surgical Execution:** Tools are executed within a secure, isolated jail. Whether performing a CST-based code
|
|
172
|
+
transformation or a system-level mutation, every action is routed through a validated `ToolProvider`.
|
|
173
|
+
1. **Physical Evidence Verification:** To eliminate "hallucinated success," a separate, read-only verification plan is
|
|
174
|
+
executed. The agent must physically prove the goal was achieved (e.g., by verifying the file exists or the process is
|
|
175
|
+
running).
|
|
176
|
+
1. **Professional Synthesis:** The complete `ExecutionTrace` is analyzed to provide a final, human-readable conclusion,
|
|
177
|
+
backed by
|
|
178
|
+
the evidence gathered during the verification phase.
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## Installation
|
|
183
|
+
|
|
184
|
+
From PyPI:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
pip install deer-agent-framework
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
From GitHub (development version):
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
pip install git+https://github.com/dunderlab/deer-agent-framework.git
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
*Requires Python 3.12+ and a valid LLM API Key (Gemini, Ollama, etc.).*
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## License
|
|
201
|
+
|
|
202
|
+
Licensed under the **BSD 2-Clause License**. See [LICENSE](LICENSE) for details.
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
**Built for developers who trust code, not prompts.**
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
from deer import DeterministicAgent
|
|
2
|
+
from deer.cli import AgentREPL, get_path_from_parser, get_driver_from_parser
|
|
3
|
+
from deer.tools import ToolRegistry
|
|
4
|
+
from deer.tools.presets import Preset
|
|
5
|
+
from deer.tools.providers import HTTPClient
|
|
6
|
+
from deer.drivers import OllamaDriver
|
|
7
|
+
from deer.memory import VectorMemory
|
|
8
|
+
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
# Infrastructure
|
|
12
|
+
driver = get_driver_from_parser() or OllamaDriver(model_name="gemma4:31b-cloud")
|
|
13
|
+
memory = VectorMemory(path=Path.home() / "deer_os_sandbox" / ".deer" / "vector_db")
|
|
14
|
+
registry = ToolRegistry(Preset.SYSTEM_ADMIN | {HTTPClient})
|
|
15
|
+
working_dir = get_path_from_parser() or Path.cwd()
|
|
16
|
+
|
|
17
|
+
agent = DeterministicAgent(
|
|
18
|
+
description="Advanced OS Agent for secure system management.",
|
|
19
|
+
identity=(
|
|
20
|
+
"You are a capable Operating System Agent. "
|
|
21
|
+
"Your goal is to assist the user by managing the system, executing tasks, and solving problems efficiently. "
|
|
22
|
+
"You act as a direct interface to the OS, balancing helpfulness with a strict commitment to security: "
|
|
23
|
+
"never perform destructive actions without confirmation and always stay within your designated boundaries."
|
|
24
|
+
),
|
|
25
|
+
driver=driver,
|
|
26
|
+
tool_registry=registry,
|
|
27
|
+
vector_memory=memory,
|
|
28
|
+
working_dir=working_dir,
|
|
29
|
+
max_attempts=3,
|
|
30
|
+
enable_verification=False,
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def main():
|
|
35
|
+
repl = AgentREPL(agent)
|
|
36
|
+
repl.repl()
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
if __name__ == "__main__":
|
|
40
|
+
main()
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from deer import DeterministicAgent
|
|
2
|
+
from deer.cli import AgentREPL, get_path_from_parser, get_driver_from_parser
|
|
3
|
+
from deer.tools import ToolRegistry
|
|
4
|
+
from deer.tools.presets import Preset
|
|
5
|
+
from deer.tools.providers import HTTPClient, SystemObserver
|
|
6
|
+
from deer.drivers import OllamaDriver
|
|
7
|
+
from deer.memory import VectorMemory
|
|
8
|
+
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
# Infrastructure
|
|
12
|
+
driver = get_driver_from_parser() or OllamaDriver(model_name="gemma4:31b-cloud")
|
|
13
|
+
memory = VectorMemory(path=Path.cwd() / ".deer" / "vector_db")
|
|
14
|
+
registry = ToolRegistry(
|
|
15
|
+
Preset.CODE_REPAIR
|
|
16
|
+
| Preset.CODE_EDITOR
|
|
17
|
+
| Preset.DATA_ANALYST
|
|
18
|
+
| {HTTPClient, SystemObserver}
|
|
19
|
+
)
|
|
20
|
+
working_dir = get_path_from_parser() or Path.cwd()
|
|
21
|
+
|
|
22
|
+
agent = DeterministicAgent(
|
|
23
|
+
description="AI specialist in Python architecture, runtime module resolution, and dependency management.",
|
|
24
|
+
identity=(
|
|
25
|
+
"You are an elite AI Agent operating as a Principal Python Architect and Core Ecosystem Specialist. "
|
|
26
|
+
"You provide authoritative, deterministic guidance on advanced module resolution, runtime execution, "
|
|
27
|
+
"dependency isolation, and package distribution. Your expertise spans the entire Python lifecycle: "
|
|
28
|
+
"from engineering scalable code structures to resolving complex import mechanisms and optimizing "
|
|
29
|
+
"deployment pipelines across public or internal repositories."
|
|
30
|
+
),
|
|
31
|
+
driver=driver,
|
|
32
|
+
tool_registry=registry,
|
|
33
|
+
vector_memory=memory,
|
|
34
|
+
working_dir=working_dir,
|
|
35
|
+
max_attempts=3,
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def main():
|
|
40
|
+
repl = AgentREPL(agent)
|
|
41
|
+
repl.repl()
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
if __name__ == "__main__":
|
|
45
|
+
main()
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import sys
|
|
2
|
-
import importlib.util
|
|
3
1
|
from rich.text import Text
|
|
2
|
+
from deer.utils.console import console, error, info
|
|
3
|
+
from deer.builtins_agents import agents
|
|
4
|
+
import importlib.util
|
|
5
|
+
import sys
|
|
4
6
|
import logging
|
|
5
7
|
|
|
6
|
-
from
|
|
7
|
-
from deer.utils.console import console, error, info
|
|
8
|
-
from deer.drivers import drivers_parser
|
|
8
|
+
from .parser import drivers_parser
|
|
9
9
|
|
|
10
|
-
logger = logging.getLogger("DEER")
|
|
10
|
+
logger = logging.getLogger(f"DEER.{__name__}")
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
def title():
|
|
@@ -34,7 +34,7 @@ def agents_list():
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
def example():
|
|
37
|
-
console.print(f"[dim]Example:[/dim] deer {agents[0]}")
|
|
37
|
+
console.print(f"[dim]Example:[/dim] deer {list(agents.keys())[0]}")
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
def run_agent_in_process(agent_path, backend=None, model=None):
|