import ast from pathlib import Path def test_deep_agent_uses_deep_context_schema(): graph_path = ( Path(__file__).parents[3] / "package" / "yuxi" / "agents" / "buildin" / "deep_agent" / "graph.py" ) module = ast.parse(graph_path.read_text(encoding="utf-8")) deep_agent = next( node for node in module.body if isinstance(node, ast.ClassDef) and node.name == "DeepAgent" ) context_schema = next( node for node in deep_agent.body if isinstance(node, ast.Assign) and any(isinstance(target, ast.Name) and target.id == "context_schema" for target in node.targets) ) assert isinstance(context_schema.value, ast.Name) assert context_schema.value.id == "DeepContext" def test_deep_agent_does_not_prepend_context_system_prompt_before_runtime_middleware(): graph_path = ( Path(__file__).parents[3] / "package" / "yuxi" / "agents" / "buildin" / "deep_agent" / "graph.py" ) module = ast.parse(graph_path.read_text(encoding="utf-8")) create_agent = next( node for node in ast.walk(module) if isinstance(node, ast.Call) and isinstance(node.func, ast.Name) and node.func.id == "create_agent" ) system_prompt = next(keyword.value for keyword in create_agent.keywords if keyword.arg == "system_prompt") assert isinstance(system_prompt, ast.Constant) assert system_prompt.value == ""