django-agent-studio 0.1.4__py3-none-any.whl → 0.1.6__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.
- django_agent_studio/agents/builder.py +144 -0
- django_agent_studio/agents/dynamic.py +15 -8
- {django_agent_studio-0.1.4.dist-info → django_agent_studio-0.1.6.dist-info}/METADATA +1 -1
- {django_agent_studio-0.1.4.dist-info → django_agent_studio-0.1.6.dist-info}/RECORD +6 -6
- {django_agent_studio-0.1.4.dist-info → django_agent_studio-0.1.6.dist-info}/WHEEL +0 -0
- {django_agent_studio-0.1.4.dist-info → django_agent_studio-0.1.6.dist-info}/top_level.txt +0 -0
|
@@ -39,6 +39,8 @@ You have access to tools that allow you to:
|
|
|
39
39
|
6. **Discover and add dynamic tools** from the Django project codebase
|
|
40
40
|
7. **Create multi-agent systems** by adding sub-agent tools
|
|
41
41
|
8. **Switch between agents and systems** in the UI
|
|
42
|
+
9. **Configure agent memory** (enable/disable the remember tool)
|
|
43
|
+
10. **Manage agent specifications** (human-readable behavior descriptions)
|
|
42
44
|
|
|
43
45
|
## IMPORTANT: Tool Usage
|
|
44
46
|
|
|
@@ -95,6 +97,48 @@ You can control the builder UI to switch between different agents and systems:
|
|
|
95
97
|
When the user asks to work on a different agent or system, use these tools to switch context.
|
|
96
98
|
The UI will automatically update to show the selected agent/system.
|
|
97
99
|
|
|
100
|
+
## Agent Memory
|
|
101
|
+
|
|
102
|
+
Agents have a built-in memory system that allows them to remember facts about users across conversations:
|
|
103
|
+
- Memory is **enabled by default** for all agents
|
|
104
|
+
- When enabled, the agent has a `remember` tool it can use to store key-value facts
|
|
105
|
+
- Memories are scoped per-user and per-conversation
|
|
106
|
+
- Memory only works for **authenticated users** (not anonymous visitors)
|
|
107
|
+
- Use `get_memory_status` to check if memory is enabled
|
|
108
|
+
- Use `set_memory_enabled` to enable or disable memory
|
|
109
|
+
|
|
110
|
+
**When to disable memory:**
|
|
111
|
+
- Public-facing agents where you don't want user data stored
|
|
112
|
+
- Simple Q&A agents that don't need personalization
|
|
113
|
+
- Agents handling sensitive information that shouldn't be persisted
|
|
114
|
+
|
|
115
|
+
**When to keep memory enabled (default):**
|
|
116
|
+
- Personal assistants that should remember user preferences
|
|
117
|
+
- Support agents that benefit from knowing user history
|
|
118
|
+
- Any agent where personalization improves the experience
|
|
119
|
+
|
|
120
|
+
## Agent Specification (Spec)
|
|
121
|
+
|
|
122
|
+
Every agent can have a **spec** - a human-readable description of its intended behavior, separate from the technical system prompt.
|
|
123
|
+
|
|
124
|
+
**Why use a spec?**
|
|
125
|
+
- **Human oversight**: Non-technical stakeholders can review and approve agent behavior
|
|
126
|
+
- **Documentation**: Clear record of what the agent should and shouldn't do
|
|
127
|
+
- **Builder context**: You can reference the spec when crafting the system prompt
|
|
128
|
+
|
|
129
|
+
**What to include in a spec:**
|
|
130
|
+
- Purpose: What is this agent for?
|
|
131
|
+
- Capabilities: What can it do?
|
|
132
|
+
- Constraints: What should it NOT do?
|
|
133
|
+
- Tone/personality: How should it communicate?
|
|
134
|
+
- Edge cases: How should it handle unusual situations?
|
|
135
|
+
|
|
136
|
+
**Tools:**
|
|
137
|
+
- `get_agent_spec` - View the current spec
|
|
138
|
+
- `update_agent_spec` - Update the spec
|
|
139
|
+
|
|
140
|
+
**Best practice:** When building an agent, start by writing or reviewing the spec, then craft the system prompt to implement that spec. This ensures alignment between intended and actual behavior.
|
|
141
|
+
|
|
98
142
|
When helping users:
|
|
99
143
|
- Ask clarifying questions to understand what they want their agent to do
|
|
100
144
|
- Suggest appropriate system prompts based on the agent's purpose
|
|
@@ -211,6 +255,34 @@ BUILDER_TOOLS = [
|
|
|
211
255
|
},
|
|
212
256
|
},
|
|
213
257
|
},
|
|
258
|
+
{
|
|
259
|
+
"type": "function",
|
|
260
|
+
"function": {
|
|
261
|
+
"name": "get_agent_spec",
|
|
262
|
+
"description": "Get the agent's specification - a human-readable description of the agent's intended behavior, capabilities, and constraints. The spec is separate from the technical system prompt and is meant for human oversight and documentation.",
|
|
263
|
+
"parameters": {
|
|
264
|
+
"type": "object",
|
|
265
|
+
"properties": {},
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"type": "function",
|
|
271
|
+
"function": {
|
|
272
|
+
"name": "update_agent_spec",
|
|
273
|
+
"description": "Update the agent's specification. The spec should describe in plain English: what the agent does, what it should and shouldn't do, its personality/tone, and any important constraints. This is for human oversight - non-technical stakeholders can review and edit this.",
|
|
274
|
+
"parameters": {
|
|
275
|
+
"type": "object",
|
|
276
|
+
"properties": {
|
|
277
|
+
"spec": {
|
|
278
|
+
"type": "string",
|
|
279
|
+
"description": "The agent specification in plain English. Describe the agent's purpose, capabilities, constraints, and expected behavior.",
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
"required": ["spec"],
|
|
283
|
+
},
|
|
284
|
+
},
|
|
285
|
+
},
|
|
214
286
|
{
|
|
215
287
|
"type": "function",
|
|
216
288
|
"function": {
|
|
@@ -231,6 +303,34 @@ BUILDER_TOOLS = [
|
|
|
231
303
|
},
|
|
232
304
|
},
|
|
233
305
|
},
|
|
306
|
+
{
|
|
307
|
+
"type": "function",
|
|
308
|
+
"function": {
|
|
309
|
+
"name": "set_memory_enabled",
|
|
310
|
+
"description": "Enable or disable conversation memory for the agent. When enabled (default), the agent can remember facts about users across messages using the 'remember' tool. Memory only works for authenticated users.",
|
|
311
|
+
"parameters": {
|
|
312
|
+
"type": "object",
|
|
313
|
+
"properties": {
|
|
314
|
+
"enabled": {
|
|
315
|
+
"type": "boolean",
|
|
316
|
+
"description": "Whether to enable memory. True = agent can remember facts, False = no memory.",
|
|
317
|
+
},
|
|
318
|
+
},
|
|
319
|
+
"required": ["enabled"],
|
|
320
|
+
},
|
|
321
|
+
},
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
"type": "function",
|
|
325
|
+
"function": {
|
|
326
|
+
"name": "get_memory_status",
|
|
327
|
+
"description": "Check if memory is enabled for the current agent.",
|
|
328
|
+
"parameters": {
|
|
329
|
+
"type": "object",
|
|
330
|
+
"properties": {},
|
|
331
|
+
},
|
|
332
|
+
},
|
|
333
|
+
},
|
|
234
334
|
{
|
|
235
335
|
"type": "function",
|
|
236
336
|
"function": {
|
|
@@ -894,6 +994,23 @@ Knowledge: {len(config.get('knowledge', []))} sources
|
|
|
894
994
|
await create_revision(agent, comment=f"Renamed from '{old_name}' to '{agent.name}'")
|
|
895
995
|
return {"success": True, "message": "Agent name updated"}
|
|
896
996
|
|
|
997
|
+
elif tool_name == "get_agent_spec":
|
|
998
|
+
return {
|
|
999
|
+
"spec": agent.spec or "",
|
|
1000
|
+
"has_spec": bool(agent.spec),
|
|
1001
|
+
"message": "The agent spec describes intended behavior in plain English, separate from the technical system prompt.",
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
elif tool_name == "update_agent_spec":
|
|
1005
|
+
agent.spec = args["spec"]
|
|
1006
|
+
await sync_to_async(agent.save)()
|
|
1007
|
+
await create_revision(agent, comment="Updated agent specification")
|
|
1008
|
+
return {
|
|
1009
|
+
"success": True,
|
|
1010
|
+
"message": "Agent specification updated",
|
|
1011
|
+
"spec_preview": agent.spec[:200] + "..." if len(agent.spec) > 200 else agent.spec,
|
|
1012
|
+
}
|
|
1013
|
+
|
|
897
1014
|
elif tool_name == "update_model_settings":
|
|
898
1015
|
if version:
|
|
899
1016
|
changes = []
|
|
@@ -908,6 +1025,33 @@ Knowledge: {len(config.get('knowledge', []))} sources
|
|
|
908
1025
|
return {"success": True, "message": "Model settings updated"}
|
|
909
1026
|
return {"error": "No active version found"}
|
|
910
1027
|
|
|
1028
|
+
elif tool_name == "set_memory_enabled":
|
|
1029
|
+
if version:
|
|
1030
|
+
enabled = args.get("enabled", True)
|
|
1031
|
+
if version.extra_config is None:
|
|
1032
|
+
version.extra_config = {}
|
|
1033
|
+
version.extra_config["memory_enabled"] = enabled
|
|
1034
|
+
await sync_to_async(version.save)()
|
|
1035
|
+
status = "enabled" if enabled else "disabled"
|
|
1036
|
+
await create_revision(agent, comment=f"Memory {status}")
|
|
1037
|
+
return {
|
|
1038
|
+
"success": True,
|
|
1039
|
+
"message": f"Memory {status} for this agent",
|
|
1040
|
+
"memory_enabled": enabled,
|
|
1041
|
+
}
|
|
1042
|
+
return {"error": "No active version found"}
|
|
1043
|
+
|
|
1044
|
+
elif tool_name == "get_memory_status":
|
|
1045
|
+
if version:
|
|
1046
|
+
extra = version.extra_config or {}
|
|
1047
|
+
enabled = extra.get("memory_enabled", True) # Default is True
|
|
1048
|
+
return {
|
|
1049
|
+
"memory_enabled": enabled,
|
|
1050
|
+
"message": f"Memory is {'enabled' if enabled else 'disabled'} for this agent",
|
|
1051
|
+
"note": "When enabled, the agent has a 'remember' tool to store facts about users. Memory only works for authenticated users.",
|
|
1052
|
+
}
|
|
1053
|
+
return {"error": "No active version found"}
|
|
1054
|
+
|
|
911
1055
|
elif tool_name == "add_knowledge":
|
|
912
1056
|
inclusion_mode = args.get("inclusion_mode", "always")
|
|
913
1057
|
knowledge = await sync_to_async(AgentKnowledge.objects.create)(
|
|
@@ -92,6 +92,10 @@ class DynamicAgentRuntime(AgentRuntime):
|
|
|
92
92
|
"""Execute the agent with the dynamic configuration and agentic loop."""
|
|
93
93
|
config = self.config
|
|
94
94
|
|
|
95
|
+
# Check if memory is enabled (default: True)
|
|
96
|
+
extra_config = config.get("extra", {})
|
|
97
|
+
memory_enabled = extra_config.get("memory_enabled", True)
|
|
98
|
+
|
|
95
99
|
# Build the messages list
|
|
96
100
|
messages = []
|
|
97
101
|
|
|
@@ -108,12 +112,14 @@ class DynamicAgentRuntime(AgentRuntime):
|
|
|
108
112
|
if rag_context:
|
|
109
113
|
system_prompt = f"{system_prompt}\n\n{rag_context}"
|
|
110
114
|
|
|
111
|
-
# Add conversation memories (if
|
|
112
|
-
memory_store =
|
|
113
|
-
if
|
|
114
|
-
|
|
115
|
-
if
|
|
116
|
-
|
|
115
|
+
# Add conversation memories (if memory is enabled and we have context)
|
|
116
|
+
memory_store = None
|
|
117
|
+
if memory_enabled:
|
|
118
|
+
memory_store = await self._get_memory_store(ctx)
|
|
119
|
+
if memory_store:
|
|
120
|
+
memory_context = await self._recall_memories(memory_store)
|
|
121
|
+
if memory_context:
|
|
122
|
+
system_prompt = f"{system_prompt}\n\n{memory_context}"
|
|
117
123
|
|
|
118
124
|
if system_prompt:
|
|
119
125
|
messages.append({"role": "system", "content": system_prompt})
|
|
@@ -121,9 +127,10 @@ class DynamicAgentRuntime(AgentRuntime):
|
|
|
121
127
|
# Add conversation history
|
|
122
128
|
messages.extend(ctx.input_messages)
|
|
123
129
|
|
|
124
|
-
# Build tool schemas - include memory tool
|
|
130
|
+
# Build tool schemas - include memory tool only if memory is enabled
|
|
125
131
|
tools = self._build_tool_schemas(config)
|
|
126
|
-
|
|
132
|
+
if memory_enabled:
|
|
133
|
+
tools.append(MEMORY_TOOL_SCHEMA)
|
|
127
134
|
|
|
128
135
|
tool_map = self._build_tool_map(config) # Maps tool name to execution info
|
|
129
136
|
|
|
@@ -3,8 +3,8 @@ django_agent_studio/apps.py,sha256=L89QWn4XOvPBs2z6qHAhaE4uZQpasJntYD75aSd2p_k,6
|
|
|
3
3
|
django_agent_studio/urls.py,sha256=O_rrobaxpmg8gR0JmeUzQ0TI3E8mGdcz27p4OJlcI8s,743
|
|
4
4
|
django_agent_studio/views.py,sha256=bQxSIeL9-D4MzKwWkeHEFXrzo1CD911qicrt_A8t_6M,3153
|
|
5
5
|
django_agent_studio/agents/__init__.py,sha256=VYL_ato0DtggIo4BGRkyiz9cm1ARPXhhTQFzoG__NVM,800
|
|
6
|
-
django_agent_studio/agents/builder.py,sha256=
|
|
7
|
-
django_agent_studio/agents/dynamic.py,sha256=
|
|
6
|
+
django_agent_studio/agents/builder.py,sha256=f8BLWCheLRNhnUhU6_oDzoCba0nrWCzpz3cCYYT6eHo,83753
|
|
7
|
+
django_agent_studio/agents/dynamic.py,sha256=KhmdAHkYUdfuuBgsKeY-Sf9sjDA-QiBVWHpw0NAgPX0,13939
|
|
8
8
|
django_agent_studio/api/__init__.py,sha256=vtBwuvBENyFFhFqCWyFsI6cYu4N9ZGqSMmHIRhr9a_U,45
|
|
9
9
|
django_agent_studio/api/permissions.py,sha256=MutmA8TxZb4ZwGfeEoolK-QI04Gbcxs7DPNzkXe_Bss,5302
|
|
10
10
|
django_agent_studio/api/serializers.py,sha256=rkn9xtACbJZlCBr6TLD5r-HsE1AWlaX39WYegtwEIig,18268
|
|
@@ -26,7 +26,7 @@ django_agent_studio/templates/django_agent_studio/base.html,sha256=rpHmr7CAWGwRk
|
|
|
26
26
|
django_agent_studio/templates/django_agent_studio/builder.html,sha256=L2KX-RLVpnC2mmYsIl_aSeJIc6b63knTYVrDg8aaU1g,61425
|
|
27
27
|
django_agent_studio/templates/django_agent_studio/home.html,sha256=pgwKPjiQe9UxYYLGSsKT-6erEPDUdW9MZ5D-MOjIxK4,4385
|
|
28
28
|
django_agent_studio/templates/django_agent_studio/test.html,sha256=h9aTtTD1eYcgG-n410qMSryHdpXyKny0hjiKYAoGsic,3779
|
|
29
|
-
django_agent_studio-0.1.
|
|
30
|
-
django_agent_studio-0.1.
|
|
31
|
-
django_agent_studio-0.1.
|
|
32
|
-
django_agent_studio-0.1.
|
|
29
|
+
django_agent_studio-0.1.6.dist-info/METADATA,sha256=A3evUgzWVKgK5MtOlCRr2-9Fnl9NbTAJ96IKoTKSQpU,11294
|
|
30
|
+
django_agent_studio-0.1.6.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
31
|
+
django_agent_studio-0.1.6.dist-info/top_level.txt,sha256=O1kqZzXPOsJlqnPSAcB2fH5WpJNY8ZNfHEJzX9_SZ0A,20
|
|
32
|
+
django_agent_studio-0.1.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|