Skip to content

Agent Zero AI framework

Minify context extras

linkliti67b0bc1deaba
diff --git a/agent.py b/agent.py
index d88e681ae..8dde01f76 100644
--- a/agent.py
+++ b/agent.py
@@ -613,7 +613,7 @@ class Agent:
False,
content=self.read_prompt(
prompt_file,
- **{variable_name: dirty_json.stringify(values)},
+ **{variable_name: dirty_json.stringify(values, separators=(",", ":"))},
),
).output()
diff --git a/tests/test_prompt_protocol.py b/tests/test_prompt_protocol.py
index fcafcb7b5..a34835371 100644
--- a/tests/test_prompt_protocol.py
+++ b/tests/test_prompt_protocol.py
@@ -62,6 +62,7 @@ async def test_prepare_prompt_places_protocol_before_history_and_extras(monkeypa
assert isinstance(prompt[3], HumanMessage)
assert str(prompt[3].content).startswith("[EXTRAS]")
assert "Today." in str(prompt[3].content)
+ assert '{"current_datetime":"Today."' in str(prompt[3].content)
serialized_history = agent.history.serialize()
assert "Project rule." not in serialized_history