builder: require durable workspace execution
Some checks failed
build / build (push) Failing after 2s
Some checks failed
build / build (push) Failing after 2s
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
import unittest
|
||||
|
||||
from agent_builder.builder import (
|
||||
@@ -12,6 +13,15 @@ from deepagents.backends import StateBackend
|
||||
|
||||
|
||||
class BuilderPromptTests(unittest.TestCase):
|
||||
def test_outer_agent_uses_500_recursion_limit(self) -> None:
|
||||
agent_source = Path(__file__).resolve().parents[1].joinpath("agent.py").read_text()
|
||||
|
||||
self.assertIn("DEEPAGENTS_RECURSION_LIMIT = 500", agent_source)
|
||||
self.assertIn(
|
||||
"config={\"recursion_limit\": DEEPAGENTS_RECURSION_LIMIT}",
|
||||
agent_source,
|
||||
)
|
||||
|
||||
def test_prompt_requires_resource_mirror_for_heavy_agents(self) -> None:
|
||||
self.assertIn("declare resources in BOTH places", SYSTEM_PROMPT)
|
||||
self.assertIn("resources = Resources", SYSTEM_PROMPT)
|
||||
@@ -23,6 +33,13 @@ class BuilderPromptTests(unittest.TestCase):
|
||||
self.assertIn("class GeneratedDeck(Slide)", SYSTEM_PROMPT)
|
||||
self.assertIn("manim-slides render --CE -ql", SYSTEM_PROMPT)
|
||||
self.assertIn("render: bool = False", SYSTEM_PROMPT)
|
||||
self.assertIn('config={"recursion_limit": 500}', SYSTEM_PROMPT)
|
||||
|
||||
def test_prompt_requires_workspace_mounted_execution_for_outputs(self) -> None:
|
||||
self.assertIn("ctx.workspace_shell", SYSTEM_PROMPT)
|
||||
self.assertIn("ctx.workspace_python", SYSTEM_PROMPT)
|
||||
self.assertIn("/workspace/outputs/...", SYSTEM_PROMPT)
|
||||
self.assertIn("not workspace-mounted", SYSTEM_PROMPT)
|
||||
|
||||
def test_prompt_and_backend_load_packaged_builder_skills(self) -> None:
|
||||
expected = {
|
||||
@@ -44,9 +61,14 @@ class BuilderPromptTests(unittest.TestCase):
|
||||
)
|
||||
self.assertIn("skills=[RUNTIME_SKILLS_ROOT]", files["deepagent-agent-design/SKILL.md"])
|
||||
self.assertIn("from a2a_pack import", files["a2apack-agent-authoring/SKILL.md"])
|
||||
self.assertIn("ctx.workspace_shell", files["a2apack-agent-authoring/SKILL.md"])
|
||||
self.assertIn("create_deep_agent", files["deepagents-implementation-patterns/SKILL.md"])
|
||||
self.assertIn('config={"recursion_limit": 500}', files["deepagents-implementation-patterns/SKILL.md"])
|
||||
self.assertIn("ctx.write_artifact", files["workspace-artifact-safety/SKILL.md"])
|
||||
self.assertIn("ctx.workspace_shell", files["workspace-artifact-safety/SKILL.md"])
|
||||
self.assertIn("/workspace/outputs/...", files["workspace-artifact-safety/SKILL.md"])
|
||||
self.assertIn("live_skills[].input_schema", files["agent-quality-review/SKILL.md"])
|
||||
self.assertIn("ctx.workspace_python", files["agent-quality-review/SKILL.md"])
|
||||
|
||||
backend = _with_builder_skills(StateBackend())
|
||||
listing = backend.ls(BUILDER_SKILL_SOURCE)
|
||||
|
||||
@@ -30,6 +30,11 @@ class TemplateInitTests(unittest.TestCase):
|
||||
self.assertIn("LLMProvisioning.CALLER_PROVIDED", files["agent.py"])
|
||||
self.assertIn("WorkspaceAccess.dynamic", files["agent.py"])
|
||||
self.assertIn("RUNTIME_SKILLS_ROOT", files["agent.py"])
|
||||
self.assertIn("DEEPAGENTS_RECURSION_LIMIT = 500", files["agent.py"])
|
||||
self.assertIn(
|
||||
'config={"recursion_limit": DEEPAGENTS_RECURSION_LIMIT}',
|
||||
files["agent.py"],
|
||||
)
|
||||
self.assertIn("skills=skill_sources or None", files["agent.py"])
|
||||
self.assertIn("ctx.llm", files["agent.py"])
|
||||
self.assertIn("ctx.workspace_backend()", files["agent.py"])
|
||||
|
||||
Reference in New Issue
Block a user