Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Cleanup

Tomas Valenta2c9caf4e179e
diff --git a/api-service/codegen/agent/parsing.py b/api-service/codegen/agent/parsing.py
index 9a9069b91..4d47770c3 100644
--- a/api-service/codegen/agent/parsing.py
+++ b/api-service/codegen/agent/parsing.py
@@ -36,7 +36,7 @@ def merge_logs(log: TypedDict, other: TypedDict):
log.update(other)
-action_tag_open = "<action(\\s+tool=\".+?\")?\\s*\\/?>?"
+action_tag_open = "<action(\\s+tool=\".+?\")?\\s*/?>?"
action_tag_close = "</\\s*action\\s*>?"
action_tag_split_pattern = re.compile(f"({action_tag_open}.*?{action_tag_close})|(.+)")
@@ -53,8 +53,7 @@ def parse_thoughts_and_actions(text: str):
)
root = ET.fromstring(
- # Wrapping the XML in a fully formed root tag while some inner tags can be incomplete doesn't make sense.
- f"<root>{escaped}",
+ f"<root>{escaped}</root>",
# Use Parser with C binding for libxml2+libxslt, with recovery mode that allows to parse incomplete XML.
etree.XMLParser(recover=True),
)